Where is the price oracle?

AFAIK Dfinity uses a price oracle to calculate conversion rate of ICP to Cycles.

Can someone reveal more details about this price oracle? Is it also a canister? If yes, then how can other application/canister access this info? If not, what is the mechanism that relay price info into the network?

Not sure who to ask, cc @ililic


AFAIK the mechanism to decide for the price of one ICP is through proposals and voting. Every x minutes there is a proposal regarding the market value of one ICP in SDR, people then vote on if this price is correct. If the vote is passed, the conversion rate is updated.

#ExchangeRate: All proposals provide information in “real time” about the market value of ICP, as measured by an International Monetary Fund (IMF) Special Drawing Right (SDR) , which allows the NNS to convert ICP to cycles (which power computation) at a rate that keeps their real-world cost constant. Because proposals on this topic are very frequent, they have a shorter voting period, and votes on this topic are not included in the voting history of the neuron.



Good to know. Do you also know how to access the latest ExchangeRate on IC?


Currently, this is happening every 10 minutes, with the price coming from a single exchange (usually Coinbase, Binance, or Huobi). It would be good to have to have more information on:

  • Is this price spot, TWAP, or VWAP? On what pair?
  • How is that single exchange determined? Is it highest volume over the past 10 minute window?
  • Is 10 minutes fast enough to use as a true price oracle? During periods of high market volatility, this too slow. Can this frequency be increased?
  • How is this process running? I assume a single cronjob on one instance for now, but can it be decentralized?

Does this price oracle process run in the IC network or outside?

1 Like

Thanks for your questions! Allow me to answer all questions in a single post:

Getting the exchange rate on the IC: You can query the current rate from the NNS registry (using the key xdr_per_icp).

It may look that way but the exchange rate does not come from a single exchange. There are multiple price oracles running in different places and each price oracle obtains current ICP/USD (or ICP/USDT) and USD/XDR rates from multiple exchanges and market data providers. The reason why you see a single source for the ICP/USD rate is that the median rate is chosen after collecting all rates (to protect against outliers). So, this process is decentralized.

The rate is based on the opening price of the current 1-minute window. As the opening price does not change once it is set, each exchange should return exactly the same price for every requesting oracle within the same minute.

As mentioned in the Medium article, one instance will create a proposal based on the locally computed exchange rate. The other instances will support this proposal (only) if the proposed rate is close their local exchange rate.

It is a good question whether updating every 10 minutes is fast enough. In short, I don’t know. But yes, the frequency could definitely be increased if there is a need.

The decentralized oracles all run outside of the IC by necessity as canisters currently cannot pull data from the outside world.


What is the reason for feeding the price? Is there anything wrong with fixed cycle and ICP exchange rate

1 Like

The reason is that the price of cycles is pegged to XDR but the price of ICP is determined on the open market. So, in order to determine how many cycles you should get per ICP, the cyles minting canister must know the current ICP/XDR exchange rate.

Let me further provide an update: I announced a change back in September in this thread, which is now live, i.e., the ICP/XDR rate is no longer maintained in the NNS registry. Instead, it is stored in the cycles minting canister itself.

1 Like

Holy smokes…once canisters can send http requests, we’ll be able to build oracle canisters :exploding_head:


That’s right! It’s a very powerful feature.
For example, the Cycles Minting Canister will make use of it to query exchange rate information itself in the future.