Witnet (decentralized oracle) is now live on Conflux Network

Hi Conflux community! Adán here from Witnet Foundation.

I’m really happy to announce that the Witnet decentralized oracle is now available on Conflux Network.

Witnet is a next-gen oracle solution that enables smart contracts to securely access all kind of data with full integrity guarantees (crypto prices, stock prices, weather data, any API, etc.)

Witnet runs on its own single-purpose oracle chain, but it can be side-chained / bridged to multiple smart contract plarforms.

Over the last weeks, several members of the Witnet development community have been collaborating with the Conflux team on making this oracle solution available on Conflux Network.

As a Conflux smart contracts developer, there are two different ways you can use Witnet to source data:

  • Using public price feeds [easy]: Witnet Foundation currently operates a series of price feed contracts that are free to read from. Yes, they’re free! Integrating them into your own contracts is as easy as it gets, you should be up and running in 5 minutes (more details below)
  • Writing your own data requests [medium]: the Witnet protocol allows to create their own “data requests” commanding a fixed number of Witnet nodes to go to the APIs of your choice, retrieve the data in some specific way, aggregate it together, and report the result back to your contract. You can even define how to resolve any inconsistency between the results reported by multiple Witnet nodes. All these operations happen inside Witnet, so there’s almost no gas cost involved as you only need to pay for the cost of relaying the result. This tutorial on how to create Witnet data requests works for Conflux, Ethereum and other networks.

This integration is currently live on Conflux Testnet, but we plan to launch on Conflux Mainnet in the next days / weeks, depending on the interest from the community.

Introducing the first 3 price feeds

Witnet Foundation operates a series of public price feeds in cooperation with Conflux Network both for showcasing the capabilities of the Witnet oracle, and as a public service for the broader Conflux community.

All Witnet price feeds comply with the ERC-2362 interface: a standard interface for price feeds, cooperatively envisioned by Witnet, Tellor, Band, Razor and other oracles.

Therefore, using any of these price feeds is as simple as:

pragma solidity >=0.5.0 <0.9.0;

import "ado-contracts/contracts/interfaces/IERC2362.sol";

contract MyContract {

    function readFromPriceFeed() external view returns(int256) {
        IERC2362 priceFeed = IERC2362("<address of the price feed>");
        bytes32 assetID = bytes32(hex("<asset ID>"));
        int256 value = priceFeed.valueFor(assetID);

        return value;
    }

}

The available asset IDs for each of the public price feeds are also listed down below.

Tip: as Solidity does not currently support float types, all prices are provided as int256 with a specific number of decimal digits. For example, if the BTC/USD price is 31371.21, the BTC/USD contract below will give31371210 because it is using 3 decimal digits.

A full list of available price feeds will be maintained at the Conflux page on the Witnet documentation site.

CFX/USDT

Conflux Mainnet - Tethys

This price feed is not live yet on Conflux mainnet, but will be deployed soon. Stay tuned!

Conflux Testnet

ETH/USD

Conflux Mainnet - Tethys

This price feed is not live yet on Conflux mainnet, but will be deployed soon. Stay tuned!

Conflux Testnet

BTC/USD

Conflux Mainnet - Tethys

This price feed is not live yet on Conflux mainnet, but will be deployed soon. Stay tuned!

Conflux Testnet

We’re here to help!

The Witnet development community is looking forward to work side-by-side with projects and devs building on Conflux to help them use Witnet as an oracle and learn how we can make this integration most useful for them. Blending ourselves into other communities is our preferred way of collaboration.

Whether you need technical assistance, additional price feeds, or even financial support for a project using Witnet as an oracle on Conflux, we are here to help!

6 Likes

:+1:

2 Likes

Awesome :clap:

2 Likes

Great! :+1:

2 Likes

Very exciting! :smiley: Thank you for sharing this update.

1 Like