Publisher avatar
LearnCrypto
10 min read

A guide to hybrid smart contracts

A guide to hybrid smart contracts

What is a hybrid smart contract?

It has been a while since the general public started to accept smart contract technology to deal with the flaws of the centralised contract system. Blockchain smart contracts have replaced trust among contractual parties with code-based trust within the business and legal ecosystem. In contrast, collaboration over centralised contract systems happened through brand-based trust which lacked transparency.

If you are new to the crypto scene, we suggest learning about traditional smart contracts' technology by reading this article: 'What Are Smart Contracts?'.

Whether we are talking about provisions, contract execution, dispute resolution or custody mechanisms, everything about a smart contract is based on blockchain technology. It runs on a decentralised network and encompasses important features such as immutability and transparency. 

Several authors use the term Ricardian contract instead of hybrid smart contract stating that such agreements consist of two parts that are cryptographically bound.

A hybrid smart contract refers to an enhanced version of smart contract technology that combines on-chain infrastructure with off-chain computation and data provided by decentralised oracle networks (DONs).  

In other words, hybrid smart contracts enjoy the immutable and secure features of blockchain technology while leveraging off-chain oracle services to obtain novel capabilities. Thereby, a hybrid smart contract possesses all the perks of a blockchain combined with the services provided by a decentralised Oracle network.

In this article, we are going to define the meaning, composition, and role of hybrid smart contracts assumed within multiple industries.  

Why do we need hybrid smart contracts?

With hybrid smart contracts defined, let's answer the question of their importance and need. Centralised contract systems prevalent within the contemporary business sphere are considered asymmetric since one party typically enjoys an unfair influence over the whole process.

One party to the contract always seems to be more powerful due to having more resources, time, funds, and knowledge of the contract enforcement infrastructure. Smart contracts replaced brand-based trust with maths-based trust to provide a more transparent and fair environment for contractual parties.

loading...

However, blockchain smart contracts running in a decentralised ecosystem are not without flaws; these bugs made industry experts realise that we need hybrid versions with extended capabilities.

Problems with smart contract technology

Regular smart contracts have been accepted even beyond the crypto community as immutable, transparent, and verifiable contracts that ensure a substantial level of efficiency and fairness. A smart contract can be automatically executed whenever specific conditions are met since it has been deployed on a blockchain and is integrated into its code.

Such prerequisites, which are typically predefined in the smart contract code, may include pieces of information such as date or time, the transfer of a certain amount of funds, or the accomplishment of a particular task.

However, there is a particular glitch that limits their functionality – the data that defines the conditions of traditional smart contracts typically stems from the blockchain only.  

In simple terms, a smart contract can only read data that exists in an on-chain programming language. The inability to read off-chain data restricts the smart contract’s functionality when it comes to real-world use cases based on external data.  Such a flaw enhanced the hybrid smart contract development.

The introduction of decentralised oracle networks within the hybrid smart contract architecture resolved that issue. As a middleware, oracles can translate off-chain data to on-chain data which results in making the real-world data sources and structures functional for blockchain smart contracts.

How do oracles help blockchain-based collaborations?

Blockchain technology can be defined as a computing infrastructure designed to provide one vital function – transparent, secure, and trustworthy collaboration. On the other hand, contracts have always been a way to establish trust in a collaborative process by defining the main rights and contract obligations of each party.  

By replacing brand-based trust with trust based on code, blockchains assumed the role of highly trustworthy systems. While the narrow spectrum and isolation create a tamper-proof zone, it became obvious that real-world use cases require external data and off-chain computation.  

The aim to expand the types of collaborative processes possible on blockchains led to the emergence of oracles and subsequently to the idea of building hybrid smart contracts. 

Decentralised oracle networks (DONs) provide blockchains with safe gateways to the outside world and enrich smart contract applications with the possibility to verify external events and leverage computations that weren’t practical to do on-chain. By utilising oracles, the isolated off-chain environment became accessible to blockchain smart contracts.

