Oracles on Tezos

What Can We Learn From Oracles on Ethereum?

What kind of oracle solution would support the Tezos ecosystem in the best way? Currently there are multiple options available on Ethereum. On Tezos the development is still limited, but I believe having more oracle solutions on Tezos could stimulate DeFi development.

So what is available on Ethereum right now?

Maker

MakerDAO uses a custom oracle managed by a group of 14 pseudonymous individuals and public organizations to determine asset prices and exchange rates for supported assets. The group of 14 participating feeds are determined by a DAO governance vote, and is subject to change.

The oracle itself consists of two modules, a broadcaster and relayer. Each feed runs a broadcaster which pulls asset prices, signs them with their private key, and broadcasts them through a secure network. A relayer monitors the broadcaster messages, ensures they are within a predetermined spread (1%), aggregates the data, and submits it to Ethereum as a single transaction. Before the Maker system updates with the new price, however, a time period enforced by the Oracle Security Module (OSM) must be waited. This ensures that new price values propagated by the system are not taken up until a specified time in the future.

Maker does not have an incentive structure for relayers or feeds, but has proposed one such model which would compensate feeds, relayers, and other participants for their contributions to the system. The current design also maintains a whitelist of specific addresses who can access the oracle’s data.

Source: http://oracles.club/maker.html

Chainlink

ChainLink’s reference price feeds rely on a set of trusted parties to provide asset prices to the Ethereum blockchain. ChainLink also offers a service that allows users to request alternate off-chain price data from trusted oracle providers or, alternatively, set up a network of oracles themselves. ChainLink provides free access to reference price feeds for the ETH/USD and BTC/USD pairs (as well as many others). These feeds rely on a set of 21 trusted parties to submit reference price data. The ETH/USD pair updates every 0.5% deviation in price and has a heartbeat of 2 hours. The BTC/USD pair updates every 1% deviation in price and also has a heartbeat of 2 hours. Unlike MakerDAO, ChainLink does not have a decentralized governance process to determine participating parties in its reference price feeds. ChainLink itself is responsible for adding/removing parties from the system, centralizing control of the reference oracles.

ChainLink allows application developers to run their own ChainLink node or request other off-chain data, but requires payment in the LINK token. LINK is an ERC-667 token that implements a custom function that allows for the transfer of data along with token transfers. This mechanism is used to query and transfer resulting data from ChainLink nodes to on-chain smart contracts. If an application developer wishes to query non-reference data using Chainlink, they can either run their own ChainLink node, or query one of ChainLink’s trusted nodes. Each node that is queried charges the requester a predetermined amount of LINK. Requesters can call multiple nodes to achieve the desired degree of decentralization, but are charged for each query they make.

ChainLink gives developers the option to run their own ChainLink node that responds to requests, but requires these developers to buy and send the LINK token to themselves for each request they make. ChainLink will also be establishing a whitelist for all on-chain reference price data (although it is currently free). The ChainLink organization will control all changes (additions/deletions) to this list.

Source: http://oracles.club/chainlink.html

Compound

The decentralized lending platform Compound uses a custom application-specific price oracle.

Compound’s oracle relies on a single, centralized poster (price gathering script) to pull the price of a basket of assets relative to Ether from many different exchange sources. This trusted party then posts price updates to the blockchain each time it detects a 1% deviation in price. The newly reported price must be within a 10% bound of an anchor price that is updated every hour. Large price movements (>10%) must be set manually using a corresponding, specific hardware key. This key is currently controlled by the Compound team.

Compound has also developed a second oracle design they call the Compound Open Oracle System. Using the Open Oracle system, anyone wishing to report a price can do so. This report is then propagated via a p2p network to all other nodes in the system. Anyone with gas and a connection to the Ethereum network can then post the signed price data on-chain. A single on-chain contract, known as the Data Contract, is responsible for holding and validating all price data. This contract sorts the reported information by price reporter. Any on-chain application can request to view price data by selecting a subset of the reported price feeds. While Compound expects to productionize this oracle in the near future (still completing audits), it has yet to be launched on the Ethereum mainnet.

Source: http://oracles.club/compound.html

Uniswap

Uniswap is a constant-product automated market maker (or constant-product AMM), that allows users to exchange asset pairs on the Ethereum blockchain as long as a predetermined product of the reserves remains constant. Uniswap exists entirely on the Ethereum blockchain, and is completely decentralized, with no single party having control of the asset pool or prices. Uniswap’s reserve balances are public and viewable by any party at any time, thus Uniswap can be used as a price oracle to determine the marginal price of an asset.

Uniswap relies on arbitrageurs to ensure its quoted asset prices are close to the reference market price. If the price quoted by Uniswap differs from the true market price of the traded pair, arbitrageurs can always make a profit from executing a trade with this oracle. Thus, it is always likely to trade close to a reference market price.

Using Uniswap as an oracle does have downsides, however, as low liquidity asset pools are vulnerable to relatively inexpensive manipulation as was demonstrated in the bZx attack. Thus, Uniswap should only be used as an oracle if the service using it does not depend on relatively small changes in market price, or over a very short period of time.

Uniswap v2 will incorporate price feeds focused on solving both of the above problems. Each traded pair measures the current Uniswap market price at the beginning of each block. This price iis set by the last transaction in a previous block, and is thus expensive to manipulate. Uniswap V2 adds this end-of-block price to a cumulative-price variable in the contract that is weighted by the time this price has existed. This variable represents a sum of the Uniswap price for every second in the entire history of the contract. External contracts seeking a manipulation resistant price from Uniswap can read this variable and calculate their required price.

Source: http://oracles.club/uniswap.html

