Smart Contracts 101 - Everything you should know
Definition, how they work, and why it matters.
Smart Contracts are essentially codes written into the blockchain that outlines the terms of the agreements between two parties. Once the agreed conditions are met, the output action will automatically be executed.
Therefore, there is no need for third parties to be involved, hence making it trustless, secure and many times, anonymous.
This is why Smart Contracts lay at the core of crypto use cases. They are the key element that enables the removal of intermediaries, and hence the need of trusting people we don’t know to do the right thing.
Most of the biggest crypto applications as we know today are being built on top of these Smart Contracts, such as Defi, NFTs, and Daos, so before we can expand into these areas, it is important to have an understanding of what’s behind the scene.
How exactly do they work?
The easiest way to understand this is to think about vending machines. Imagine you want to have a coke that costs $2. You insert $2, and you’ll get your coke in return. As simple as that. You insert $5, and you’ll get your coke and $3 of change. Now if you insert a $50, the machine will probably reject it.
The different drinks you can choose from, the kind of bills and coins that the machine accepts, and the combination of change it might have to give you back, are all predetermined.
Smart contracts work in a similar “If…, then…” semantic.
When certain conditions are met, it will trigger a subsequent action. Put simply, it does something, if something else happens.
They typically facilitate 3 functions:
Store Rules: just like the vending machine is programmed with a set of rules to perform certain actions based on specific input, a Smart Contract also has a set of rules coded into it.
Verify Rules: have you ever inserted a bill into a vending machine and got rejected? well, your bill didn’t pass the verification stage, and therefore, there was no further action taken. With Smart Contracts, because it’s built on blockchains, the verification is done by the validators that are incentivized to ensure the network is run properly.
Self Execute Rules: if your money is accepted, then the vending machine will proceed automatically to handing out your coke. In the case of Smart Contracts, once the specific conditions are met, it will also self execute.
What are the key features and benefits?
Immutable: once a Smart Contract is created, it can’t be changed.
Distributed: the validation is done by everyone in the network.
Trustless & Secure: because it’s created, stored, and executed in the blockchain, it possesses these attributes.
Deterministic: there is no grey area. To follow the vending machine analogy, if a vending machine accepts only $1 bills, there are no other bills you can use to buy that can of coke.
Speed: Smart Contracts will self execute based on the rules coded in them when they were created, so there is no human intervention needed. Therefore, there is no working days and hours limitation. It will work automatically, on a 24-7 basis.
Cost Friendly: as there is no need for intermediaries, it represents a cost-saving advantage.
Errors Reduction: Smart Contracts remove the human factor, as well as the human errors that come with it.
Which are the main Smart Contract platforms?
Smart Contracts are built on blockchains, so by definition, it will only be narrowed down to the infrastructure projects that are actually blockchain platforms (read this article to understand more). However, not all of them offer this capability.
Ethereum is specially designed to support Smart Contracts using its native language Solidity and is currently the largest platform for this. There are other competitors, such as Thezos, EOS, Tron. Another famous case is Cardano, which only recently launched its Smart Contract capability around mid-September, so literally a few days back.
It is worth noting that Bitcoin can host Smart Contracts as well, but its functionalities are much more limited compared to Ethereum.
What are the Main Use Cases?
Smart Contracts have really broad use cases and potential. Given that it’s part of the crypto world, the progress of its expansion in terms of applications goes hand in hand with the advancements of crypto space. Therefore, some of the most popular areas are DEFI (payments, loans, etc), Supply Chain, Insurance, Dapps (Decentralized Applications), and others.
Let’s look at the
example of escrow services in the traditional way:
Alice needs to pay Bob $1,000 for merchandise she purchased, but she is insecure about paying without receiving the actual goods.
Bob feels insecure about dispatching the merchandise without receiving the payment.
In order to solve this, they involve Charlie as an impartial third party, to whom Alice will transfer the money.
Charlie will hold that money until Bob’s merchandise’s proved to be properly shipped. By the time Alice receives the goods, the payment will be released and transferred to Bob.
In exchange for his service, Charlie will be charging a fee or commission.
This is how people solve trust issues, mitigating the potential risks in the transactions. However, involving a third party not only means a higher cost and a longer process time due to the additional steps, but also that you will have to trust an additional intermediary to do the right thing and safeguard your interests.
With Smart Contracts, this isn’t necessary anymore.
It will self execute itself once all the conditions are met, which are verified by a network of validators. At the same time, transactions will be recorded on the blockchain, where everyone has access to it.
What are some of the Risks and Challenges?
Software bugs or network attacks: as part of the crypto world, this is always a possibility.
Protocol upgrades on a platform level: the blockchain platforms on which Smart Contracts are built are continuously upgrading themselves, such as Ethereum, and this might affect the proper functioning of the Smart Contracts.
Data sources: Smart Contracts typically use information on the blockchain, as well as real-world data. For this latter case, they rely on Oracle services to ensure the inflow of information is reliable and compatible with the blockchain. This can be a significant limitation as, with the exception of Chainlink, there is not a very robust ecosystem of Oracle projects in the crypto world yet.
Unpredictable Real-World Issues: following the previous point, it is very hard to capture these unpredictable situations without human intervention.
Smart Contracts are really at the heart of crypto. Now that we understand what they are and how they work, we can move on to some of the biggest crypto applications these Smart Contracts enable, such as Defi.
If you appreciate the effort made behind these articles, make sure to subscribe and share!