Learn the basics

What is a smart contract?

May 7, 2021

A smart contract is the codification of a contract on a blockchain. The concept of smart contract used to refer to a digital agreement that was tamper-proof and that could know things about the outside world.

It could get proof about events outside the blockchain, it could verify and determine that something happened (or didn’t) and it could conclude an outcome and release payments or do something else. 

However, this concept of smart contract was really hard to actually implement. Being tamper proof and at the same time knowing things about the world was anything but straightforward. A smart contract able to operate beyond the limits of blockchain didn’t seem actually doable, but why? To understand it, let’s describe the three basic elements involved in the equation: 

  • The contract itself (the code in the blockchain). 
  • The proof that an event occurred (requiring verified information coming from outside the blockchain).
  • The release of value according to the contract (for example an interest payment or an asset ownership transfer).

The on-chain part of the equation is the contract itself. It lays out the conditions under which let’s say an insurance payment is made, or the full amount of an agreement is paid. The contract is very good at creating transparency about what the conditions of the contract are, at taking in value from on chain private keys, and at distributing back value to other private keys. 

The off-chain part starts when the contract interacts with the outside world, but outside of the blockchain things are not so verifiably tamper-proof and certain. The challenge is that if a blockchain connects to an API (a wide spread software device through which companies connect to each other) in order to gather information required to fulfill a contract, there’s no longer the assurance that the data hasn’t been tampered with or even that the data is actually true.

Lastly, the release of value may take place on-chain or off-chain. This means that blockchains will require to be directly connected with financial institutions, payment processors, and many other types of companies and institutions. 

Because the one thing developers can easily control is the coded contract, what a smart contract has come to mean is “on-chain code”: The codification of a contract on the blockchain. This eliminates the part about knowing things about the world and partially eliminates the release of value through payments or another action. It’s just on-chain code.

However, if smart contracts can interact with the outside world, then the potential for change and automation is gigantic. If actors in an economic space agree on which are the legitimate sources of data relevant to their economic activity, and if they agree on the rules that determine when the data from those sources represents truth, then they can agree on smart contracts that interact with those sources of information and determine whether an event relevant to the agreement has happened or not, and then trigger a resulting action, often times a payout or some other form of value.

Hybrid smart contracts

In order to go back to this broader definition of smart contracts, the community is developing the cryptographic tools for smart contracts to interact with the outside world, only now they are called hybrid smart contracts, meaning contracts that are both on-chain and off-chain. Hybrid contracts communicate with the outside world through decentralized networks known as oracle mechanisms or oracle decentralized networks.

This is a different type of decentralized system with a different objective than that of blockchains. A blockchain generates security and assurance in transactions recorded in blocks. Data in this environment is tamper-proof precisely because it’s limited to tokens and private keys. 

In contrast, what an oracle network does is achieve consensus and decentralization about events taking place in the real world. It is distributed across many nodes, like a blockchain, but it takes API data from different sources and provides definitive computational proof of the events it monitors through APIs. 

After determining an event takes place, the oracle network sends this information to the on-chain code. An agreement cannot take place between two parties that don’t agree on what is true, and the role of Oracles is letting smart contracts know the information they need to know when an event takes place and trigger whatever action is required.

Entra en la nueva economía tokenizada

Enter the new tokenized economy

Token City is the ultimate bridge to the tokenized economy (tEconomy), in which tokenized companies (tEnterprises) create their cryptoasset markets (tMarkets), open to global investors (tCitizens).

Related news