What are Smart Contracts and How Do They Work? (Examples & Challenges)
Smart contracts are a new technology that enables automatic negotiation, fulfillment and execution of agreement terms in a blockchain environment.
I recently asked a friend of mine what he thought of ‘Smart Contracts.’ He’s a developer and I figured he might have some interesting insight. To my surprise, he did not know what a smart contract was. I was especially surprised since we had spent over a year discussing cryptocurrencies, SEC regulation and many other things related to blockchains. How could someone knee deep in the computer industry not know what a smart contract is?
Well the truth is smart contracts may create more confusion among crypto enthusiasts than any other idea related to the industry. Therefore, it’s not an easy concept to explain, especially to those who just got a handle on what a blockchain is. Consequently, the concept is still shrouded in mystery. Hopefully, this article can clear that up a little.
What are Smart Contracts?
Smart contracts are a new technology that is only possible through the use of blockchains. While a garden-variety, standard contract outlines the terms of an agreement between parties and is often enforceable by law; a smart contract is digital, stored within a blockchain and enforces all aspects of the agreement with cryptographic code.
In other words, smart contracts are simply software programs, and like all programs, they execute exactly as they are supposed to by their programmers. Smart contracts read just like programmed applications: ‘If this happens, then do that.’
Basically, through elegant math, smart contracts can negotiate the terms of an agreement, automatically verify fulfillment and even execute the agreed terms-- all without the use of a central organization to approve whether a party completed their end of the agreement. Smart contracts make intermediaries like notaries, agents and lawyers nearly pointless.
I understand you may still be confused. Stay with me.
How do Smart Contracts work?
The idea of smart contracts was first conceived in 1993 by a computer scientist and cryptographer by the name of Nick Szabo.
In a 1994 essay, Nick wrote “The general objectives of smart contract design are to satisfy common contractual conditions (such as payment terms, liens, confidentiality, and even enforcement), minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries. Related economic goals include lowering fraud loss, arbitration and enforcement costs, and other transaction costs. Some technologies that exist today can be considered as crude smart contracts, for example POS terminals and (credit) cards, EDI, and agoric allocation of public network bandwidth.”
Although smart contracts only really became possible with the creation of Bitcoin in 2009, it was Ethereum that embraced it wholly, making it possible to execute and store smart contracts within its distributed ledger. Ethereum’s platform was specifically designed for executing smart contracts, making both transactions and ICOs (Initial Coin Offerings) possible and seamless. In many ways, smart contracts are the building blocks of all blockchain technology. Furthermore, many exciting new blockchain startups are absolutely dependent on the revolution smart contracts are expected to create.
Just like there’s a network of nodes that validate bitcoin transactions, smart contracts also use a network of nodes to validate whether aspects of the agreement have been completed. They don’t need an intermediary like a lawyer to verify the existence of these aspects. These nodes and the code within the smart contracts provides the validation itself. This also makes smart contracts transparent and traceable by all the parties involved. Therefore, trust between parties is no longer a moot point. Lawyers may still be needed at some point, but much of the battle has been done.
Lastly, since a smart contract is embedded within a blockchain where all data is stored in a decentralized distributed manner, no one is in control of the money-- not until the contract’s terms are completed. This money is often the blockchain’s native cryptocurrency- like Ethereum’s Ether. It doesn’t get more trustless than that.
Examples of how you can use Smart Contracts
In many ways, smart contracts are like the contracts you might have signed to buy a car. Except now these contracts are automated and trust can be digitally secured.
Nick Szabo wrote in his paper, “We can extend the concept of smart contracts to property. Smart property might be created by embedding smart contracts in physical objects. These embedded protocols would automatically give control of the keys for operating the property to the agent who rightfully owns that property, based on the terms of the contract. For example, a car might be rendered inoperable unless the proper challenge-response protocol is completed with its rightful owner, preventing theft.
If a loan was taken out to buy that car, and the owner failed to make payments, the smart contract could automatically invoke a lien, which returns control of the car keys to the bank. This smart lien might be much cheaper and more effective than a repo man. Also needed is a protocol to provably remove the lien when the loan has been paid off, as well as hardship and operational exceptions. For example, it would be rude to revoke operation of the car while it's doing 75 down the freeway.”
Here are some examples of smart contracts:
Since the last very dramatic US presidential campaign, the integrity of the current voting system has been repeatedly challenged by politicians and voters. Is it rigged or isn’t it? With smart contracts, it will be impossible to rig it in any way.
If all votes were stored on a blockchain, it would be nearly impossible to hack and decode them. In addition, the automated nature of smart contracts can make the tedious process of voting much simpler and fully online. It may even boost the low turnout America usually gets. Blockchain startups like Horizon State want to enable transparent, unbiased voting in nations around the world.
More often than not, supply chains are hampered by a paper-based system of contracts. These forms have to pass through many hands for sometimes even the simplest tasks. Theft, loss and fraud are quite common due to the increased exposure this system creates. The blockchain and smart contracts nullify this by providing a secure, transparent digital version to all parties. It can automate tasks and transactions, and even restrict behavior based on the rules stored within its code.
I recently was introduced to a friend’s newly born baby. He was maybe just a few months old. For some strange reason, one of my first thoughts was that by the time this child is old enough to drive, self-driving cars will be the norm. In fact, almost everything about cars will be automated. Smart contracts will be what drives this automation.
An example would be an insurance company charging rates based on the way customers are operating their vehicles. The vehicles would be the ones reporting this data to the insurance companies. A trippier example would be vehicles talking to other vehicles on the road-- like one allowing the other to make a lane change once certain conditions are met, like “If your passenger is late for work, plus has a route with worse traffic than mine, you can cut in front of me.”
Let’s suppose you rent an apartment for a week through airbnb, except this is a version of airbnb that exists on a blockchain in which you can pay in a cryptocurrency. After paying, you receive a digital receipt, as dictated within the code of the smart contract. The smart contract tracks whether you receive the “digital key” or not. If you don’t get this key by the specified date, the smart contract automatically gives you a refund.
Of course, these types of programs work best when items like house keys are digitally tied to the internet. That’s why the marriage of (IoT) Internet of Things and blockchain will be so huge in the future, enabling enormous transformations across industries.
For those of you who don’t know, the “Internet of Things” is the network of physical devices like home appliances that are embedded with software and sensors that enable them to connect and exchange data over the Internet.
Healthcare can be very complicated, and I’m not just talking politically. Smart contracts can definitely help streamline the process of authentication and authorization for insurance trials, patient data protection, regulation compliance and even healthcare supplies.
Banking seems to be the industry most open to blockchain and smart contract implementation. It is not hard to comprehend why when you consider the enormous amount of money that can be saved by automating various financial operations, including international transactions.
As mentioned earlier, the traditional model of contracts often relies on lawyers and notaries to resolve conflicts and ensure all aspects of the agreement are met. However, smart contracts automate these steps in a traceable and transparent way. When you consider the enormous amount of money and time that can potentially be saved, smart contracts can make notaries and contract lawyers nearly obsolete.
As powerful as this new technology can be, we may still be several years away from implementing it across most industries. There are several reasons for this. For one thing, smart contracts can get extremely complicated. Smart contracts, more often than not, require more than one smart contract to complete tasks. A multitude of smart contracts linked together is often needed to cover all the scenarios that may occur. This can pose a challenge for programmers during the infant years of this technology. Artificial intelligence has the potential to streamline that process. Until then, expect the occasional error when dealing with highly complex transactions.
Second, as mentioned earlier, this technology works best with IoT. Without IoT, smart contracts themselves cannot interact with the real world. Smart contracts need an entity, sometimes referred to as an ‘oracle’ to let them know when a task is completed. This “single point of failure” can make a smart contract less decentralized and secure.
The third problem is probably the biggest. Smart contracts are programs. What if the program gets bugs? Afterall, it’s still humans constructing these programs and vulnerabilities are to be expected. When ethereum was first launched, it was a bug within its smart contract that allowed the easy theft of millions of dollars worth of ether. This led to the fork that created Ethereum Classic.
What if a party using a smart contract sends the wrong information? What if he or she sends the wrong house key to an airbnb customer? If there’s problems or mistakes with traditional contracts, parties could challenge them in court before events can take place, but with smart contracts, the contract is executed regardless.
These kinds of critical issues and much more make businesses uneasy about adapting smart contracts. However, most aficionados like myself have confidence that developers and AI will eventually figure all this out. Trial and error is their friend. After all, it took decades for the Internet to evolve into the beast it is today. And yet, the Internet still has its problems and complications. Online advertising anyone? Net neutrality?
Why Smart Contracts are our future
There is no doubt in my mind smart contracts will be a part of our future in one form or another. Even today, the positives far outweigh the negatives. Transparency, fraud reduction and immutability make smart contracts a credible alternative for most established businesses.
Here are additional benefits to using smart contracts in your business:
- Better customer service. Without the need for intermediaries to create trust, businesses can engage directly with customers.
- Employee departures don’t affect its functionality. Decentralization means there is no need to worry about the loss of data. The blockchain and its smart contracts will continue to function regardless.
- Cost reduction. Eliminating the middleman means less fees. How much does your lawyer charge again?
- Record keeping. Since smart contracts are implemented through blockchains, it means all data is efficiently chronologically stored and can be easily accessed. Your documents are duplicated many times over in every node within the network.
- Faster speed. Without the extra steps needed when incorporating middlemen in traditional contracts, tasks automated by smart contracts happen much faster.
Blockchain technology is already impacting businesses around the world. Smart contracts make this possible. More importantly, promising use cases for smart contracts are laying the groundwork for new and exciting business ideas. So try not to think of smart contracts as job killers. Instead, think of smart contracts as job creators-- jobs yet to be imagined.
For those businesses that are scared of adopting this technology, I don’t blame you. Fortunately, some of the brightest minds in the world are fixing the glaring problems I mentioned earlier. It may take decades, but smart contracts will indeed become a powerful alternative for many of the systems in place across countless industries.