Skip to main content

Feed Registry

Feed Registry allows querying the prices on the chain from your smart contract using various endpoints. For a complete list of functions and parameters for the FeedRegistryInterface, see the Feed Registry API Reference.

Usages and Examples:

Querying all the existing feeds on-chain

Binance FeedRegistry maintains a database of assets and their metadata on-chain. For your smart contract on the chain to fetch all the available feeds and their details, call:


You may also perform this query offchain. For instance using BSC Scan

Querying using Base and Quote addresses

The FeedRegistry exposes a variant of AggregatorV3Interface for querying round data. Instead of using a pair specific smart contract, users may use token addresses to query the latest data from a single contract i.e. the FeedRegistry. To retrieve the latest data for ETH/USD from the registry using their token addresses, call:

latestRoundData(address base, address quote);

Ex: To query the latest ETH/USD price:

  • base: The ETH token address on BNB Chain ie "0x2170Ed0880ac9A755fd29B2688956BD959F933F8"
  • quote: The USD address representation "0x0000000000000000000000000000000000000348". This is based on ISO 4217
latestRoundData(0x2170Ed0880ac9A755fd29B2688956BD959F933F8, 0x0000000000000000000000000000000000000348)

The USD token is not the same as stable coins such as BUSD, USDC etc. See guide for more details.

Querying using Token string names

To make the process less error prone and to increase ease of use, FeedRegistry additionally allows users to query prices by using just the asset string names. In such a case, use

latestRoundDataByName(string memory base, string memory quote)

Code Examples


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../interfaces/FeedRegistryInterface.sol";

contract PriceConsumer {
FeedRegistryInterface internal s_feedRegistry;

constructor(address _registry) {
s_feedRegistry = FeedRegistryInterface(_registry);

function getLatestPrice(address base, address quote)
returns (int256 answer)
return s_feedRegistry.latestAnswer(base, quote);

Hardhat/ Ethers

import { ethers } from "hardhat";

async function main() {
const registryAddress = "0x1647a10D50e1Ebf84FF6E38e4c8dd1298E0E69cC"; //Testnet address
//Pass the name or ABI of the contract
const registry = await ethers.getContractAt("FeedRegistryInterface", registryAddress);
const priceWithoutDecimals = await registry.latestAnswerByName("BTC", "USD");
console.log("Answer for BTC/USD: ", priceWithoutDecimals.toString());

.then(() => process.exit(0))
.catch((error) => {


import Web3 from 'web3'
import contract_abi from './contract_abi.json'

async function getSymbolPairPrice(baseAsset, quoteAsset) {
const registryAddress = "0x1647a10D50e1Ebf84FF6E38e4c8dd1298E0E69cC"; //Testnet address
const provider = new Web3.providers.HttpProvider('');
const web3 = new Web3(provider);
const contract = new web3.eth.Contract(contract_abi, registryAddress);
const result = await contract.methods.latestRoundDataByName(baseAsset, quoteAsset).call();

getSymbolPairPrice("BTC", "USD")

/** Output
Result {
'0': '18446744073709551616',
'1': '1936203781166',
'2': '1666108882',
'3': '1666108887',
'4': '18446744073709551616',
roundId: '18446744073709551616',
answer: '1936203781166',
startedAt: '1666108882',
updatedAt: '1666108887',
answeredInRound: '18446744073709551616'
Contract ABI

The ABI json can be exported from the BSC Scan from the 'Contract ABI' section at a specific address.

Contract addresses

FeedRegistry is deployed on BNB Testnet and Mainnet. Please refer to the contract addresses