The future of Chainlink on Tezos

Mike Radin
The Cryptonomic Aperiodical
4 min readOct 8, 2020

Coupled with formal smart contract verification features of Tezos, Chainlink can fulfill its destiny: providing secure, decentralized applications integrating verifiable data from the real world.

Until the world is universally using blockchains as systems of record, there will always be a concern with the sourcing and quality of off-chain data. This includes anything from weather data, to package tracking and instrument pricing. This is less of an issue for blockchain-native instruments that can be observed directly, but if there was a need to price something based on a sovereign currency, as an example — that’ll need a data source and this data source will likely take the form of an oracle.

As a concept, an oracle is simply a source of data on a blockchain. It can be an instance maintained by a universally trusted party. For example, a crypto exchange may opt to publish pair prices on the chain at regular intervals. While this is fine, there is an expectation of, well, trustlessness in public blockchain applications. This is the problem Chainlink is solving today across a large swath of chains, including Tezos. Chainlink-based oracles will allow off-chain data to be made available to smart contracts, by using mechanisms with similar trustlessness guarantees the chain itself provides.

The recent Chainlink hackathon was the first time developers had a chance to interact with the preview implementation of the platform for Tezos. This has been a joint effort between Smart Chain Arena, Cryptonomic and of course, Chainlink. The project is sponsored by a generous grant from the Tezos Foundation.

We have previously published a full, functioning example implementation of the oracle. This reference has already been successfully used during the hackathon by several participants. Not everyone is interested in such a level of detail, so let’s cover the technical architecture of this system.

Oracle implementation hinges on the new FA2 token pattern. This aspect will allow seamless integration into the budding DeFi ecosystem on Tezos. Upcoming decentralized exchanges (DEXes) on Tezos support this token standard. Availability of Chainlink as an FA2 token will allow for immediate trading in multiple pairs. Oracle operators and clients will be able to bootstrap their participation in the platform by acquiring necessary Chainlink token balances directly on the Tezos chain instead of using an alternative chain. Chainlink tokens are the currency used to pay for data requests from these oracles. The SmartPy web IDE includes a sample oracle contract today. Even if related contracts, like the Chainlink token, change later, this oracle implementation provides a flexible interface covering a broad range of data distribution needs. It also broadly conforms to the pattern used by Chainlink oracle contracts on other chains. Finally from Cryptonomic, there is a turn-key sample tying these pieces together into a functioning demo of the consumer-provider relationship using Conseil, ConseilJS and Nautilus Cloud.

How do the parts join together? The oracle contract is somewhat of an order book if we were to use market terms. Clients submit requests for data, these requests include identifying information, a fee, and a timeout. That request info allows the oracle to process the request properly. At a minimum it contains a request type and job id but it can also contain an optional list of additional parameters if the oracle processor supports it. The fee is what the client is willing to pay for this data and it’s denominated in terms of Chainlink tokens. Note that there are 18 decimal places, so one whole token is 1,000,000,000,000,000,000. The timeout is the maximum amount of time the client is willing to wait. There is other information included in a request, like the contract callback that should be used to provide the data response. The oracle contract will keep this request in storage until it is serviced or canceled. This contract doesn’t need to be modified for different types of data. This flexibility comes from the fact that there is this optional parameter list and the response type is one of string, int or bytes. Meaning that complex data can simply be encoded as bytes and sent.

The oracle processor is an off-chain service that monitors requests coming into its contract. Note that one possible implementation may allow multiple oracle processors to service requests from a single oracle contract. This service will check if it can service the request if the fee is sufficient, and the timeout is long enough to actually service the request. If these conditions are met, it will calculate the required data and use the oracle contract to respond to the client. The oracle contract will take the request id and data and pass it back to the client. At that point the client contract can take action based on this information. The code for deploying and interacting with this system is available.

While the above appears comprehensive, more work remains to be done. An oracle registry would be quite useful for data discovery, data retrieval and visualization tools, etc. All this would be possible once oracles are actually deployed. Running oracles seems to be a clear extension of the “baker” services on Tezos. The validators are already running highly available infrastructure and they are trusted stewards of the platform. Running oracles provides an additional revenue stream to ensure diversity of validators on the blockchain.

Another common application for oracles is cross-chain communication. For example a token swap exchanging balances of ERC20 tokens on Ethereum for FA2 tokens on Tezos. Lower-complexity solutions for this use-case are also possible. They involve the counterparties participating on both chains, calling a set of contracts with a shared secret to exchange and unlock balances for withdrawal.

Decentralized oracles have the potential to bring significant value to blockchains. In the immediate future decentralized oracles can accelerate development of robust DeFi applications on Tezos by not only creating value for oracle operators, but also funneling external value from other chains in the shape of Chainlink tokens into Tezos. The token itself will of course become half of a pair to any other token already on Tezos and supported by the DEXes like USDtz.

--

--