πŸ“ˆ
Price Feeds
The easiest way to use an oracle to source external data into a smart contract is through a Price Feed. More and more projects building on multiple blockchains are relying every day on the WItnet data feeds to get price references and other valuable data into their smart contracts.
Witnet price feeds are timely updated with fresh data as aggregated from multiple reliable data sources and attested by the Witnet decentralized oracle network, which offers high data integrity guarantees thanks to its unique cryptoeconomic design.

Using Witnet Price Feeds, in a nutshell

Using Witnet data feeds to source prices and other data is extremely simple. This example obtains the latest BTC/USD-6 price using the Ethereum Rinkeby testnet:
1
// SPDX-License-Identifier: MIT
2
pragma solidity >=0.5.0 <0.9.0;
3
​
4
import "witnet-solidity-bridge/contracts/interfaces/IWitnetPriceRouter.sol";
5
​
6
contract MyContract {
7
​
8
IWitnetPriceRouter public immutable witnetPriceRouter;
9
10
/*
11
* Network: Ethereum Rinkeby
12
* WitnetPriceRouter: 0xa50b17C2fc373c247C3b603f83df6A7800cB0DC9
13
**/
14
constructor() {
15
witnetPriceRouter = IWitnetPriceRouter(0xa50b17C2fc373c247C3b603f83df6A7800cB0DC9);
16
}
17
​
18
/// Returns the BTC / USD price (6 decimals), ultimately provided by the Witnet oracle, and
19
/// the timestamps at which the price was reported back from the Witnet oracle's sidechain
20
/// to Ethereum Rinkeby.
21
function getBtcUsdPrice() external view returns (int256 _lastPrice, uint256 _lastTimestamp) {
22
(_lastPrice, _lastTimestamp,) = witnetPriceRouter.valueFor(bytes32(0x24beead4));
23
}
24
}
Copied!
The IWitnetPriceRouter and IWitnetPriceFeed interfaces can be found in the witnet-solidity-bridge npm package, among many other Witnet related interfaces, contracts and utilities.

What Price Feeds Are Currently Available?

A complete list of publicly available Witnet data feeds on Witnet's many supported blockchains can be found in the Witnet Data Feeds website:
Data Feeds Explorer | Witnet
The Price Feeds Contract Addresses section also contains a list of all the data feeds that Witnet provides on the different supported blockchains:

Learn More About Witnet Price Feeds

For more information on Witnet price feeds, please read the section dedicated to Witnet Price Feeds. This contains a lot more information on alternative ways to consume the data feeds, how they operate, and what their contract addresses are.