Smart contracts are fundamentally automated agreements, stored on a blockchain, between the contract creator and the recipient. They run when predetermined conditions are met. They function to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without intermediary’s involvement or time loss.
Written in code, this agreement is baked into the blockchain, making it immutable as well as irreversible. Popularized by the world’s second most popular blockchain, Ethereum, now adapted by others. Smart contracts have led to the network’s array of decentralized applications (DApps) and other use cases. They can also automate a workflow, triggering the next action when conditions are met.
Key benefit of blockchain networks is the automation of tasks that traditionally require third-party intermediary. For example, instead of needing a bank to approve a fund transfer from client to freelancer, the process can happen automatically, thanks to a smart contract. All that’s required is for two parties to agree on one concept.
Another example could be a regulatory group and the citizens it represents debating a law. If these two parties come to an agreement in a blockchain-based system, the law would be put into place via a smart contract. Maybe users could read about the new law via a legal DApp or interact with it in another blockchain-based way.
History of smart contracts
Believe it or not, smart contracts long predate blockchain technology. While Ethereum, introduced in 2014, is the most popular implementation of the protocol, cryptographer Nick Szabo established the idea in the 1990s.
Back then, Szabo conceptualized a digital currency called Bit Gold. While the asset was never actually launched, this Bitcoin predecessor highlighted the smart contract use case — trustless transactions on the internet. If Web 1.0 was the internet itself and Web 2.0 the presence of centralized platforms, then Web 3.0 is the trustless, automated, user-powered version of the digital space.
Many, including the Ethereum website itself, compare smart contracts to a vending machine. Vending machines serve the purpose of a vendor providing the user with a product, without the need for an actual person to take the money and hand over the item. Smart contracts serve that same purpose but are much more versatile.
Smart contracts have advanced quite a bit over time. They started as simple if-then statements that a programmer creates and implements. However, those with programming knowledge are limited, centralizing these “trustless” contracts. Fortunately, those same developers are working to solve accessibility problems.
Since its inception, developers have made it so smart contracts can be made without coding knowledge. They’re increasing security with different programming languages, creating alternatives like secret contracts, and designing ways to automatically store smart contract history in a human-readable format — much easier than using the blockchain to read.
How do smart contracts work?
Think of these contracts as digital “if-then” statements between two (or more) parties. If one group’s needs are met, then the agreement can be honored, and the contract is considered complete. Let’s say a market asks a manufacturer for 100 units of cups. The former will lock funds into a smart contract that can then be approved when the latter delivers. When the manufacturer delivers their product, the funds will immediately be released. However, the contract is canceled, and funds are reversed to the client if the manufacturer misses their delivery date.
Of course, the above is a small use case. Smart contracts can be programmed to work for the masses, replacing governmental mandates and retail systems, among other benefits. Moreover, smart contracts would potentially remove the need for bringing certain disagreements into court, saving parties both time and money.
This security is largely due to the underlying smart contract code. On Ethereum, for instance, contracts are written in its Solidity programming language, which is Turing-complete. This means that the rules and limitations of smart contracts are built into the network’s code and no bad actor can manipulate such rules. Ideally, these limitations would mitigate scams or hidden contract alterations. A smart contract can only falll into place if all participants agree and sign on the matter. Then, it’s set for life.
In more technical terms, the idea of a smart contract can be broken down into a few steps. First, a smart contract needs an agreement between two or more parties. Once established, the two can agree on conditions in which the smart contract will be considered complete. The decision would be written into the smart contract, which is then encrypted and stored in the blockchain network.
Once the contract is complete, the transaction is recorded on the blockchain just as any other would. Then, all nodes will update their copy of the blockchain with this transaction, updating the new “state” of the network.
Now, you may be wondering if Bitcoin and other networks can utilize smart contracts. To a point, yes. Every Bitcoin (BTC) transaction is technically a simplified version of a smart contract, and layer-two solutions are in development to expand the network’s functionality. That said, Ethereum’s use of smart contracts is a special case.
Unlike most blockchain networks which are described as a distributed ledger, Ethereum is what’s considered a distributed state machine, containing what’s known as the Ethereum Virtual Machine (EVM). This machine state, which all Ethereum nodes agree to keep a copy of, stores smart contract code and the rules by which these contracts must abide. Since every node has the rules baked in via code, all Ethereum smart contracts have the same limitations.
Where do smart contracts apply?
Aside from the payments example mentioned above, there are various, potential implementations of smart contracts that can automate the world and make it an easier place to live. Here are some prominent examples of smart contract use cases.
Information is currency on the internet. Businesses profit from knowing everyone’s interests, and needs. That said people are usually not in control of how that data is collected, nor do they profit from it. With smart contracts, people are in control.
In a blockchain-based future, identities will be tokenized. Ideally, this would mean each person’s identity exists on a decentralized blockchain, safe and secure from any bad actors. Now, if a user wants to participate on social media or submit documents to a bank for loan purposes, they can profit from the harvesting of their data and control the transaction process.
For social media, no intermediary controls a network. Instead, users choose which information to make public and which to keep private. Should they want to participate in information exchange, like an endorsement, they can create a smart contract and choose which data is transacted, rather than simply collecting everything about the user. A third party isn’t there to take some of the funds or secretly store and sell that data — only the user profits.
The same applies when it comes to dealing with banks and other financial institutions. Communication only involves sending required documents and vital information to a desired party. There’s no risk of a loan group storing your email address and selling it to other credit companies. That info is entirely under the user’s control.
In the current world, real estate brokers are a necessary evil. Considering the act of selling a house is nothing convoluted process. Owners hire a broker to manage the tedious and time-consuming components for them, such as the sifting through buyers, delivering only those qualified, showing the house and preliminary negotiations. While that sounds like a great deal for the seller, keep in mind brokers take what many consider a significant fee of the house’s sell price.
A smart contract can take the place of a broker, streamlining the house-transfer process while ensuring it’s just as secure as with an intermediary. This is where the “trustless” moniker comes into play.
Imagine the deed to your house is tokenized on the Ethereum blockchain. If you’re ready to sell it, you’d create a smart contract with the buyer. That contract would hold the deed in escrow until the buyer’s funds are properly submitted. Then, and only then, will it be released.
Everyone wins. The seller saves money as they don’t have to pay an intermediary and the buyer gets the house much sooner than they would have otherwise.
Insurance policies could easily benefit from smart contracts. Essentially, signing up for a policy would enter the user into a smart contract with a provider. All policy requirements would be written into the smart contract which the user would read and sign if they agree.
That contract would sit open until the liable party needs it. Then, they’d simply upload the required forms that prove their need for insurance payment and the funds would be released. This type of contract removes the need for communicating with insurance companies and brokers. While the user would still need paperwork to prove their requirements, the subsequent submission and funding process will be close to instant.
In the identity aspect of things, it’s worth keeping in mind that all drivers will have a record of their accident reports and other important insurance information as well. This accessibility could factor into lower rates for good drivers with no dings on their driving history.
Arguably, one of the most popular implementations of blockchain technology and smart contracts is within a supply chain.
Grocery stores, office buildings, farmers and more all have their specific place in the supply chain. But, with the increasing complexity of these networks, companies are finding it increasingly harder to track product custody and follow payments, among other things. Smart contracts can automate and incentivize all parts of the supply chain to increase their accountability.
For example, say a grocery store is waiting on an apple delivery from another continent. It paid for a specific number of cartons of apples and expects that exact number or volume upon delivery. However, human error can come into effect. Somewhere along the way, workers could have misplaced some apples, they maybe stolen off the line, or simply lied about them all making it to the desired destination. One broken link in the chain messes up the rest of the chain, and by the time a grocery store receives their shipment, who knows where it went wrong.
With smart contracts, the grocery store could set up an automated check-in at each step of the process. While those check-ins already exist in a normal supply chain, they must be fulfilled manually. A person may have to count the cartons and submit what has arrived. They could lie and take some of the product, claiming some were lost along the way. Supply chain theft is a huge problem, costing Americans $35 billion a year.
What’s different with smart contracts is the trustless aspect. The store could set control of payment isn’t released until all apple cartons are accounted for. There’s no way to mislead this system, so parties will be much more attentive when it comes to supply. Plus, payment will be released instantly to the receiving party which is a great incentive.
Also, the store could trace which smart contracts aren’t being fulfilled and choose not to deal with those parties in the future. Eventually, there could be a whole rating network of clients best to work with and those who aren’t, saving everyone time and money in the long run.
Benefits of smart contracts
Speed, efficiency and accuracy
Once a condition is met, the contract is executed immediately. Because smart contracts are digital and automated, there’s no paperwork to process and no time spent reconciling errors that often result from manually filling in documents.
Trust and transparency
Because there’s no third party involved, and because encrypted records of transactions are shared across participants, there’s no need to question whether information has been altered for personal benefit.
Blockchain transaction records are encrypted, which makes them very hard to hack. Moreover, because each record is connected to the previous and subsequent records on a distributed ledger, hackers would have to alter the entire chain to change a single record.
Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees.
Downsides of smart contracts
While smart contracts are great in concept, they’re certainly not perfect. For one, it’s worth remembering that smart contracts and blockchain networks are programmed by hand. Human error is always possible, and that error could lead to exploits. This is exactly what happened with the attack on Ethereum’s Decentralized Autonomous Organization (DAO) in 2016. Hackers exploited a vulnerability in the DAO’s fundraising smart contract and used it to secrete funds from the project.
Plus, one must always question the lack of regulatory clarity when it comes to these autonomous agreements. While the idea of a secure, streamlined money transfer process sounds great on paper, there’s still taxation and other government involvement to consider. Users may want to have full control over their data, but how do governmental parties get what they need?
Also, smart contracts can’t pull information outside of the network in which they exist. At least not in their current state. In other words, you can’t upload data from an existing website to a smart contract on Ethereum. That said, there is a workaround in oracles — off-chain nodes that pull information from the internet and make it compatible with blockchain networks. Eventually, as databases move to the blockchain, oracles could potentially step in to play a role in making that happen.
Additionally, there is a long-standing scalability issue. Since inception, blockchain networks tend to struggle at scale, meaning transactions could take minutes — if not hours — based on activity. While this could be a problem at first, it’s something that projects such as Ethereum 2.0 are looking to solve. Plus, a transaction taking a few hours is still much faster than the days it takes to move traditional funds.
Sources: Ethereum.org, Cointelegraph.com