Dfusion

Dfusion is a decentralized exchange that uses batch auctions and a multi-dimensional order book to set prices for asset pairs. Unlike Constant-Function Market Makers or traditional exchanges that maintain separate liquidity pools/order books for individual asset pairs, Dfusion aggregates all orders into a single multi-dimensional order book that consists of multiple different token pairs. It then uses a time-based batch auction to set cleaning prices for each token exchanged in a batch. Batch auction settlement prices can be used as an oracle service by projects seeking access to an on-chain oracle service.

Dfusion’s settlement times occur approximately every 5 minutes. All orders submitted before a batch is settled can be included in the final settlement. The auction accepts settlement proposals from anyone. Solutions are simply checked for validity and if they are ‘better’ than existing solutions. If a solutions is judged to be ‘better’ than another, it replaces the previous solution. All trades are finalized after 5 minutes.

Source: http://oracles.club/dfusion.html

Coinbase

The Coinbase Oracle is a verifiable price feed for the BTC/USD and ETH/USD markets that anyone can publish on-chain. The price feed is accessible through a centralized API, and is updated every minute with data sourced from Coinbase Pro.

All posted prices are signed using the Oracle’s public key. This allows anyone to post price data on-chain, without trusting the poster of the data. The Oracle implements a filtering mechanism that automatically rejects price points that significantly deviate from the reported asset’s expected volatility. The result is a trusted, but reliable feed that any DeFi protocol can integrate easily.

Source: http://oracles.club/coinbase.html

What do you want to see on Tezos?

While the Tezos defi ecosystem evolves, I think current and upcoming projects could benefit from an oracle solution that has a novel architecture and works in a semi-trustless manner.

A decentralized oracle network could be a goal to achieve as more DeFi projects start and volume increases in Tezos, but there are some obstacles such as incentivising node operators (without a seperate token distribution), accuracy and validation of feed, resistance from various social and technical attacks etc. At Tezsure we would love to have a trusted and verified oracle system to build on.

I would really like to see an open discussion in regards to oracles on Tezos. It is still early, so it is still pretty much an open canvas. Let’s paint together!

17 Likes

It’s true. A stable oracle system can help pave the way for DeFi projects in Tezos. That will encourage or kickstart DeFi activities. I think an a set of oracles governed by multiple actors in the Tezos ecosystem could be a way (maybe core research group, development projects, community orgs. and active contributors ). This could evolve into a network as the defi on Tezos grows, eventually enabling a broader governance and multiple oracle nodes.

1 Like

I don’t know much about Oracles but I think the more (if they are quality ones) the better. In a DeFi world it’s always better to have more sources of information because we can’t 100% trust them on their own.

And this just came out. SmartPy will bring Chainlink oracles to Tezos.

3 Likes

Definitely interesting, but I hope to see other oracle solutions as well.

  • Something that doesn’t require another token to function.
  • The fact that only 35% of tokens are publicly available is also not a pretty sight.
1 Like

Sounds a bit like protocol design :slight_smile: . Some interesting roperties:

  • payable in xtz
  • decentralised: Maker model sounds clever. But how to know if the price feed is incorrect(compare deviation?)? And how to punish bad behaviour (slash stake?)?
  • should have some reputation mechanism or forbid anonymity: coinbase is far less likely to manipulate price than a long term good behaving anonymous quote supplier.

Many questions remain:

  • how to determine fee?
  • is quote an average of all feeds, or median, or…
  • should the quote also include a confidence level?
  • if confidence level is too low, should quote even be published?
3 Likes

Personally I’m against the use of Chainlink for a few reasons, though of course anyone is free to use it if that’s what they feel is best for them:

  1. I don’t want to use a platform that is not only built on another chain, but forces you to purchase ETH/LINK for API requests. Also on this topic, ETH gas is too expensive and as far as I’m aware, Chainlink doesn’t currently make sense at scale, monetarily. And Ethereum 2.0 won’t be ready to support Chainlink for years.

  2. I feel that any platform like Chainlink should utilize the native coin, and correct me if I’m wrong, but is there any necessity for LINK aside from doing their fundraising? Why not use ETH for everything?

I’d prefer oracles on Tezos that use XTZ.

2 Likes

A standard deviation could be set for price feed. A large amount of stake could be enabled for people to run node with slashing. A reputation mechanism and a data validation mechnaism also has to be there. Sort of like baker and endorser. (And anonymity should be forbid, it then also put a minor pressure from community to stay active and honest)

All the questions are good and I think Oracle network design comes close to protocol design. Incentivisation in XTZ could be a task and a very interesting point imo for people to run nodes.

2 Likes

Yeah, there are mutilple barriers to use Chainlink. They say they are blockchain agnostic but evetually it doesn’t help the network effect of Tezos. Using a component which is built on Ethereum and transacting w the same for building on Tezos is not the most friendliest way imo.

2 Likes

I have nothing against Chainlink. It’s a great addition to Tezos. But a project like Tezos should have its own oracles, that are payable with native XTZ.

2 Likes

I am not against Chainlink, but I just don’t understand their token model. The heavy centralization of the token and ecosystem are red flags to me. From a technical standpoint the functionalities can easily be recreated using Tez.

We can definitely learn from them, but I think other oracle solutions are also interesting to study.

2 Likes

Great points, to figure these questions out we have to iterate and test a lot. I don’t think writing a whitepaper is the right course here. Just trying different models in a test environment seems the best way forward in my opinion.

1 Like

Would really like to know the opinion of user-facing projects on Tezos.

Asking all developers, startups and companies to join the discussion, what kind of oracles would you use in your project?