Kaiko on-chain

This guide walks you through consuming our Robust Pair Prices through the Kaiko On-Chain on Ethereum. Several asset pairs are publicly available, meaning you can access free hourly updates or update on-demand for a small fee. You can read more about Kaiko on-chain here.

Read and update manually

Visit oracle.kaiko.com. Here, you can see the latest Kaiko price updates for all pairs.

To update the price:

  1. Click "connect wallet"

  2. Once you've connected your wallet, click "Update"

  3. Authorize the payment of 0.01 ETH

  4. Wait a few seconds for the prices to be updated

One price update request updates all Kaiko price feeds - there's no need to request them independently.

Update and read on-chain

To read and update on-chain, you'll need to set up an off-chain listening event using a node provider of your choice to connect to the blockchain.

To update the price:

This example script uses Typescript, but you can produce similar results using other coding languages. Running the script requests a price update and listens until it's been updated on-chain. When the update is detected, it alerts your on-chain smart contract.

  1. Install ethers npm install ethers

  2. Send a transaction with a value of 0.01 ETH to the refreshPriceFeeds contract address 0xff2743c44f820c64c94eccfc1b497a1019541097

  1. Wait for at least one block for the price update to be reflected on-chain

One price update request updates all Kaiko price feeds - there's no need to request them independently.

Read the price on-chain:

This Solidity contract example is triggered by the refreshPriceFeeds function in the Typescript example above. When triggered, it ingests the updated prices on-chain.

Last updated

Was this helpful?