Last updated

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:

NetworkProviderOracle Document ID
XRPL Mainnetdiadata (hex. 64696164617461)42
XRPL Testnetdiadata (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.

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.

SettingDetails
Pricing MethodologyVWAP
Deviation (%) & Refresh Frequency1% and 120 seconds
Heartbeat24h

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 TickerAsset Ticker (Hex)Asset Markets Overview
BTC4254430000000000000000000000000000000000BTC markets
ETH4554480000000000000000000000000000000000ETH markets
XRP5852500000000000000000000000000000000000XRP markets
RLUSD524C555344000000000000000000000000000000RLUSD markets
USDC0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48USDC markets
USDT0xdAC17F958D2ee523a2206206994597C13D831ec7USDT markets

How the Oracle Works

The oracleUpdater in the DIAOracleV2 contract is the gas wallet responsible for pushing the price updates on-chain.

Screenshot: How Dia Oracle Works

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).

TermDefinition
DeviationThe percentage threshold that triggers a price update when exceeded
Refresh frequencyA time interval for checking and updating prices if certain conditions are met
Trade windowA time interval used to aggregate trades of an asset for price calculation
HeartbeatA 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