In my previous posts, I had explained about Blockchain technology, with some focus on Bitcoin. Wondering what I’m talking about? Check my previous posts here. Before I answer the question of smart contracts, first let me explain the need for smart contracts.
A tiny problem
Blockchains can solve the problem of having an intermediary in control of our money. This is done by keeping a decentralized ledger. As you know, blockchains support digital currencies by solving two problems; the double spending problem and the requirement for trust in a central authority such as a bank. A problem which blockchains initially didn’t solve was that of arbitration of disputes.
Let’s take an example. Alice needs a new pair of socks, and she has decided to buy them from Bob. The two of them cannot exchange physical money since they don’t live geographically close to each other. Therefore, Alice decides to pay Bob using a cryptocurrency, say Bitcoin. After Alice pays Bob, if the latter is dishonest, he can refuse to send the goods, even after receiving the money. Or alternately, Alice may deny that she received the goods even after receiving them. This is a problem.
The Answer
When transacting online with banks as the middlemen, people can legally resolve disputes, but in the case of Bitcoin and some cryptocurrencies, there is no legal way to resolve disputes. Here comes the role of smart contracts. Basically, smart contracts are software entities which enable people to safeguard the payment until certain conditions are met. In the above example, the condition is that the parcel containing the pair of socks be delivered to Alice. The delivery can be verified through the shipping company, thus releasing the payment from Alice to Bob and the shipping company. The advantage of this approach is that the conditions of the smart contract have the ability to enforce it, since it is essentially a piece of code. This is unlike real world legal contracts which are written on paper and require other people to execute the contracts. Therefore smart contracts are software entities existing on the blockchain which enable secure, fast and open transactions.
Other Issues
Bitcoin supports the creation of scripts which allow people to specify the rules for a transaction to succeed, but note that the scripting language in Bitcoin is rather limited. This means that the Bitcoin blockchain can only be used to create very simple smart contracts. The Ethereum cryptocurrency and Linux Foundation’s Hyperledger framework can be used to create contracts such as those mentioned in the example. For this purpose, high-level languages are used, such as Serpent or Solidity. Alice and Bob can then create a smart contract, based on terms and conditions agreed by both, which are then enforced in software. On the Ethereum blockchain, these contracts are publicly visible and are executed on a virtual machine, called the Ethereum Virtual Machine(EVM). Just like the Java Virtual Machine executes Java bytecode, the EVM executes bytecode generated by compiling a high level language such as Solidity.
However, not everything is perfect with smart contracts. Since its inception, a lot of security vulnerabilities have been discovered. Some of these have resulted in losses amounting to 50 million dollars. Moreover since the technology is still quite new, bugs in the EVM, compiler and the high-level language used often crop up. Nevertheless, smart contracts open up new avenues for change in the financial world, and new uses for the blockchain are constantly being discovered.
Enfin
Hopefully, now you have a basic understanding of what smart contracts are. Stay tuned for more.
2 thoughts on “What are Smart Contracts?”