Clarity Language x Chainlink Oracle

Clarity x Chainlink Oracle integration

For non-technical folks like myself, the term smart contracts, oracles, data feeds and how they come together are like foreign languages, yet these are critical components for the developer communities.

The recent news release from Blockstack(soon to be known as Hiro Systems), highlighted the integration of Chainlink Oracle Technology with Stacks 2.0. In an attempt to learn more about Stacks Protocol, I’ll deep dive into the technical details, digest the information and roam the web for non-technical explanations. The write up below will be my attempt to have a concise explanation and break down of the technical terms and also explore what it means for Stacks ecosystem to have Chainlink oracles onboard.

Clarity Smart contract

Smart contracts are codes built on the blockchain with pre-specified criteria and conditions that will be executed automatically upon having those criteria met. This allows for business logic to be encoded on the blockchain in an open, verifiable and secure way, with no need of a trusted 3rd party.  The main differences between smart contracts and traditional software programs are that smart contracts run on blockchain while software as we know them are built and stored on cloud infrastructure. Smart contracts allow software to run in a decentralized manner via the blockchain thus bringing the immutable element to software. This is especially essential as we read how big-tech are censoring certain information from their end-users and not everyone are given access to the same set of information.

Clarity is a new language for smart contracts. It is a decidable language, where you can know with certainty from the code itself what the program will do. This allows for complete static analysis of the entire call graph of a given smart contract. Clarity is interpreted (not compiled) with the source code published on the blockchain, thus minimizing the surface area for introducing bugs. Allowing developers a safe way to build complex smart contracts.

Chainlink Oracles

For smart contracts to form complex executable logic beyond data on the blockchain, they require off-chain data in an on-chain format. The difficulty in connecting outside information sources to blockchain smart contracts in a language that they both understand is one of the main limitations in how widely smart contracts can be used. This is due to large pieces of data were stored differently off chain, where in many real world circumstances data feeds are usually non-deterministic as compared to blockchain/smart contracts thus making off-chain data incompatible with on-chain data.

This is where Chainlink Oracle comes in, it acts as a “middleware” which translate off-chain data on-chain to ensure data are readable by smart contracts. When a smart contract puts out a request for data, this request is routed via Chainlink Service Level Agreement(SLA) Contract to off-chain data providers via APIs which collects the required data either from a single source or multiple sources. The data is then translated back into on-chain language through Chainlink Core and back to the smart contract. As Chainlink is a decentralized network, via SLA contract it can validate data from multiple sources and reconcile data from multiple sources. For example, if five nodes deliver one answer from a weather sensor and two other nodes deliver a different answer, the Chainlink Aggregating Contract will infer that those two nodes are faulty (or dishonest) and discard their answers. The Chainlink Aggregating Contract can repeat this validation process for multiple sources, then reconcile all validated data by averaging it into a single piece of data.

What this means?

After learning what Clarity smart contract does, and how Chainlink Oracle enables smart contracts to work with off-chain data, what are the takeaways from the Stacks x Chainlink technology integration for the Stacks ecosystem?

Stacks protocol bring apps and smart contracts to the Bitcoin Network, which in turn secures them via Bitcoin’s PoW mechanism. It opens up a wide range of new possibilities on the Bitcoin Network, as smart contracts allows for more complex applications to be built upon(such as DeFi on BTC) and potentially new use cases on the blockchain. With complex applications, reliable data feeds are essential for applications to function, and as more complex applications are being built they need data that are immune to manipulation as well. Therefore, with the Clarity x Chainlink Oracle integration, developers can now build with a smart contract language that is secure and predictable, while drawing on reliable and accurate data feeds from Chainlink to deliver software that presents a wide range of use cases to end-users.

 

You may also like