Smart Contracts

A smart contract application is any decentralized service that acts as a mechanism to execute an agreement on a blockchain. They function as a basic “if x happens then y executes” type of program. They cannot be changed once they are implemented on the blockchain. This extends the functionality of blockchains from only being able to execute transactions to becoming a transaction system for smart contracts. Smart contracts are verifiable pieces of code that compose an agreement between parties involved. When an outcome is given to a smart contract the codified set of agreements is released while holding everyone accountable for the end result. This means that financial applications don’t carry counterparty risks. Blockchains and smart contracts are transparent and solve the back-end problems of the traditional financial sector by being verifiable. For obvious reasons, data is key to executing smart contracts. If the data is incorrect then smart contracts do not execute correctly no matter the amount of cryptographic or economic hardness. Users thus have full control when creating this immutable censorship resistant contract that guarantees an outcome without the need for middlemen.

Smart contracts can be made on most blockchains. Depending on how the blockchain is created different smart contracts can be implemented. Bitcoin is not Turing-complete and because it does not understand its previous states it cannot host many different types of smart contracts. Ethereum and other L1s on the other hand, are, which provides more flexibility as you can look in the past or have a contract executed at later dates.

In the past when smart contracts first started, they were first viewed as tamper-proof digital agreements that could know things about the world, release payments about the data, and conclude outcomes. This has three distinct parts: the smart contract itself, proof of something happening, and finally a release of value mechanism. Due to the complexity of the original definition, smart contracts are now viewed as on-chain code. That is, the codification of contractual agreements on a blockchain. It does not know things about the world, does not release value. The last two parts of the original definition have not fully been implemented yet. Chainlink 2.0 is currently increasing the implementation of hybrid smart contracts. This will move the Chainlink off-chain smart contract infrastructure back to the initial definition and codify the three distinct parts. The contract will know what happened and resolve a conclusion. This will mean greater security and scalability.

Types of Data and Decentralized Oracles Networks

A blockchain is a decentralized computer network that seeks to disintermediate transactions. Data that exists on a blockchain is called on-chain data. Blockchains are highly trustworthy due to the ability to verify what happened, their cryptographic hardness, their external disconnection from other processes, but offer limited functionality. Blockchains are isolated networks that cannot connect to the outside world on their own. They need a mechanism that feeds real-world data (off-chain) to them that is as trustworthy as the blockchain data (on-chain) itself, thus the need for oracles and smart contracts that can perform this task.

Off-chain data is information that is not run on a blockchain and comprises real-world events. Chainlink’s decentralized oracle network (DON) is a single interface to connect to any blockchain network. Their role is to aggregate external data resources and notify what happened to the blockchain. They function as doors to provide on-chain data real world outcomes to execute smart contract and smart contract applications. They provide what blockchains cannot to reduce costs in smart contract execution; increase scalability for smart contract applications; improve privacy and immutability for the smart contract; improve data storage to interact with smart contracts when information is needed to be retrieved; and many others. In sum, DONs are a network that feed information or help execute smart contracts which function as a backend to update blockchain states to distribute off-chain information to on-chain blocks. The information can execute a smart contract or be used as a data point for a smart contract execution among other tasks.

Oracles function as an in-between from the world of blockchains, centralized web servers, and the real world to contribute to off-chain data computation and provide information to blockchains to execute smart contracts. The goal is to minimize the amount of trust required, connect the external world with the internal blockchain world, and provide highly scalable solutions. The main importance of smart contracts is that they allow for autonomous control without ownership being locked in/held up and controlled by centralized businesses, thus enabling transactions and computation in a decentralized and permissionless manner. This means that the features are active and usable to others without centralized ownership of data and value controlled by third parties and/or intermediaries.

