One of the key technological innovations of blockchain 2.0 has been the development of what are called smart contracts. Smart contracts are computer code that is stored inside of a blockchain which encodes contractual agreements. Smart contracts are self-executing contracts with the terms of the agreement or operation directly written into lines of code which are stored and executed on the blockchain computer. A contract in the traditional sense is a binding agreement between two or more parties to do or not do something. Each party must trust the other party to fulfill its side of the obligation. They are a written or spoken agreement that is intended to be enforceable by law.
A myriad of different contractual agreements form the institutional foundations to our society and economy which have evolved since ancient times. If we think about something as seemingly simple as a cafe serving a cup of coffee, we will see that it is really enabled by a massive amount of contracts between different parties that enable them to cooperate in delivering the outcome. Contracts between employees and employer of the coffee shop, contracts that provide workers with health cover, contracts that ensure the coffee shop, contracts between suppliers along the supply chain, contracts between property owner and tenant etc. Our economies are powered by a massively complex set of contractual agreements that are currently created and enforced by centralized organizations like insurance companies and banks which are supported by the ultimate centralized authority, the nation-state system. Our societies and economies are almost completely dependent upon centralized third-party organizations to maintain and enforce these contractual agreements.
Smart contracts feature the same kind of agreement to act or not act, but they remove the need for the trusted third party between members of the contract. This is because a smart contract is both defined by the computer code and executed or enforced by the code itself, automatically without discretion. As such blockchains and smart contract technology can remove the reliance on centralized systems and enable people to create their own contractual agreements that can be automatically enforced and executed by code. Smart contracts are decentralized in that they do not subsist on a single centralized server; they are distributed and self-executing across network nodes. This means that untrusted parties can transact with each other in a much more fluid fashion without depending upon third parties to initiate and maintain the rules of the transaction. Likewise, smart contracts enable autonomy between members, meaning that after it is launched and running, a contract and its initiating agents need not be in further contact.
One illustration of this concept is a vending machine. Unlike a person, a vending machine operates algorithmically; you provide the source input of money and product selection, which the machine takes as input and simply executes on a rule automatically to produce the output. The same instruction set will be followed every time in every case. When you deposit money and make a selection, the item is released. There is no possibility of the machine not wanting to or not feeling like complying with the contract, or only partially complying.
As another example, we can think about a situation where four different people pool their money to make a joint investment that will return interest. A smart contract could be programmed on the blockchain to take any interest that is created, divide it into four and send each amount to the corresponding wallets of the different stakeholders. A smart contract is then really just an account on the blockchain that is controlled by code instead of by a user. Because it is on the blockchain it is immutable meaning the code cannot be changed and thus all participants in the investment can be assured that they will get their share automatically. The code dictates how the processing will take place and no individual has the power to change it, no individual, no organization no government can censor, alter or manipulate it.
In this respect, it is often said that “code is law” in the sense that the code will execute no matter what. Of course, code has been for a while now acting as the law, for example as services have gone online we are increasingly faced with web forms that strictly control what inputs are allowed. If you want to buy an item on iTunes USA then you will have to have a credit card with a US address, the system will auto enforce this by not letting you complete the purchase with the incorrect address. As another example, a logistics company could use smart contracts to execute code that says, if I receive cash on delivery at this location then trigger a supplier request to stock a new item since the existing item was just delivered.
A combination of smart contract with blockchain-encoded property gives us the idea of smart property. Smart property is simply property whose ownership is controlled via blockchain encoded contractual agreements. For example, a pre-established smart contract could automatically transfer the ownership of a vehicle title from the holding company to the individual owner when all the loan installments have been cleared. The key idea of smart property is controlling ownership and access to an asset by having it registered as a digital asset on the ledger and connecting it to a smart contract. In some cases, physical-world hard assets could quite literally be controlled with the blockchain.
One example of such an IoT Blockchain system is Slock.it a door lock that is connected to a smart contract on the blockchain which controls when and who can open the lock. This enables anyone to rent, sell or share their property without a middleman. With such innovations, parking spots can be sublet on demand. Airbnb apartments could become fully automated or someone with 20 bikes in Bangladesh could rent them out, with smart contract locks the bike could shut itself off if it is not being paid for or if it is stolen there is an automatic deposit system or likewise if the person wanted they can simply pay a certain price to purchase the bike outright at anytime.
Like all algorithms, smart contracts require input values and only act if certain predefined conditions are met. When a particular value is reached, the smart contract changes its state and executes the programmatically predefined algorithms, automatically triggering an event on the blockchain. Thus the workings of the overall contract can only be as good as the inputted data if false data is inputted to the system them false results will be output. Blockchains cannot access data outside their network and thus requires some form of trusted data feed as input to the system, what may be called an oracle. An oracle is a data feed, provided by an external service, and designed for use in smart contracts on the blockchain. Oracles provide external data and trigger smart contract executions when predefined conditions are met. Such conditions could be any data like weather temperature, the quantity of items in stock, a successful payment, changes in the prices on the stock market, etc.
An oracle, in the context of blockchains and smart contracts, is then an agent that finds and verifies real-world occurrences and provides this information to a blockchain to be used by smart contracts. Oracles are third party services which are not part of the blockchain consensus mechanism thus whether it be a news feed, website or a sensor, the source of information needs to be trustworthy. As an example, we could think of an online betting platform based on the blockchain that uses smart contracts to automatically execute payouts to people who have placed bets on sports matches. The smart contract system would then have to be connected to a trusted oracle to provide it with the score of the matches. Currently, this oracle would likely have to be associated with some trusted third party centralized organization, like a sports channel or Bloomberg for stock prices. However in the future through datafication and IoT pervasive sensing, this might also be automated given the use of advanced analytics. Using automated oracles that draw data from a myriad of sources and complex analysis to find cross-correlations that provides a statistical assurance that for example an given event occurred or did not occur.
Advantages & Limitations
The advantages of smart contracts are numerous. Firstly they are automatic which could remove time and costs associated with managing and enforcing them; making them more efficient as they can be cheaper and faster to run. Through this form of automation, a much greater amount of exchange could take place that otherwise would never have happened. In such a way we can see how distributed ledger and smart contracts are a key part of enabling a service economy where ownership is displaced by temporary usage through the on-demand provisioning of services. Second, they could reduce corruption, as the code is both transparent in its workings and automatically executed this leaves little room for a centralized organization to alter it to their advantage. Thirdly they can reduce dependency upon centralized organizations as people may be able to set up there own contractual agreements peer-to-peer, thus limiting the arbitrary power of centralized organizations. Lastly, they can also deliver certainty as smart contracts guarantee a very specific set of outcomes that are predetermined beforehand, enabling all parties to know exactly what will happen when.
But herein also lies some of their limitations, by automating the execution of a contract they are dependent upon formal rules with well-specified inputs and leave little room for a multiplicity of eventualities where the rules may need to be slightly altered because of unforeseen circumstances. For example, an on-demand car that operates through a smart contract will simply shut the user out if they have not paid the bill to use the car and may take little account of the fact that it may be a life or death emergency usage. In the real world, many unpredictable and unforeseen events do occur and rules sometimes need to be flexible and adapt to accommodate. This is one advantage of having human oversight as people are much more capable of judging such circumstances and responding appropriately to complex unforeseen eventualities. So the degree to which we can automate contracts is relative to the kind of environment that is being operated in and in complex situations there will often need to be some form of governing body to intervene when needed and this creates new complications surrounding governance that are still yet to be figured out.