Smart Contract: An Introduction
What is a Smart Contract?
Smart Contract can be defined as a virtual agreement of a transaction/exchange of goods or assets that may or may not involve money. Its main role is for two parties to conduct a business transaction/trade, that can be digitally self-executed and self-enforced, acutely eliminating the need for a ‘middleman’. This would transfer power away from those who currently manage or verify transactions — a seismic change to the way the world currently operates.
The origin of a ‘smart contract’ predates Bitcoin. The term was actually first coined by one of the alleged creators of Bitcoin, Nick Szabo back in the 1990’s.
What it means
The traditional contract like those created by legal professionals today, rely heavily on middlemen or third parties be it for validation, review or authentication. There is also risk of loss, destruction or theft. A smart contract eliminates all that.
The blockchain technology makes the same problem autonomous. Since it is based on a decentralized ledger, there is no chance of theft as several copies exist on various computers that host the blockchain. Any change induced by a party, results in the other party(s) being alerted instantaneously! A Smart contract saves time, conflict and is cheaper as the middlemen are cut out and hence no commission expenses.
The mutually agreed upon contact is coded onto the blockchain. The code is law! The parties involved remain anonymous but the ledger containing their contract is public. They conduct business by exchanging private keys. It can also be pre-programmed to execute the bill upon an expiration date or when a summit price is reached. Regulators of the blockchain keep track the transaction to ensure smooth operation in real-time.
“Smart contracts … guarantee a very, very specific set of outcomes. There’s never any confusion and there’s never any need for litigation.” — Jeff Garzik, Bloq
How it works
Since the business to be conducted is digital, it is very important that the code adheres to the requirements of the interested parties. Therefore, the logic must closely match those.
Usually Ethereum is used to code such programs as it provides the most modifiability of all blockchain platforms. But the basic principle is still the “If…this…else…this” statement. Pretty straightforward however the connotations may vary and hence it can be more complex.
The code is then encrypted using cryptography and then spread to other computers using Distributed Ledgers of the blockchain. Any changes in the code made by either or all parties is visible to all as the ledger is public.
The first party then initiates the transaction and the instruction is sent to the network for execution. No party can determine the outcome as the control of the program is not in their hands.
Let us take an example to understand it better….
Suppose you wish to buy a car from a man on the other side of the world. You set up the contract on the blockchain maybe in Bitcoin(BTC). The blockchain holds your money in escrow, while the private key (maybe the registration papers of the car, or other formalities) arrive from the seller. If the ‘key’ doesn’t arrive before the expiration date then as per condition of the Smart contract your money is refunded. See, so simple and fast.
We’ve talked about a financial situation. But the same can be extended to healthcare, real estate, management and general trade. Given below is a sample code for a basic smart contract on the Ethereum blockchain.
Sample code taken from https://www.ethereum.org/token
From the above discussion, we can clearly see the advantages of a Smart Contract: Speed, Safety, Accountability, Accuracy and is cheap all the way.
Key features of Smart Contract
• Accuracy — smart contract come without the errors that may occur in manually filled out forms and no loss during transportation of assets/business. You’re the one making the contract. No need to deal with brokers, etc.
• Accountability — decentralization and immutability of the blockchain is the main reason for its ever-increasing popularity. Parties involved are always in the loop; they are always made aware of what is happening when and when. The ledger on which it is stored can be viewed by anyone.
• Safety — the data is stored across the entire network. So, it isn’t possible to hack/steal the data as there are copies on various other systems. It would take an exceptional hacker to break through the cryptographic encryption of the blockchain
• Speed — the time that is wasted in physically writing all the forms and waiting for the middlemen to ascertain and complete all the formalities is non-existent here.
Perfection is still miles away….
Smart contracts are far from perfect. What if there are errors in the code? What if your intentions were correct but the logic applied in the program is incorrect? How will the government levy taxes on such transactions/sales? Who will keep a check on these contracts? The regulators mentioned above may be faulty or corrupted.
The future of smart contracts looks to be a combination of both digitisation and physical paper. The blockchain will be used to set up and conduct the contract, whereas paper will be used to substantiate all the claims made by the involved parties.
Nothing is set in stone but the future of our world looks to be very interesting indeed. Blockchain and the smart contracts will sure change the shape of the world.
For more updates, technical blogs and general discussion on Blockchain Technology and Ethereum, please join us at our Website, Reddit, Facebook, Medium, Slack and follow us at Twitter. Please feel free to share this post and email your suggestions.
#smartcontract #ethereum #cryptocurrency #blockchain #eli5
Originally published at localhost on September 17, 2017.