Chainlink’s DONs expand services for off-chain hybrid smart contracts. The more services that are created on-chain, the more types of smart contracts are needed, and the more use cases are developed. In the recent years we have seen oracle networks function as the back-end for defi and smart contract networks by providing real world off-chain data to on-chain blockchains. By using Chainlink oracles, negative outcomes are softened to better manage risks when using smart contracts that handle off-chain data from the real world in a decentralized way. It does this while providing initiatives and incentives that the data is real and correct and adjudicating disputes about said data by finding multiple sources.

A Few Examples of Smart Contract Applications and on-chain/off-chain roles:

   Proof of reserve. These are smart contracts and data feeds that verify whether or not an asset is being held or not (ex: fiat reserves in a bank account that collateralize the stablecoins, or our own Stellar-Polygon bridge). DONs (or a committee/network of DONs) prove that collateral exists and hold the asset locked in a contract, blockchains transition their state when smart contracts are executed and the value is transferred as needed. Multiple inputs and variables could prove a large collection of different information from multiple data sets.

   A decentralized identity could verify and prove credit scores managed by DON.

   In case of drought farms sell their crops in advance and then payouts will be made to keep farms running next year. This is known as crop insurance. Blockchains would be used as the method of transaction and smart contracts would handle the data (percentage chance of crops failing, price feeds, weather reports, climate based on long-term historical data etc.).

   Paying mortgages using smart contracts and having the deed to your house in the form of an NFT.

   Adjudication of disputes.

   Proof of policy (if a politician promises X in their campaign, they can make a smart contract that guarantees that the promise will be made and keeps track of it).

   Verification that the economic system is not over-leveraged and what is going on in the derivatives market in real time (most of that type of economic structure remains hidden).

   Much much more that has been conceptualized and a lot of possibilities that haven’t been implemented.

As smart contract networks hold more data and become more complex, more things could be conceptualized and implemented. More data, more smart contract layers, more complex contracts could be created.


One of the problems of such a structure lies in the ability to read smart contracts and understand what they do when entering them. Too much data or not having the knowledge to fully comprehend what the smart contract does are both problems and have a high learning curve. Blockchain, cryptocurrencies, and smart contracts are transparent, permissionless, and decentralized but only if a person has the knowledge, time, and energy to be able to understand what is happening on-chain. This takes time. As people understand more about the tools, how to use them, and applications are made that make smart contracts easier to make by the general public, this learning curve should diminish over time.

Many people stand to gain from smart contracts and DONs. As the backbone of DeFi, they hold many qualities that would improve on the current financial structure we have today. The emerging markets arguably have the most to gain from integrating with decentralized finance, and smart contracts in general. This is because the level of financialization that we see in OCED, G20, or “first world” nations is not found everywhere. The emerging markets can thus leapfrog over insurance companies, governments, IMF sanctions, and other issues by making the transition to tamper proof smart contracts with guaranteed outcomes while removing much of the bureaucracy and infrastructure requirements.

Appendix: Economic and Cryptographic Hardness

Economic hardness refers to a system that cannot be manipulated maliciously or bribed because it would be too expensive to carry out for the reward given from the attack. Many attacks on the blockchain exist whereby a DON or a smart contract is bribed to execute or not which could lead to an economic gain for the attacker. Making smart contracts using DONs and smart contract services using multiple data feeds, such an attack is far less feasible to carry out.

Cryptographically hard means that the system is encrypted to the extent that it is near unhackable. Generally, a system is assumed to be cryptographically hard if any possible attack is impractical to the point of impossibility. A popular type of hacking, brute-force attacks, essentially targets a system by spamming out random numbers/information to "break" the encryption and figure out the logic behind it to access the desired information. SHA256 (used by Bitcoin, password managers, etc.) is an encryption algorithm that hashes information to scramble the data in such a way that it would be nearly impossible to break except by guessing the input through nothing but chance (which would take a computer millions of years to accomplish). The more complicated the system, the longer the time needed to crack it as more data is scrambled into the hash function. Likewise, the more the system is broken up into chunks the harder it is to crack because there are more hash functions that need to be decrypted to know the full value of the system.