Hybrid smart contract and the role of the Oracles
18 August 2022next article
As you know, smart contracts work in the blockchain system, where all calculations, repetitions and actions take place. All this is done automatically according to a predetermined script from the creators of the smart deal. But in many cases, the smart contract needs to receive certain information that serves as a trigger for the execution of the algorithm. For example, to find out the current exchange rate of the desired cryptocurrency against the USD. In this case, the smart contract must go somewhere outside the blockchain to find out what is necessary and, depending on the result, continue its execution. Such providers of information are oracles.
What is a hybrid smart contract?
A smart contract that combines calculations in the blockchain system (on-chain) with any calculations outside its boundaries (off-chain) is called hybrid. The created application combines completely different types and methods of computing and allows them to interact with each other freely, confidentially and safely. In this way, the smart contract receives an infinite number of additional features that simply cannot be provided by the blockchain alone. Each hybrid contract consists of two parts:
Code that works exclusively in the blockchain;
Decentralized network of data providers outside the blockchain.
We know that decentralization is one of the main goals of blockchain technology in general. That is why, in the off-chain issue, it is important that the information does not come from a single source, since in this case there is a high probability of manipulation by interested parties. Thus, there are various services that offer entire networks of independent sources, called Decentralized Oracle Networks — DONs
The importance of Oracles
DONs consist of a large number of information providers called Oracles. It is important to understand that the oracle is not a source of information: it does not create key data, but only finds it, checks it and transfers it to the smart contract. Since the network consists of a large number of different Oracles, the data can vary significantly. For example, if you need to get the same cryptocurrency exchange rate against the US dollar again, then oracles collect information from all world exchanges and reconcile the obtained results. As a result, there is a consensus of Oracles, where those data that objectively correspond to the request of the smart contract are considered reliable. It won't just be the arithmetic average of all courses — the result will be the one with the most validated cryptographic TLSNotary proofs.
The creators of oracles are interested in increasing the authority of their services, so they always strive for decentralization and objectivity. Thus, more advanced algorithms for information selection and analysis are constantly emerging. Therefore, if your smart contract needs confirmation from the outside world, you can not doubt their authenticity.
What is most often transferred to the blockchain?
DONs are capable of transmitting various types of external data. Depending on the need, a hybrid smart contract can use individual pieces of information for its own purposes. Some of the primary data types include:
Price Feeds — data on asset prices from hundreds of exchanges, cleaned of fictitious trades and rejected by the system;
Proof of Reserve — up-to-date data on current reserve balances of various cryptocurrencies;
Any API — data from various available APIs: from weather forecasts and results of sports matches, to open sources of commercial or production information;
Blockchain Middleware is an abstraction layer for external systems that allows reading and writing smart contract data from any blockchain networks.
However, the modern offering from oracles is not limited to strict data. Some DONs specialize in predictions. Of course, you don't need to look into a glass ball for this: the system involves experts and offers to make predictions about some phenomenon in the future based on the analysis of today's data. The author of the closest result receives a reward. This stimulates the involved participants to carefully approach the task and use all possible potential. However, in this case, we are dealing more with guesses than with facts.
In this way, a hybrid smart contract allows you to fully use for your own benefit almost all available digital information on the planet. How to implement this in your own smart contract? This is already a matter of logic and creative thinking. In any case, Avivi specialists are able to implement in the code any of your wishes regarding the future smart deal.
One of the important directions of our company's work has always been the audit of various IT projects. In most cases, it helped our clients to find weak points, reduce costs or optimize their business. But the audit of smart contracts is qualitatively different from everything else, and in this article we tell you why. And why is it so important?
The popularity of NFTs is attracting the attention of more and more people. Of course, everyone wants to make money by selling collections, even when they don't understand how everything works there. In this article, we highlight the importance of a smart contract in promoting a truly successful NFT project.
Throughout its history, Python has never lost its relevance, and the demand for developers is always high. We at Avivi have many years of programming experience in this language in individual projects. But over time, we faced a paradox: despite the constant rapid development of other technologies, the need for Python grows proportionally! What is the reason for the popularity and perspective of this language? We found out in this article.
We will reach out to within 10 minutes