A Smart Contract (or cryptocontract) is a computer program that directly and automatically controls the transfer of digital assets between the parties under certain conditions. A smart contract works in the same way as a traditional contract while also automatically enforcing the contract. Smart contracts are programs that execute exactly as they are set up(coded, programmed) by their creators. Just like a traditional contract is enforceable by law, smart contracts are enforceable by code.
In 1994, Nick Szabo, a legal scholar, and a cryptographer, recognized the application of decentralized ledger for smart contracts. He theorized that these contracts could be written in code which can be stored and replicated on the system and supervised by the network of computers that constitute the blockchain. These smart contracts could also help in transferring of digital assets between the parties under certain conditions.
How smart contracts work –
A smart contract is just a digital contract with the security coding of the blockchain. A smart contract has details and permissions written in code that require an exact sequence of events to take place to trigger the agreement of the terms mentioned in the smart contract. It can also include the time constraints that can introduce deadlines in the contract.
This contract is embedded in the blockchain making it transparent, immutable, inexpensive and decentralized. Every smart contract has its address in the blockchain. The contract can be interacted with by using its address presuming the contract has been broadcasted in the network.
The bitcoin network was the first to use some sort of smart contracts by using them to transfer value from one person to another. The smart contract involved employs basic conditions like checking if the amount of value to transfer is actually available in the sender account. Later, ethereum platform emerged which was considered more powerful, precisely because the developers/programmers could make custom contracts in a Turing-complete language. It is to be noted that the contracts written in the case of bitcoin network were written in a Turing-incomplete language, restricting the potential of smart contracts implementation in the bitcoin network.
The idea behind smart contracts is pretty simple. They are executed on a basis of simple logic, IF-THEN for example:
- IF you send me the object A, THEN the sum (of money, in cryptocurrency) will be transferred to you
- IF you transfer a certain amount of digital assets (cryptocurrency, for example, ether, bitcoin), THEN the A object will be transferred to you
- IF I finish the work, THEN the digital assets mentioned in the contract will be transferred to me
We can add WHEN constraint to include the time factor in the smart contracts. It can be seen that these smart contracts help set conditions when have to be fulfilled for the terms of the contract agreement to be executed. There is no limit on how much IF or THEN you can include in your intelligent contract.
The smart contract can’t be lost as its embedded in the blockchain itself.
Smart contracts are accurate to the limit a programmer has accurately coded them for execution.
Smart contracts use software code to automate tasks, thereby reducing the time it takes to maneuver through all the human interaction related processes. Because everything is coded, the time taken to do all the work is the time taken for the code in the smart contract to execute.
Every node in the blockchain maintains the shared ledger, providing probably the best backup facility.
There is no third part involved. The contract is made by you and shared between the parties. No intermediaries involved which minimizes bullying and grants fully authority to the dealing parties. Also, the smart contract is maintained and executed by all the nodes on the network, thus removing all the controlling power from any one party’s hand
Cryptography can make sure that the assets are safe and sound. Even if someone breaks the encryption, the hacker will have to modify all the blocks that come after the block which has been modified. Please note that this is a highly difficult and computation intensive task and is practically impossible for a small or medium sized organisation to do.
Smart contracts save money as they eliminate the presence of intermediaries in the process. Also, the money spent on the paperwork is minimal to zero.
Example Use Cases –
- Real Estate. Reduce money paid to the middleman and distribute between the parties actually involved. For example, a smart contract to transfer ownership of an appartment once a certain amount of resources have been transferred to the seller’s account(or wallet).
- A smart contract can be deployed in a blockchain that keeps track of vehicles maintenance and ownerships. The smart contract can, for example, enforce vahicle maintenance service every six months; failure of which will lead to suspension of driving license.
- The music industry could record the ownership of music in a blockchain. A smart contract can be embedded in the blockchain and royalties can be credited to the owner’s account when the song is used for commercial purposes. It can also work in resolving ownership disputes.
- Government elections. Once the votes are logged in the blockchain, it would be very hard to decrypt the voter address and modify the vote leading to more confidence against the ill practices.
- Management. The blockchain application in management can streamline and automate many decisions that are taken late or deferred. Every decision is transparent and available to any party who has the authority(an application on private blockchain). For example, a smart contract can be deployed to trigger the supply of raw materials when 10 tonnes of plastic bags are produced.
- Automating healthcare payment processes using smart contracts can prevent fraud. Every treatment is registered on the ledger and in the end, the sum of all the transactions can be calculated by the smart contract. The patient can’t be discharged from the hospital until the bill has been paid can be coded in the smart contract.
- In supply chain.
Applications/Use cases –
Smart contracts can:
- Provide utility to other contracts. For example, consider a smart contract that transfers funds to party A after 10 days. After 10 days, the above mentioned smart contract will execute another smart contract which checks if the required funds are available at the source account(let’s say party B).
- facilitate the implementation of ‘multi-signature’ accounts, in which the assets are transferred only when a certain percentage of people agree to do so
- Store information about an application, such as domain registration information or membership records.
- Manage agreements between parties
- Record keeping. All contract transactions are stored in chronological order in the blockchain and can be accessed along with the complete audit trail. However, the parties involved can be secured cryptographically for full privacy.
- Direct dealings between parties. Smart contracts remove the need for intermediaries and allow for transparent, direct relationships with customers.
- Fraudulent activity detection and reduction. Smart contracts are stored in the blockchain. Forcefully modifying the blockchain in very difficult as its computation intensive. Also, violation of the smart contract can be detected by the nodes in the network and such a violation attempt is marked invalid and not stored in the blockchain.
- Resistance to failure. Since no single person or entity is in control of the digital assets, one party domination and situation of one parts backing out do not happen as the platform is decentralized and so even if one node detaches itself from the network, the contract remains intact.
- Enhanced trust. Business agreements are automatically executed and enforced. Plus, these agreements are immutable and therefore unbreakable and undeniable.
- Saves money and resources. Application of smart contracts eliminate the need of intermediaries(brokers, lawyers, notaries, witnesses, etc.) leading to reduced costs. Also eliminates paperwork leading to paper saving and money saving.
- A lack of international regulations focusing on blockchain technology(and related technology like smart contracts, mining and use cases like cryptocurrency) makes these technologies difficult to oversee.
- Smart contracts are also complicated to implement because its still a relatively new concept and research is still going on to understand the smart contract and their implications fully.
- They are practically immutable. Whenever there is a change that has to be incorporated into the contract, a new contract has to be made and implemented in the blockchain.
Platforms using smart contracts –
Many platforms that have come up allow for the use of smart contracts. Some are as follows: Ethereum, Bitcoin, Nxt. Today etc.