Without oracles, a big growth like we have seen within the DeFi environment wouldn't be possible. To find out more about oracles, why not read this article: 'What is an Oracle in Blockchain?'.

The composition of hybrid smart contracts

A hybrid smart contract refers to an application that consists of two main components – a smart contract and a decentralised oracle network (DON). As explained above, a smart contract presents code that runs on the blockchain while DONs secure off-chain services. 

Even though these two are different computing environments, combining them creates an enhanced application that couldn’t be achieved alone. Each of these environments is good at providing traits that the other cannot provide. 

On-chain code is accommodated within a very secure and immutable environment while decentralised services provided by DONs run off-chain and bring to the table more flexibility and functionality.

Are there any drawbacks?

While hybrid smart contracts provide a range of advantages for many industries, they bring to the table several trade-offs. The primary criticism is aimed at a limited level of decentralisation. Even though oracles provide decentralised services, a part of the crypto community thinks that the dependence on off-chain components might compromise the main principles of blockchain technology. 

Secondly, compared to their regular counterparts, hybrid smart contracts are more challenging to create and maintain. Their higher complexity might not be user-friendly. 

Their higher complexity also means that they might experience interoperability issues across different blockchain networks or off-chain platforms, along with security risks associated with both on-chain and off-chain execution.

How do hybrid smart contracts work?

To simply explain hybrid smart contract applications, we are going to break their operations into components. Within a hybrid smart contract application, whenever the blockchain network requires off-chain data, it sets out a request for data to a protocol.  

The protocol creates a type of smart contract called a Service Level Agreement on the blockchain. The logic of that smart contract is determined by the on-chain code. It is stored on the blockchain network.  

As explained above in the text, the off-chain computation and data are provided by a decentralised oracle network. A DON refers to a network of independent nodes that collect and verify data from external sources. 

The blockchain sends an Oracle request to the DON as well as specifies the data that the smart contract needs. The DON then selects a group of oracles to fulfil the Oracle request. Once the nodes collect and verify the data, they return the results to the smart contract. This process is known as the Oracle response. 

Once the smart contract gets the response, it self-executes based on the received off-chain computation or data.  

Main components of the Service Level Agreement

The Service Level Agreement typically consists of three components or sub-contracts – the reputation contract, the order-matching contract, and the aggregating contract.  

Each of these sub-contracts has its objectives and tasks. The reputation contract is responsible for auditing the track reward of an Oracle node by checking its performance history and authenticity. If a node turns out to be unreliable, the reputation contract discards it.  

The subsequent order-matching contract passes the on-chain data request to the verified nodes as well as approves the types and number of Oracle nodes to meet the request.  

Finally, the aggregating contract provides the Oracle request to the nodes of the DON. This request exists in an on-chain programming language.

Key roles of on-chain and off-chain computation

You probably wonder how hybrid smart contracts combine on-chain and off-chain calculations. To understand the differences between on-chain and off-chain components, it is important to assess their specific roles and duties.  

Blockchain presents the on-chain component. As a perpetual distributed ledger it enables custody of assets and interacts with private keys. Furthermore, it performs final settlement by taking care of transactions that exchange value among users as well as provides dispute resolution and secures the DON’s functionality. 

The off-chain component refers to the DON. It is tasked with collecting, securing, and transferring data from external sources to the blockchain. The off-chain part relays the outputs of smart contract code to external systems. 

DONs use privacy-preserving oracle computing that implements zero-knowledge proofs, certain DON committees and trusted hardware to make sensitive data accessible to hybrid smart contracts.

Extended abilities of a hybrid smart contract

Now that we have defined hybrid smart contracts and explained how they work, let’s dive into their extended abilities. A hybrid smart contract enjoys all the features of a blockchain enhanced by decentralised services provided by Oracle networks.  

Off-chain computations enhanced smart contracts by bringing new applications to the table. For example, hybrid smart contracts encompass the Off-Chain Reporting (OCR) feature which refers to the scalable aggregations of responses produced by Oracle nodes.

