Integrating DIA Oracles on the XRP Ledger
As institutional DeFi continues to grow on the XRP Ledger (XRPL), access to reliable, decentralized price feeds is becoming increasingly essential. To support this, DIA, a leading open-source oracle platform, is now live on the XRPL, offering robust, customizable oracles across thousands of assets. This blog post walks you through integrating DIA’s oracle service with your XRPL-based application, whether you’re working on DeFi, tokenized assets, or next-gen payments.
1. Your Oracle Details
1.1 Oracle Services
The providers to fetch data from:
Network | Provider | Oracle Document ID |
---|---|---|
XRPL Mainnet | diadata (hex. 64696164617461) | 42 |
XRPL Testnet | diadata (hex: 64696164617461) | 1 |
Each oracle document contains real-time pricing data for key assets—including XRP, RLUSD, and more — making it simple for developers to retrieve trusted market prices directly from the ledger.
1.2 Account Funding for Transaction Fees
To ensure uninterrupted oracle operation when pushing data to your contracts, it is crucial to maintain a sufficient XRP balance in the relevant XRPL account. This balance must cover the XRP reserve requirements for the account and the minor transaction fees incurred with each transaction. You can monitor the accounts listed below to ensure they remain adequately funded at all times.
Network | Account |
---|---|
XRPL Mainnet | rP24Lp7bcUHvEW7T7c8xkxtQKKd9fZyra7 |
XRPL Testnet | r3U1mL5u2SCPr4mApqYyF96nvwvKoGf7aH |
You can monitor these wallets on-chain for transparency and operational assurance.
1.3 Oracle Configuration
Settings that dictate how the oracle computes and updates data.
Setting | Details |
---|---|
Pricing Methodology | VWAP |
Deviation (%) & Refresh Frequency | 1% and 120 seconds |
Heartbeat | 24h |
This configuration ensures that price updates are both reactive and consistent, maintaining high accuracy without overwhelming the network.
1.4 Asset Feeds
These asset feeds serve as foundational infrastructure for a wide range of XRPL-based dApps—from AMMs to lending platforms—ensuring composability across the ecosystem.
Asset Ticker | Asset Ticker (Hex) | Asset Markets Overview |
---|---|---|
BTC | 4254430000000000000000000000000000000000 | BTC markets |
ETH | 4554480000000000000000000000000000000000 | ETH markets |
XRP | 5852500000000000000000000000000000000000 | XRP markets |
RLUSD | 524C555344000000000000000000000000000000 | RLUSD markets |
USDC | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 | USDC markets |
USDT | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | USDT markets |
How the Oracle Works
The oracleUpdater
in the DIAOracleV2
contract is the gas wallet responsible for pushing the price updates on-chain.
Check out the full audit report here for the DIAOracleV2 contract.
How to Access Data
The DIA oracle object can be retrieved with the ledger_entry API call by specifying the account
and oracle_document_id
. You can access the mainnet and testnet accounts here.
This is the request JSON for mainnet:
{
"id": "example_get_oracle",
"command": "ledger_entry",
"oracle": {
"account": "rP24Lp7bcUHvEW7T7c8xkxtQKKd9fZyra7",
"oracle_document_id": 42
},
"ledger_index": "validated"
}
It will return the current price of all the assets in hexadecimal format, which can then be converted to decimal and scaled to obtain the actual price with 8 decimal places.
This method leverages XRPL’s native ledger-querying capabilities, meaning you don’t need external indexing services to retrieve oracle data—just the standard API.
Glossary
Understanding the following terms is crucial when configuring DIA oracles for your application logic, especially for price-sensitive dApps like derivatives, stablecoins, or automated market makers (AMMs).
Term | Definition |
---|---|
Deviation | The percentage threshold that triggers a price update when exceeded |
Refresh frequency | A time interval for checking and updating prices if certain conditions are met |
Trade window | A time interval used to aggregate trades of an asset for price calculation |
Heartbeat | A forced price update at a fixed interval |
Support
You can always reach out to the dedicated DIA support channel on Slack, Discord, or Telegram. You can also follow XRPL-specific updates and best practices via XRPL Dev To or join XRPL developer channels for peer guidance and integration showcases. XRPL Dev Discord