The term “contract” is a legal term that describes how individuals, groups, organizations, companies, or societies agree on different aspects of relationships between each other. In a very simplistic sense, we have to agree on what someone has to give in exchange for getting something in return. For example, when we sign an employment contract, we determine rights and responsibilities between an employer and employee. Contract law is very complex, and in the civil law tradition, contract law is usually a branch of the law of obligations.
So now that we have a basic understanding of a contract, we may explore the topic of smart contracts.
What is a smart contract?
The first thing you need to know about a smart contract is that it exists only electronically or digitally. So a more accurate term would be a digital smart contract. But what makes a contract “smart”?
When people hear about smart contracts for the first time, they think that these are traditional contracts that are somehow stored on a blockchain or the web. But this is not the case.
A smart contract is a piece of code with predefined rules of execution. These rules are constructed in “if-then” semantics. This means that a smart contract gets executed automatically when something happens that corresponds with predefined rules of the contract.
We can use the vending machine as an analogy to a smart contract. For example, a chocolate bar costs $2 and is stored in an A4 position inside a vending machine. We can describe this in “smart-contract” terms:
“IF we insert $2 and press A4, THEN the machine releases the chocolate bar to the buyer.”
Every smart contract needs very specific rules so it can deterministically execute those rules.
Where are smart contracts stored?
Smart contracts are stored and executed on the blockchain. Because blockchain can be decentralized and distributed, smart contracts are immutable. Once deployed, smart contracts cannot be modified - transactions are irreversible.
Based on these facts smart contracts permit transactions without any central authority or legal system. Ethereum is an example of a blockchain that supports smart contracts.
On-chain and off-chain data for smart contracts
In order for smart contracts to function they rely on the information on the blockchain or “on-chain” data. But what if a smart contract conditions rely on some data that is not available on the blockchain? This creates an “off-chain” data problem.
For example, we want to create a smart contract for logistics supply chain service. Our goods must be stored in temperature controlled environment where temperature must not exceed 10°C. If the temperature exceeds 10°C the carrier must pay a penalty for every minute when the temperature is higher than specified.
If we want to create an automated penalty system with a smart contract the rule could be as follows (on a high level):
“Check the temperature every minute and IF the temperature exceeds 10°C, THEN send $X from this address to that address.”
But here we face the problem of “off-chain” data. Temperature in this case is an off-chain information, that is not stored on the blockchain. Our smart contract is useless if we can’t acquire data about the temperature in the container.
In our next blog post we will explore how to approach this problem and how Paralink is developing solutions to bridge the gap between on-chain and off-chain data.
Smart contracts are very different from traditional contracts. Although we call them smart, smart contracts are very simple pieces of software where “IF-THEN” logic is applied in a programmable way. Many industries will get transformed with smart contracts as the world is becoming more and more decentralized. Smart contracts are currently deployed mostly in decentralized finance applications but we believe they hold a potential to disrupt how people exchange value in the digital realm.