 One of the key technology innovations of second-generation blockchains has been the development of what are called smart contracts. Smart contracts are computer code that are stored inside of a blockchain which encode contractual agreements. Smart contracts are self-executing with the terms of the agreement or operation directly written into lines of code 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 parties to fulfill their side of the obligation. They are a written or spoken agreement that is intended to be enforced by law. A multiplicity of different contractual agreements form the institutional foundations to our modern 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 this process is really enabled by a massive amount of contractual agreements between different parties that enable them to cooperate in delivering that outcome. Contracts between employees and employer of the coffee shop Contracts that provide workers with health coverage 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, by insurance companies and banks which themselves are supported by the ultimate centralized authority in the system, the nation's state's institutions. Our societies and economies are almost completely dependent upon third-party organizations to maintain and enforce those contractual agreements. Smart contracts feature these same kind of agreements to act or not act, but they remove the need for the trusted third party between members involved in 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 as 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 the computer code. These smart contracts are decentralized in that they do not subsist on a single centralized server but are distributed and self-executing across a network of 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 pre-specified output. The same instruction said 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 long as it's functional. As another example, we can think about a situation where four people pool their money to make a joint investment that will return interest to them. 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's on the blockchain, it is immutable. That means the code cannot be changed and thus all participants in this investment can be assured that they will get their fair share automatically. The code dictates how the process will take place and no individual has the power to change it. No individual, no organization, no government can censor, alter, or manipulate the contract. In this respect, it's often said that code is law, in the sense that the code will execute no matter what. Of course, computer code has been for a while now acting as the law. For example, as services have gone online, we're increasingly faced with web forms that strictly control what inputs are allowed. If you want to buy an item on iTunes USA, then you'll have to have a credit card with a US address. The system will also enforce this by not letting you complete the purchase with an 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 contracts 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 that to a smart contract. In some cases, physical world hard assets could quite literally be controlled via the blockchain. One example of such an IoT blockchain system is Slocket, 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 need of a middleman. With such innovations, parking spots can be sub-lettered on demand. Air BNB accommodation 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's stolen then there could be an automatic deposit system or likewise if the person wanted they could simply pay a certain price to purchase the bike at any time. 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 then false results will be outputted. Blockchains cannot access data outside of their network and thus require 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, the completion of 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. As of present 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 datification 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 analytics to find cross-correlations that provide a statistical assurance that for example a given event occurred or did not occur. The advantages of smart contracts are numerous. Firstly they are automatic which could remove the 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 have never happened. In such a way we can see how distributed edges and smart contracts are a key part in enabling a true services economy where ownership is displaced by temporary usage through the on-demand provisioning of services. Secondly they could reduce corruption as code is both transparent in its workings and automatically executed this leaves it a room for individuals or organizations to alter it to their advantage. Thirdly they can reduce dependency upon centralized organizations as people may be able to set up their 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. 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 a car that's being used on demand that operates through a smart contract may simply shut the user out if they have not paid their bill and would 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 to occur and rules sometimes need to be flexible and adaptable to accommodate and this is one advantage of having human oversight as people are much more capable at 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's being operated in and in more 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.