Instead of laying down multiple transactions on the blockchain, OCR consolidates all the necessary pieces of information and implements it in a single transaction. Therefore, it serves mainly as a cost-saving feature. 

Hybrid smart contracts are associated with keeper networks which can be described as automated assistants designed for the digital environment. The primary function of a keeper network is to audit and manage routine processes that ensure the functioning of hybrid smart contracts. Their main feature is the possibility to operate without any disruptions for end-users. 

Scalable computation is an efficient trait that produces a high throughput and minimises execution costs. Smart contracts synchronise periodically on the blockchain by utilising Layer 2 scaling solutions.  

Additionally, hybrid smart contracts utilise the Verifiable Randomness Function (VRF) that produces cryptographic and verifiable random numbers that add up to the integrity of the whole process. On the other hand, Fair Sequencing Services (FSS) allow decentralised transaction ordering due to a preset idea of fairness.

How can hybrid smart contract technology help businesses?

The main perk of hybrid smart contracts is to increase the automation of legal agreements and make it easier for businesses to execute them. Simply put, hybrid smart contracts are useful because they can save time and money. 

Another benefit of hybrid smart contracts is their increased security and transparency. An immutable record of each transaction provided on the blockchain makes it very difficult for fraud to take place. 

By utilising on-chain and off-chain computation, a hybrid smart contract can carry out complex activities with minimised costs and increased overall efficiency. The ability to implement more complicated activities means that hybrid smart contracts can open up new business models and revenue streams as well.

Which industries could be impacted by hybrid smart contracts?

There are several industries where hybrid smart contracts could be implemented successfully. The first one relates to identity management- by utilising hybrid smart contract technology, identity data can be monitored and verified in an automated and safe manner. Hybrid smart contracts perform computations that can verify an end-user's data without exposing it publicly. 

Secondly, hybrid smart contracts could be used as a powerful tool within financial markets by defining rules of engagement for buyers and sellers as well as perform computations for features such as transaction concealment, fair transaction ordering and KYC verification. 

It is already known that blockchain technology has the potential to enhance supply chains within many industries. Hybrid smart contracts bring to the supply chain management sector multi-party agreements that operate on a shared distributed ledger and automate activities across divergent systems using verified data.  

Blockchain-based smart contracts communicate various obligations, payment terms, and contractual penalties, while DONs can track shipments, monitor quality control, verify identities, and trigger payment combining external data feeds from various sources and privacy-preserving computations. 

Hybrid smart contracts can be useful for the gaming industry as well. The smart contract component can outline gameplay and reward distribution systems, while DONs can add up to the randomness and fairness. Additionally, decentralised applications could use DONs to link external data feeds to process particular functions off-chain and implement new functionalities. 

Finally, the new smart contract technology could improve governance processes within the digital realm. The smart contract component can outline the governance structure, while DONs have the potential to provide off-chain data and computations to deal with profit sharing, identity verification to reduce Sybil attacks or automate decision-making procedures. 

How are hybrid smart contracts affecting the blockchain industry?

The use of hybrid smart contracts has opened new possibilities for DeFi developers, enabling them to focus on setting out projects and plugging into an existing DON for key data instead of creating a separate infrastructure to source data for their smart contracts.  

loading...

These improved smart contracts help DeFi in achieving its main objectives; DeFi applications are usually based on activities such as trading, borrowing, lending, and creating assets. With the new technology, they can depend on DONs to validate, verify, and deliver the required off-chain data.  

DeFi isn’t the only domain that benefits from hybrid smart contracts. For example, hybrid smart contract development could successfully support and streamline the process of creating Dynamic NFTs. Combining Oracle networks with smart contracts can help NFTs to be dynamic and to automatically change when something happens in the real world. 

The hybrid model has been utilised to develop all sorts of interesting applications aiming at improving user experience. The ability of DONs to perform complex computations will enable smart contracts to perform more tasks and provide more efficient processes across the blockchain environment.