> ## Documentation Index
> Fetch the complete documentation index at: https://www.diadata.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pull Based Oracles

> [Pull (or also known as Request Based Oracle) oracle](/reference/architecture/data-delivery#pull-model) model enables the creation of requests for asset prices on a source blockchain. These requests are sent through a mailbox on the current chain and ultimately delivered to the DIA chain, which retrieves and delivers the required price data.

## How It Works

### Request Creation

A request is made from the source chain for an asset symbol whose price is required (e.g. ETH/USD) which then passes through the chain's mailbox to be then delivered to the destination chain. You check the available contract address on testnet based on the destination chain you're reading from [here](/docs/guides/chain-guides-overview).

The request body is formatted as follows in JavaScript:

```javascript theme={"system"}
const key = "ETH/USD"; // Assuming key is an address or a bytes32 value

const requestBody = abiCoder.encode(
  ["string"], // Types of the parameters
  [key] // Values to encode
);
```

And this is how it is formatted in Solidity:

```solidity theme={"system"}
bytes memory requestBody = abi.encode("WBTC/USD");
```

### Message Delivery Process

Once a request is created, it is transmitted to the Hyperlane mailbox. The message is then relayed to the `OracleRequestRecipient` contract , where the price data is fetched from the Oracle Metadata Contract.

### Response and Callback

Upon receiving the request, the DIA chain initiates a transaction to deliver the message back to the end contract on the source chain. The recipient contract on the source chain must implement the IMessageRecipient interface, which includes a handle function that will receive the price quotation.

## Making a Price Request

In this example, we’ll be sending an ETH/USD price request from Base Sepolia to DIA Lasernet. Start by cloning the `Spectra Interoperability` repository to your local machine and switching to the `deploy`branch:

<Card title="GitHub - diadata-org/Spectra-interoperability" href="https://github.com/diadata-org/Spectra-interoperability" icon="github" iconType="solid" horizontal />

```bash theme={"system"}
git clone https://github.com/diadata-org/Spectra-interoperability.git
git checkout deploy
```

Then install the node packages and compile the contracts using hardhat:

```bash theme={"system"}
npm install
npx hardhat compile
```

Next, `cd contracts` folder, and export your wallet's private key in your terminal as follows:

```javascript theme={"system"}
export PRIVATE_KEY=[paste_here]
```

Now, the `sendMessage.mjs` script will trigger a `request` transaction to fetch the latest price of ETH/USD from DIA lasernet. To run the script:

```bash theme={"system"}
npx hardhat run scripts/sendMessage.mjs --network base_sepolia
```

You can also run the script on other networks by changing the value passed to the `--network` flag (e.g. `--network sepolia`).

Once the price update takes place on the destination chain, which you can track from the [hyperlane explorer](/docs/reference/cross-chain-messaging), you can check the txn logs for the `ReceivedMessage`event on the pull oracle contract or call the `updates`function.

<Frame>
  <img src="https://mintcdn.com/diadata/qIgjiltsbRJuXYkF/images/how-to-guides/fetch-price-data/image-1.png?fit=max&auto=format&n=qIgjiltsbRJuXYkF&q=85&s=da460b80a2b46d12f7b7aad4b8b223d0" width="2304" height="484" data-path="images/how-to-guides/fetch-price-data/image-1.png" />
</Frame>

The price returned is around 2,718\$!
