What Are Smart Contracts and How Do They Work
A simple concept with huge implications, smart contracts are actually a software form of contracts that work on a blockchain. In this post, we’re going to learn what this means and how smart contracts can make our lives easier.
What is a contract
If we want to learn about smart contracts, we first need to define what a contract is. Let’s say I have a couch in my living room that I don’t use anymore and want to sell. And as chance may have it, you’re looking for a comfy couch for your room. One of us learns about the other’s situation, maybe through an ad, and makes an offer. Let’s say you call me and say that you know I have a couch and you want to buy it. We may negotiate on the price and finally agree on a transaction.
Our agreement may look something like this: You agree to send me half of the price and I agree to send you the couch. You also agree to pay the movers when they get the couch to you and also pay the other half of its price to me after you get it.
As you can imagine, this process requires a lot of trust. You trust that I actually have a couch and that I’m telling the truth about its condition. I trust you to pay me and the movers fully.
Now what if the thing you were buying wasn’t a couch but something much more expensive like a house? You wouldn’t just trust me blindly and I wouldn’t either, right? We would write a contract to keep everyone honest.
To make a good contract we will probably use some intermediaries like real estate agents, brokers, lawyers and notaries. And the contract itself will be a series of “if”s and “then”s in a written document that both of us will sign. For example, the contract may say that if you don’t pay the full amount of agreed-upon money in the specified time, then the whole agreement is null and void and I don’t have to give you anything.
You can also read:
Blockchain explained: a simple introduction to the blockchain technology
What is a smart contract
As you just saw, in its essence, a contract is just a series of “if this then that” functions. This kind of function can be programmed and turned to code. And this is exactly what smart contracts are: Software programs that contain a series of “if this then that” functions and work on a blockchain.
Now that we know the general meaning, we should discuss the blockchain part. The fact that smart contracts work on a blockchain means several things:
- The whole blockchain, meaning all the computers or nodes that run it, validate all the “if”s of the smart contract. So gaming the system and cheating is hard and you don’t need to trust the other side of contract blindly.
- Because of this participation of the nodes and the self-execution and automation of the whole process, you don’t really need all the intermediaries like before. So you speed the whole process up and reduce the costs associated with making contracts and doing deals.
- With the blockchain, there is no paperwork but the information gets recorded on the block and stored on all the nodes forever. Everything is still accessible but more secure and if someone wanted to hack the information related to a smart contract, they would need to hack all the nodes at the same time, which is practically impossible.
For example, if our couch transaction was a smart contract, you would pay the whole price to the contract. But the money wouldn’t get released to me unless I sent you the couch and you signed for it on the blockchain. Of course, there can be other conditions for this kind of transaction as well.
In the documentary cryptopia, Andreas Antonopoulos (author of “Mastering Ethereum”) says “A smart contract is neither smart nor a contract. It’s a dumb program”. And he’s right. This technology is at its infancy and although the possibilities are endless, we’ll need to wait and see how things work out.
In theory, smart contracts can be used for many financial services as well as voting and holding elections, controlling supply chains and even confidential healthcare data systems. The focus until now has been on the financial services. But as this ecosystem of blockchains grows, we will probably see some other real-life examples soon.
If you’ve found this post to be useful, share it on your favorite social media and with friends.
Comment below with your own thoughts on the matter.
***Last Updated on 21 March 2022 by Hamed Derakhshani (Guy with a Wallet)