The invention of Bitcoin was ground-breaking for sure. Yet while cryptocurrencies are an amazing invention, the real revolution is provided by Blockchain technology. Decentralized blockchain networks serve as an innovative infrastructure for the hosting of so-called smart contracts.
Smart contracts are programmed code that allow for the development of entire decentralized applications that run blockchain networks like Ethereum. Given their decentralized nature, dezentralized application, dApps for short, can’t be censored nor taken offline by governments, regulators or malicious actors.
In this article, we want to shed a light on what smart contracts are, how they work, and their connection with the Ethereum token standard ERC-20.
What are smart contracts?
Smart contracts are programmed code that executes automatically if a certain predefined condition is met. Hence, they follow simple if-then-logic. Smart contracts can be hosted and executed on decentralized blockchain platforms.
The idea of a smart contract was first proposed by researcher Nick Szabo in 1992. Szabo gave the example of a vending machine: If you throw in the adequate amount of coins, it will give you the respective bottle for consumption.
Then, in 2013, 19-year old Russian-Canadian programmer Vitalik Buterin recognized that the real revolution of blockchain technology was not Bitcoin, but the ability to host and execute smart contracts on a decentralized infrastructure – and use those to build decentralized applications (“dApps”).
Hence, he (along with subsequent Polkadot-founder Gavin Wood and Cardano-founder Charles Hoskins) developed Ethereum, a decentralized smart contract platform with its own native programming language “Solidity” to write smart contracts in.
Thereafter followed the creation of first decentralized applications (“dApps”) which are nothing else than a single smart contract or a combined collection of smart contracts working together. dApps are groundbreaking because given the decentralized nature of their execution, they are censorship-resistant and resilient.
Applications of smart contracts
The applications of smart contracts are endless, and we see use cases emerging in dozens of industries. Two simple but powerful examples include:
- Escrow services: Smart contracts can be used to construct a decentralized, automated escrow service. The building blocks are a sender’s wallet, a receiver’s wallet and a third-party escrow smart contract. In the first step, the escrow smart contract must be defined to take into account the settlement procedure and conditions of the product/service to be delivered. Before a specific transaction occurs, the sender’s funds are then deposited and locked in the third party smart contract with escrow function. Once the payment conditions are fulfilled, the money is released from the smart contract and sent to the receiver’s wallet. If, however, the product/service is not delivered within the time frame specified in the smart contract, the tokens are returned to the sender’s wallet.
- Crypto gaming: While there are many possible use cases in the blockchain and crypto gaming space, we will pick the automatic distribution of price money. A big problem in online gaming is that players have to trust a centralized entity to actually pay out prize pools (prize money) upon tournament winning as originally planned. With smart contracts, this trust issue can be eliminated. When tournament and prize pool conditions are agreed upon, a smart contract can be set up so that upon tournament completion the prize money is automatically paid out to the respective winners. By auditing smart contracts, users can see how much money was actually sent to which wallet address.
To better understand the power of smart contracts when it comes to the Ethereum blockchain, we have to discuss the topic of ERC-20 tokens and the ERC-20 token standard.
The ERC-20 token standard
ERC-20 is a token standard for tokens issued on the Ethereum blockchain. Ethereum with its native tokens Ether (ETH) is not only the most popular and widely adopted smart contract platform, it also serves as the infrastructure or transactional layer for most crypto tokens (“altcoins”) in existence. The abbreviation ERC stands for “Ethereum request for comment”, as the ERC-20 standard was implemented in 2015, following a request and proposal for it by parts of the Ethereum community.
As a token standard, ERC-20 is a template for tokens that encompasses a number of principles and rules that an ERC-20-token and smart contract must follow for implementation and execution, such as functionality to request the balance of a certain account or transfer tokens. Many of the most renowned altcoins are actually (or were originally) ERC-20 tokens, including Maker (MKR) or the Basic Attention Token (BAT). While the Binance Smart Chain has become a competitor with its BEP-2-token-standard, the overwhelming majority of crypto tokens and altcoins in existence are still based on the ERC-20 token standard.