- Price Feeds: Real-time pricing for cryptocurrencies, stocks, or commodities.
- Event Information: Updates on real-world events like sports results or weather conditions.
- API Access: Connections to external web services and systems.
Deployed Oracles on NEAR
Here is a directory of third-party oracle services deployed on the NEAR blockchain:| Name | Creator | Description |
|---|---|---|
| Price Oracle | NearDefi | Open source oracle for real-time asset pricing |
| Pyth Network Oracle | Pyth Network | High-frequency, low-latency oracle for price feeds |
Price Oracle by NearDefi
- Creator: NearDefi
- Codebase Repository: NearDefi/price-oracle
- Bot for Data Feeds: NearDefi/near-price-oracle-bot
- Deployed Addresses:
- Mainnet: priceoracle.near
- Testnet: priceoracle.testnet
Query Assets
Get Assets Price
Pyth Network Oracle
- Creator: Pyth Network
- Official Documentation: Pyth NEAR Docs
- Codebase Repository: pyth-network/pyth-crosschain
- Deployed Addresses:
- Mainnet: pyth-oracle.near
- Testnet: pyth-oracle.testnet
Getting Started
To use Pyth oracle, you need:- Price ID(s)
- Hermes API Endpoint
- Smart contract address
| Network | Price Feed IDs | Hermes API Address | Contract Address |
|---|---|---|---|
testnet | NEAR testnet Price Feed IDs | hermes-beta.pyth.network | pyth-oracle.testnet |
mainnet | NEAR mainnet Price Feed IDs | hermes.pyth.network | pyth-oracle.near |
When using Price Feed IDs, you must remove the
0x prefix.Example (testnet):Update Price Feeds
Pyth Oracle has two core methods:-
update_price_feeds- Updates the Pyth smart contract with the price feed you provide- args:
data(hex-encoded price feed) - type:
object - example:
{ "data": "504e41..." }
- args:
-
get_price- Fetches the most recent price stored in the contract- args:
price_identifier - type:
object - example:
{ price_identifier: 'f9c0172ba10dfa8...' }
- args:
1) Fetch Off-Chain Price Feed
You can obtain an off-chain price feed using Pyth’s Hermes API. Example (Node.js):2) Update Pyth Oracle Contract
After fetching an off-chain price feed, callupdate_price_feeds on the Pyth Oracle:
Although unused deposit will be refunded, you can calculate an estimate by calling the
get_update_fee_estimate method on the Pyth contract.Get Price
After updating the price feed, you can view it on-chain by callingget_price: