> For the complete documentation index, see [llms.txt](https://qi-blockchain.gitbook.io/qie-oracle/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qi-blockchain.gitbook.io/qie-oracle/getting-started/reading-data-from-oracle.md).

# 📡 Reading Data from Oracle

Once connected, you can query Oracle contracts to fetch live prices.

#### Example: Fetch BTC Price

```
interface IQIEOracle {
    function getPrice(string calldata asset) external view returns (uint256);
}

contract FetchPriceExample {
    IQIEOracle oracle = IQIEOracle(0x9E596d809a20A272c788726f592c0d1629755440); // BTC Oracle

    function getBTCPrice() public view returns (uint256) {
        return oracle.getPrice("BTC"); // Returns BTC price in smallest unit
    }
}

```

**JavaScript Example (ethers.js)**

```
const { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("https://rpc.qiechain.io");

const oracleAddress = "0x9E596d809a20A272c788726f592c0d1629755440";
const oracleAbi = ["function getPrice(string asset) view returns (uint256)"];

const oracleContract = new ethers.Contract(oracleAddress, oracleAbi, provider);

async function fetchBTCPrice() {
    const price = await oracleContract.getPrice("BTC");
    console.log("BTC Price:", price.toString());
}

fetchBTCPrice();

```

> ⚡ Tip: Replace `"BTC"` with `"ETH"`, `"XRP"`, or any supported asset symbol to fetch other prices.

This section provides the **foundation for developers** to start interacting with QIE Oracle immediately, whether through smart contracts or scripts.
