What they are and how they work
Reading time: 4’
Smart contracts are at the heart of the blockchain revolution, providing the building blocks for decentralized applications (dapps). By now everyone knows what an application (app) is and how it is downloaded to your fixed or portable device.
Behind the countless interfaces of mobile devices, these apps execute a specific set of instructions, as intended by those who created them, allowing users to play games, view a calendar, or simply buy goods and services.
The term “smart contract” itself was coined in the 1990s in an academic paper created by Nick Szabo, a prominent computer scientist, and cryptographer who discussed how contracts could be incorporated into computer codes.
Well, smart contracts perform a very similar function!
A smart contract is a contract, expressed as a piece of code, designed to execute a series of instructions. You can find examples of smart contracts in the financial, entertainment, and real estate industries. They can be used to activate in-game rewards, execute real estate transactions, and settle insurance claims.
Smart contracts have the potential to eliminate paperwork.
With smart contracts, however, there are no intermediaries. No one person or company owns your information or is verifying it. The blockchain verifies and stores information for you.
Regardless of whether it is a cryptocurrency exchange, rights, goods, or services, or a confirmation of identity, smart contracts, just like a normal contract, are designed to enforce the terms of an agreement. Unlike normal contracts, however, they depend on an underlying cryptographic environment that guarantees their operation in #security, # immutability, and #transparency of the data on which they act.
In addition, a smart contract is automatically executed when certain predefined conditions occur when writing code.
Not only that, taking into account that each smart contract usually has a limited set of functions, to form more complex agreements (dapps) it is possible to interconnect multiple smart contracts.
For most blockchains, the code behind smart contracts is immutable. However, several blockchains also support updatable smart contracts.
Usually, at the heart of a smart contract, you will find a mechanism that says (in the computer code) “if it happens, do it”.
Let’s say you want to pay for something using a debit or credit card. The smart contract will use the “if it happens, do it as follows” function:
- If the amount in the bank account is greater than the requested amount, release the funds.
- If the amount in the bank account is less than the requested amount, do not release the funds.
The exciting thing about smart contracts is that anyone can enter into a deal with anyone else, with the blockchain keeping track of the whole thing.
Like the blockchain technology used to power most cryptocurrencies, smart contracts stemmed from previous technologies that weren’t quite complete. In the case of smart contracts, they derive from previous electronic instruction execution programs that used “if/else” statements and other conditional logic to automatically produce a result based on the information presented.
A smart contract alone can only be used for one type of transaction.
Smart contracts are at the heart of the entire decentralized finance (Defi) revolution and are used to power popular Defi protocols like Compound, Aave, Uniswap, and hundreds of others.
But they’ve also been adopted by a whole range of companies, and even some governments have started experimenting with smart contracts. Some of the more prominent examples include:
ING: Dutch bank ING co-created Finality, a blockchain-based trade settlement system that uses smart contracts. He is also involved in several other blockchain initiatives.
The Swedish Government: The Swedish government has tested a blockchain-based cadastre to prove land ownership, which is based on smart contracts.