Bitcoin’s blockchain was designed with the sole purpose of transferring one digital asset: the bitcoin. On a fundamental level, a bitcoin transaction contains three pieces of information: the sender, the amount, and the receiver. That information is signed and broadcast to the blockchain, where the validation process will make it final.
But transactions could potentially contain more information than that. For example, they could hold whole sets of instructions capable of triggering more complex operations.
This is the vision behind smart contracts.
The team behind Ethereum launched the first smart contract compatible blockchain in 2015. The Ethereum blockchain was not only capable of processing fund transfers, but it could also store and execute code.
The most primitive ancestors of smart contracts are vending machines: devices capable of receiving input, understanding and validating it, delivering a product in exchange, and calculating and paying change.
Smart contracts are sets of instructions written in code analogous to the chain of actions performed by a vending machine. Developers deploy smart contracts in smart contract compatible blockchains, where they will live and operate indefinitely without needing maintenance or human interaction.
<aside> 💡 Ethereum founder, Vitalik Buterin, used the following analogy to explain Ethereum: while Bitcoin was like a payments app installed on your phone, Ethereum was like Android - a complete operative system open for developers to imagine what type of applications (=smart contracts) users might want.
</aside>
Let’s see an example. Bob is a photographer who urgently needs cash: he must travel to London where he will shoot Coldplay in concert for a job, but he doesn’t have the money for the trip and the stay in London. After the gig, he will get paid by a music magazine enough to cover his expenses, but he doesn’t have the money now. He does have an expensive watch his wife bought him, though, which costs double the price of his expenses.
A loan is an example of a financial operation defined as a set of steps or instructions that a machine can enforce.
Alice has idle funds in her account that she wouldn’t mind lending for a small interest fee. She could lend money to Bob if he let her have the watch until he paid back the money plus interest once Bob gets paid for the photos.
But who wants to engage in such a relationship? Alice and Bob don’t know if they can trust each other: “will Bob really repay me? Otherwise, I will need to sell the watch, and I don’t know how to do that.” “WIll Alice take care of the watch? If she sells it and disappears, she makes more money than I owe her” If something goes wrong, they might have to resort to the police. Who wants a solution that looks so much like a problem?
A machine could help. Imagine Alice could lock her funds in a vault protected by a robot waiting for Bob. The robot will only unlock the vault and hand Bob the money once Bob gives him the watch. First, the robot makes sure that the watch is authentic, and it will log on to Amazon to make sure that it really costs double the amount of the loan. Then the robot will start a timer. Bob can come before the end of two weeks with the money he took from the vault, plus a small interest, and the robot will unlock the vault and let him have his watch back. Otherwise, if the time runs out, the robot will sell the watch on Amazon, send the money to Alice and ride toward the sunset.
Change Alice’s funds and Bob’s watch for digital assets, and change the robot and the vault for a computer program running on a blockchain, and you get smart contracts.
Decentralized finance has been the first killer application of smart contracts. It has allowed users to swap, lend, borrow and invest in digital assets immediately and globally with unseen efficiency, security, and transparency levels.
However, the real potential of smart contracts is yet to be discovered.
Go back to the main page and move on to section 2 → Onboarding crypto | Your first NFT purchase