Smart contracts have been around in a conceptual sense since the 1990s, first proposed by computer scientist Nick Szabo, who remains a prominent figure in the blockchain and cryptocurrency space today. Szabo likened the idea of a smart contract to a vending machine.
Szabo acknowledged that a distributed ledger would be an optimal platform for executing smart contracts, as the nodes on the network could oversee operations.
On the most basic level, the smart contract works on an “if-this-then-that” logic. It will fulfill its conditions when a trigger action occurs, similar to putting a coin in a vending machine and receiving a can of soda in return.
Although the launch of Bitcoin in 2009 offered some basic execution logic, the Bitcoin blockchain was only capable of accounting transactions of bitcoins. It cannot handle anything more complex. It wasn’t until an enterprising young developer called Vitalik Buterin found Bitcoin and figured out that a scripting language would allow a blockchain to run more complex applications. And so blockchain smart contracts were born.
In 2015, the Ethereum genesis block marked the launch of the world’s first smart contract platform—a decentralized network confirming smart contracts composed in the general-purpose Solidity programming language executed by the Ethereum Virtual Machine.
Fast-forward six years, and Ethereum is still going strong. Moreover, it now has a slew of smart contract platform competitors, including EOS, Binance Smart Chain, Solana, Neo, and many more.
Virtually all smart contracts have the same characteristics regardless of which platform they run on.
Firstly, once they’re put into production, it’s impossible to change a smart contract. It may be possible for developers to leave certain parts of the coding open-ended, allowing new functionality to be added. However, there’s no way to do this under the radar. Every change is visible to the entire network and published transparently on the blockchain.
Similarly, nobody can manipulate the outcome of a smart contract, and there is no room to interpret the terms. The process is deterministic, and the same input will always produce the same output.
Finally, all smart contracts have a state shared across the network. For example, a smart contract may be programmed to disburse tokens when someone deposits ETH into it. The smart contract state shows its token balance, its ETH balance, whether or not it has disbursed tokens, and, if so, when and to which addresses. Every node on the network has a copy of this information for every smart contract running on the platform.
When coded correctly, blockchain smart contracts are a powerful tool. They can introduce automation, bringing efficiencies and saving time. And there’s very little risk of losing data because everything is backed up by nodes on the network. If a node goes down, other nodes retain the data, which means that the risk is extremely low on matured blockchains like ETH.
However, perhaps the most powerful strength of smart contracts is also a key weakness. Programming languages like Solidity are general-purpose languages by design and can be used to program any outcome. However, this also means that smart contracts programmed in Solidity can have bugs that result in unanticipated outcomes. These have significant ramifications for any smart contract, but the implications can be serious when there are considerable funds involved.
The most famous example is The DAO hack, where someone spotted a bug in a crowdfunded smart contract and used it to drain funds. This resulted in a controversial hard fork of the Ethereum and Ethereum Classic blockchains as the core development team decided to roll back the history to restore funds. However, over recent years, in particular, with the rise of DeFi, smart contract vulnerabilities have become more commonplace.
In Ethereum, even the most simple ERC20 token is a smart contract. The underlying code contains certain mandatory conditions, such as “approve” and “transfer,” which will enable the movement of tokens to another address upon the approval of the key holders.
More complex iterations of smart contracts are used all across the DeFi sector. For example, in a decentralized exchange like Uniswap. When someone stakes liquidity in Uniswap’s liquidity pools, a smart contract automatically returns liquidity pool tokens representing their stake.
Similarly, Uniswap’s underlying smart contracts will also assign a share of the transaction fees accrued by the same pool as a reward for staking liquidity. When the user deposits their liquidity tokens back into the Uniswap protocol, a smart contract returns their stake along with a share of transaction fees.
Smart contracts can also be used to handle other features of tokens. For instance, it’s increasingly common, particularly in DeFi, that token ownership confers governance rights. Smart contracts can ensure that when each ballot opens, the token holder has a right to participate.
The use cases listed here are merely the tip of the iceberg. Enterprise adoption and the continuing growth of segments such as DeFi and NFTs mean that there are plenty more use cases for smart contracts. Many of these have still yet to be explored.
Proof of Authority and Proof of Stake are becoming increasingly popular alternatives to the original consensus method, Proof of Work. But what’s the difference between these two models?Read More
Love them or hate them (there seems to be little middle ground where NFTs are concerned), non-fungible tokens are here to stay.Read More
Lately, non-fungible tokens (NFTs) have taken the world by storm. But what exactly are NFTs? And why are they commanding so much global attention?Read More