A Complete Guide to Understand Hybrid Smart Contracts
When you read the word Hybrid Smart Contract, what idea does it give you? You may assume that the part ‘Hybrid’ refers to a combination of two things, and the part ‘smart contract’ indicates its similarity with blockchain smart contracts. Both the assumptions are true. Hybrid smart contracts are technically blockchain contracts only, but unlike traditional smart contracts, it is powered by two decentralized networks- one is Blockchain, and the other is Decentralized Oracle Network (DON). That is why it is referred to as Hybrid Smart Contract.
We already know that a smart contract uses Oracle as a gateway to connect with the data sources of the outside world. That way, it can leverage off-chain computations that are otherwise not possible to do on-chain. A hybrid smart contract also connects Blockchain (on-chain) code with off-chain data and Computation, but it is a level-up of Oracle. It uses a decentralized oracle network(DON), which enables it to craft agreements using off-chain data yet retain the tamper-proof and immutable properties of a blockchain.
This insight unfolds more information about DON, as it documents a detailed and comprehensive analysis of hybrid smart contracts. It covers the following sections:
- Why are hybrid smart contracts needed?
- What is the composition of hybrid smart contracts?
- Distinct roles of on-chain and off-chain Computation in hybrid smart contract
- What are the extended capacities of hybrid smart contracts?
- Smart contract development services by LeewayHertz
1. Why are hybrid smart contracts needed?
It has been a while that the world has known and used Blockchain smart contracts to overcome the imperfection of the centralized contract systems prevalent in the business and legal ecosystem. Centralized contract systems are asymmetric because one of the involved parties always enjoys an unfair influence over the arbitration process. One party always has more money, time and a clear understanding of the contract enforcement infrastructure. Within the framework of such a centralized contract system, parties determine the trustworthiness of the counterparty based on its brand value. Thus, collaboration over centralized contract systems happened through brand-based trust, which lacks transparency and immutability.
Blockchain smart contracts have replaced brand-based trust with math-based trust. Be it hosting, execution, enforcement, or custody mechanisms, everything about smart contracts is blockchain-based. Thus, it purely runs on a decentralized network that any individual participant or agency can’t undermine. Yet, there is a glitch in smart contracts.
1.1 The glitch in smart contracts
Smart contracts are acknowledged as the most robust, immutable and verifiable contracts that automatically maintain the transparency, fairness and efficiency of contract obligations by executing an IF/THEN framework when conditions are met. However, there is a very peculiar glitch that limits down the functionality of smart contracts.
The data that defines the conditions of a smart contract traditionally comes from the Blockchain only. This means a smart contract can only read the data that exists in an on-chain programming language. Inability to read off-chain programing language restricts smart contract’s connectivity to real-world data sources. The introduction of Oracles into the crypto ecosystem resolved the problem. Oracle as a middleware (software) could translate the off-chain to on-chain data, thus making the real-world data systems and sources functional for the blockchain smart contracts. But, oracle is a centralized entity, so its data can be compromised. This puts up a concerning question-what is the benefit of having a smart contract on a decentralized blockchain if it is sourcing its data from a centralized oracle that can be made faulty?
Won’t that make the immutability and trustworthiness of a smart contract doubtful and questionable? This is the point when the need for hybrid smart contracts is realized. Chainlink is a platform to build hybrid smart contracts.
1.2 What solution does the Chainlink hybrid smart contract provide?
A Hybrid Smart contract is an ideal solution to address the reliability issues that might occur in using a single centralized oracle only. The hybrid smart contract maintains the essence of decentralization. It connects the Blockchain network of the smart contract not to a centralized oracle but to a Decentralized Oracle Network (DON). Blockchain and DON are two distinctly different computing environments, and both specialize in features that others do not. A hybrid Smart contract synchronizes them to build a sophisticated application capable of something that Blockchain and oracle couldn’t achieve alone
2. What is the composition of a hybrid smart contract?
A hybrid smart contract is an application made of two key components:
1) Smart contract— A code that runs exclusively on the Blockchain
2) Decentralized oracle network— A distributed network of oracle nodes that provide information from off-blockchain data sources to on-blockchain smart contracts.
Here is how a Chainlink hybrid smart contract works:
In a hybrid smart contract application, whenever the Blockchain requires off-chain data, it puts out a request for data/information to the Chainlink protocol. The Chainlink protocol creates a corresponding smart contract called Chainlink Service Level Agreement (SLA) contract on the Blockchain itself. The SLA contract further generates three sub-contracts:
- The Chainlink Reputation Contract: It is responsible for checking the track record of an oracle node by verifying its authenticity and performance history. Basis its evaluation, it discards unreliable or disreputable oracle nodes.
- The Chainlink Order-Matching Contract: It passes the Blockchain’s data request to the verified oracle nodes and takes back their bids on the request. Then, it approves the right number and type of nodes to meet the data request.
- The Chainlink Aggregating Contract: The Aggregating contract provides the data request to the oracle nodes of the DON, but this request exists in an on-chain programming language. So, the Chainlink nodes use a software called “Chainlink Core” to translate that on-chain language to an off-chain programming language, making it readable to real-world data sources. This translated version of the request is then routed to an external API that collects the data from the real-world source. After fetching the data from the API, Chainlink Core again translates the data back to on-chain language and sends it back to the Aggregating contract.
Here, things get interesting! The aggregating contract passes the data request to multiple nodes in the DON, so it receives back data from multiple nodes. This sourcing of data from decentralized multiple nodes improves data credibility. For instance, when the Aggregating contract receives data from 5 different nodes, and three of them deliver one answer, and two of them deliver a different answer, it gets easy to determine that the two nodes are faulty.
In this manner, the Chainlink Aggregating Contract validates the credibility of the received data, then reconciles the information to generate an accurate result. All the security approaches practiced by a DON happens in an isolated off-chain environment. But it instruments various other extra secure mechanisms and hardware to match the high level of reliability and tamper-resistant guarantees provided by the blockchain smart contract.
3. Distinct roles of on-chain and off-chain Computation in hybrid smart contracts
To further understand the architecture of a hybrid smart contract, let’s understand the distinct roles of each of its components, i.e., on-chain blockchain computation and off-chain Computation performed by a DON.
- It maintains a persistent ledger recording authoritative custody of users’ assets. It also interacts with private keys
- It processes irreversible transactions transferring value between users and executes the final settlement
- It secures the proper functioning of the DON’s off-chain services by providing dispute resolution and guardrails
Off-Chain: Decentralized Oracle Network
- It fetches data from external APIs, then validates, secures, and delivers to smart contracts running on blockchains
- It performs different types of computations for blockchain smart contracts running and Layer-2 solutions
4. What are the extended capabilities of hybrid smart contracts?
With hybrid smart contracts defined, let’s explore their extended capacities. A hybrid smart contract possesses all the virtues of a blockchain, and on top of that, it is powered by the decentralized services offered by a DON. Some of the current and upcoming extended capacities of hybrid smart contracts made possible through off-chain computations are:
- Keeper networks: these are the automation bots responsible for performing regular maintenance tasks for the smart contract.
- Off-Chain Reporting (OCR): It refers to the scalable aggregations of the responses provided by oracle nodes in a DON. These responses are delivered on-chain through a single transaction that reduces on-chain costs.
- Scalable Computation renders high-throughput and reduces the cost of execution for the contracts. These contracts sync on-chain periodically using layer-2 technology.
- Verifiable Randomness Function (VRF) generates cryptographic, secure and verifiable random numbers that prove the process’s integrity.
- DON uses privacy-preserving oracle computation that uses zero-knowledge proofs (DECO), trusted hardware (Town Crier) and selected DON committees to make sensitive data confidentially available to smart contracts.
- Fair Sequencing Services (FSS) facilitates decentralized transaction ordering based on a predefined notion of fairness. This prevents frontrunning and miner extractable value (MEV).
5. Smart contract development services by LeewayHertz
As a blockchain development firm, we at LeewayHertz, build innovative solutions for businesses to help them leverage the real-world application of blockchain technology. We build hybrid smart contracts with Chainlink and also take up smart contract development for Ethereum, EOS, Hyperledger Fabric/Sawtooth, etc. Our smart contract development services provide businesses with strong digital protocols to validate the conditions of their legal contracts with other parties. These solutions help businesses achieve their goals of security and transparency, while they also derive benefits like automation, backup, autonomy, cost-effectiveness and accuracy.
Our smart contract development services cover:
- Smart Contract Strategy: Architecture and design development
- Smart Contract Development: End-to-end development services with successful POCs
- Smart App Development: We develop smart contract apps for E-Warranty, Health Wallets, Digital Certificates, Asset Traceability, etc. APIs for DEx, DeFi, Payment Digital Contract, and more.
Hybrid smart contracts development services are highly valuable for domains like finance, personal identity, supply chain, insurance, gaming, marketing and Governance.
There are two ways to appreciate a hybrid smart contract. First of all, it improves Blockchain-based smart contracts connectivity to the off-chain data sources and makes them capable of novel use-cases that inherently Blockchain doesn’t support. Secondly, it even bootstraps the usefulness of real-world data systems by extending cryptographic security to them. As mentioned earlier, the involvement of centralized authority is a weakness in today’s contract systems. Such contract agreements are based on brand trust. But a hybrid smart contract is a logic-based trust as it facilitates collaboration over decentralized networks that are secure, scalable, confidential, universally connected and reliable. It is often said that the blockchain ecosystem has only scratched the surface of what’s to come, and its evolution will be majorly driven by the far-reaching applicability of hybrid smart contracts.
If you want to explore the prospect of hybrid smart contracts for building a collaboration system over decentralized networks that are secure, scalable, confidential, universally connected and reliable, then please contact our experts. We would be happy to partner with you.
Start a conversation by filling the form
All information will be kept confidential.