Last updated on July 11th, 2023 at 11:00 pm
The blockchain world, especially the decentralized financial realm, needs data to operate effectively, and that is why Chainlink was created. Chainlink is a decentralized oracle protocol that offers real-world data to smart contracts on the blockchain. Many DeFi ecosystems depend on the oracle network that Chainlink offers to function in real-time.
What Are Smart Contracts?
Before Chainlink’s features can be discussed at length, it is important to analyze some crucial aspects that are connected with the ecosystem.
Smart contracts, on the other hand, are agreements with specific terms that are automatically executed once specified terms are achieved. Chainlink’s utility token is the LINK token, and it is utilized in the payments of services enjoyed within the ecosystem.
A good use case of smart contracts is crowdfunding. Let’s say, a certain amount of crypto is placed in a smart contract, and terms surrounding the conditions and the period that must be met before it is released to the fundraiser are added to the contract. If the terms are met, the crowdfunded crypto is sent to the recipient, and in cases where the conditions are not met, the donors are given back their crypto donations.
Smart contracts are changing the way things are done by incorporating trust amongst different participants because they are sure that the contract will only be executed once the terms are met. These contracts are verifiable, meaning that they can be accessed by anyone. They are also immutable, which means they can’t be changed once set. The use cases surrounding this piece of technology are numerous.
How Smart Contracts Are Linked To ChainLink
Before smart contracts can create agreements, they need access to both on-chain and off-chain data sources. It is not easy linking blockchain smart contracts with outside data sources because of the language limitation. How then can smart contracts access the needed data? Oracles fly to the rescue, solving this issue because it acts as a middleman between the outside data sources and the blockchain. It is also called a middleware that translates the data from off-chain sources to a language that smart contracts can understand and vice versa.
If a centralized oracle is used, there is the issue of centralization creeping into the blockchain technology, which is contrary to what the latter technology means. It will usher in the risk of a central point of weakness, thereby compromising the decentralization feature of oracles. Once an oracle is not accurate, the data will not be accurate, which means the smart contract will not be accurate.
To solve this issue, there is the need for a decentralized network of nodes that feed smart contracts data. Chainlink offers this important infrastructure, as it offers information through its decentralized oracles to smart contracts. It acts as a link between off-blockchain sources and on-blockchain smart contracts. Incorporating this feature has removed the risks of a single point of failure, reliability problems while adding an extra layer of security.
How Chainlink Works
Usually, when a smart contract needs data, it sends a request for the data through the Requesting Contract.
In Chainlink, the request is registered as an event, while a smart contract is created for the request. It is called a Chainlink Service Level Agreement (SLA) Contract. The Chainlink SLA Contract creates three sub-contracts, which are a Chainlink Reputation Contract, a Chainlink Order-Matching Contract, and a Chainlink Aggregating Contract.
The job of the Chainlink Reputation Contract is to verify the record and performance of an oracle provider when it comes to offering reliable data. After the evaluation, and it finds out a node is not reliable, it removes it. This is to ensure that the standard of the data transmitted is not compromised.
The Chainlink Order-Matching Contract, on the other hand, is in charge of delivering the Requesting Contract’s request to Chainlink nodes. It handles the bids that have been placed on the request before it chooses the number and kinds of nodes that will be chosen to carry out the request.
As for the Chainlink Aggregating Contract, it is given the data from the chosen oracles, to verify them, and ensure that they are accurate information.
The nodes in the ecosystem translate the request for data raised by the Requesting Contract, then convert the request from the on-blockchain programming language to a language that off-chain data sources can understand. Once it is translated, it is sent to an off-chain API, which accesses the data needed. Immediately this is done, the collected data is translated to an on-chain language via the Chainlink Core before it is sent to the Chainlink Aggregating Contract.
Chainlink Aggregating Contract verifies data from either a single source or from several sources, then reconciles them using different sources.
When data is collected, and it notices that five nodes bring an answer regarding a request, and one other node brings a different solution to the request, the Chainlink Aggregating Contract ignores the single node and terms it as faulty.
In Conclusion…
A blockchain is only as good as the accuracy of the information recorded on it, and if that information originates from an “off-chain” (i.e. real-world) source, then we still need trusted intermediaries. Oracles are critical to blockchain and smart contracts as they help to solve this so-called “last mile” problem. Here is where Chainlink adds real value by offering real-world data to smart contracts on a blockchain. It is no surprise therefore that many DeFi protocols rely on Chainlink’s oracle network to function in real-time.