A smart contract is a piece of code that automatically executes the terms of a contract based on predetermined conditions. Such a program runs off a blockchain ecosystem, which gives it security, reliability, and immutability.
Just like a traditional contract, a smart contract allows two or more parties to code the conditions of their agreement. The smart contract will administer these without fear or favour, which is why smart contracts are one of the most revolutionary developments running off blockchain technology.
Smart contracts aren’t merely transactional. Today, blockchain developers can build complex applications called Decentralised Applications or DApps using smart contracts.
DApps are decentralised due to the design of blockchain ecosystems such as Ethereum. No central authority is necessary to execute and mediate agreements between parties. No single user controls the DApp, and all the rules are contained in the terms coded in the smart contract.
Decentralised finance(DeFi) is one of the most well-known examples of DApps. For example, decentralised exchanges allow for complex transactions like lending, savings, or insurance without any central oversight. No institution or middle man is required to facilitate transactions on these platforms. DeFi also ensures universal access to financial cryptocurrency services.
Examples of advanced DApps include:
Despite the name, smart contracts aren’t actually "smart". They don’t think on their own, even though they can make real-time decisions. Their autonomy comes from the pre-coded rules and conditions in their functions.
In addition, smart contracts aren't legally enforceable. There is no legal framework existing that offers recourse in case of failure or error. In fact, some contracts depend entirely on the coding and development skills of the team behind them. If an error is made that creates security gaps or bugs, huge losses can be incurred.
For example, one of the largest crypto hacks of all time was the DAO (decentralised autonomous organisation) attack on the Ethereum blockchain in 2016. In the attack, a hacker took advantage of what is called a recursive call bug and stole over 3.6 million Ether.
At the time, that was worth over $170 million AUD. Because the hacker technically played by the rules of the DAO’s smart contracts, he claimed that he didn’t actually steal the Ether.
It is important to note that the DAO hack wasn’t due to a failure of the Ethereum blockchain, it was simply a bug in the DAO built on top of the ecosystem.
Since smart contracts are self-executing and self-arbitrating, they must cover every scenario and condition. What makes them secure is the fact that a public blockchain database maintains mutual trust. Everyone can see what transactions are taking place and has to vote on them.
Smart contracts are already revolutionising business, online communities, finance, and so much more. While the technology is still improving, its potential is inconceivably large, especially as the IoT and Web3 come into mainstream use.