DeFiChain Basics: Prices and Oracles

solros
Coinmonks
3 min readMay 7, 2022

--

Seeing through the many different types of prices on DeFiChain can sometimes be confusing. In this short post we’re going to get to the bottom of this.

The price at which you trade tokens on the DEX is what we call the DEX price. It is solely determined by the ratios of the different tokens in the pool — and hence by demand and supply. You can find more information about the DEX price in this post.

What is the oracle price?

In addition to the DEX prices, there are also oracle prices that become relevant when you mint tokens via a vault.

The oracle prices are determined by the prices of assets outside of the DeFiChain ecosystem and are used to determine the collateralization ratio of your vault. For these prices, there are different sources — called oracles — depending on the token. For example, one oracle for the stock prices is the NASDAQ and one oracle for crypto assets is CoinMarketCap.

There are a few different types of oracle prices:

  • The “active” oracle price. This is the value that is used to determine the current collateralization ratio of your vault.
  • The “next” oracle price. This is the value that is used to determine the “next” collateralization ratio. At the next price block (which happens every 120 blocks and hence about once per hour), the next price becomes the active price.
  • The “latest” oracle price. This is the average of the last prices provided by the oracles. This is purely informational at that point, but with the next price block the then latest oracle price becomes the next price.
    You can see the latest oracle prices for all tokens and oracles on defiscan.

So the active oracle price is always known 120 blocks (about one hour) in advance. Thus, it is a bit behind the current price in the outside world.

How do oracles work?

Oracles are appointed via blockchain transactions that require foundation member authorization. An oracle is associated with an address and has an oracle ID, a list of tokens for which it should submit prices and a weight.

An address that has been appointed as an oracle can then submit via a blockchain transaction price updates for each token for which it has been appointed. An oracle submits updated prices about every 15 minutes and the aggregated price for a token is computed as the weighted average of all active oracles’ prices. For example, if one oracle with a weight of 10 puts a token at 100 USD while another one with a higher weight of 20 values it at 120, the weighted average will be (10·100 + 20·120)/(10 + 20) ≈ 113.33. In general, the price is computed from the different oracle prices and weights as follows:

An oracle is only considered active if it has submitted an update within the last hour. Inactive oracles are ignored, but there have to be at least two active oracles. Otherwise the vaults affected by this price are halted/frozen until there are again enough active oracles.

Who controls the oracles?

As far as I know, the full information about the oracles’ sources is currently not publicly available, but as I’ve mentioned before, they are appointed and controlled by members of the DeFiChain Foundation.

So this aspect of DeFiChain is not yet fully decentralized. The plan — as laid out in the Pink Paper — is that this is going to change in the future with the introduction of operators and opspaces. When that time comes, anyone will (for a certain fee) be able to become an operator and manage their own opspace where they can offer their choice of DeFi operations and appoint their own oracles.

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read

--

--

solros
Coinmonks

Mathematician with a passion for optimization, Python, and blockchain. Likes to teach technical things since that’s the best way to learn them yourself.