Have you ever heard the expression “code is law” where technology is used to enforce rules? In that case, do we even need lawyers? Or maybe we can live in a fully automated world where code dictates what we can and cannot do. With the current development of smart contracts, this futuristic scenario may be closer than we think.
A smart contract is a piece of code that can be executed automatically and in a deterministic way. The smart contract code is usually stored and executed on the blockchain to make it trustless and secure. Smart contracts also have capabilities of receiving, storing and sending funds and even calling other smart contracts. They follow if-then semantics which makes them fairly easy to program.
Smart contracts aim at removing the human factor from decision making. The human factor is often proven to be the most error-prone and unreliable element of the standard, traditional contracts.
Ethereum is a good example of a blockchain that supports smart contracts and make it possible for a programmer to implement their own smart contracts. A smart contract can be written in a programming language called Solidity which was created specifically for that purpose. In Ethereum, all the deployed smart contracts are immutable. This means that once deployed they cannot be modified which creates certain risks that we’re going to discuss later. Smart contracts on Ethereum are also decentralized which means there is no single machine controlling the contract. In fact, all the nodes of the Ethereum network store the same contract with exactly the same state.