The native Oracle precompile is retired, so price data on Sei comes from third-party oracles. This recipe reads API3’s SEI/USD feed. API3 pushes new prices on-chain, so the latest price is already stored in a contract. Reading it is a free view call. You do not need a key, an API token, or SEI.
Read the feed on Sei Mainnet. When this recipe was tested, the same address on Sei Testnet returned a value that was months old. Always check the timestamp, as the examples below do.
Try it live
This call runs the proxy’s read() function (selector 0x57de26a4) from your browser. The response holds two 32-byte values. The first is the price with 18 decimals. The second is the Unix time of the last update.
Install
Read the price
You are done when you see:
The price is illustrative. API3 updates a feed when the price moves past the feed’s deviation threshold, and at least once every 24 hours when the price is flat. The examples therefore reject a value that is not positive or is more than 24 hours old. See API3’s update parameters for details.
Use the price in a contract
A contract reads the same proxy through API3’s IApi3ReaderProxy interface and should apply the same checks. The API3 guide has a complete consumer contract.
Other oracles on Sei
Chainlink Data Streams, Pyth, and RedStone are pull oracles. Your transaction carries a signed, current price with it. A view call on its own returns either nothing or the last price that someone else submitted, which can be old. Follow their guides to use them.