Skip to content

Commit 44e111a

Browse files
committed
Add blog post to integrate dia oracles on XRPL
1 parent bdcc397 commit 44e111a

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
category: 2025
3+
date: 2025-05-16
4+
seo:
5+
title: Integrating DIA Oracles on the XRP Ledger
6+
description: Learn how to integrate DIA's oracle service with your XRPL-based application to fetch up-to-date asset price information, whether you're working on DeFi, tokenized assets, or next-gen payments.
7+
labels:
8+
- Development
9+
markdown:
10+
editPage:
11+
hide: true
12+
---
13+
# Integrating DIA Oracles on the XRP Ledger
14+
15+
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 XRP Ledger, 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.
16+
17+
<!-- BREAK -->
18+
19+
## 1. Your Oracle Details
20+
21+
### 1.1 Oracle Services
22+
23+
The providers to fetch data from:
24+
25+
| Network | Provider | Oracle Document ID |
26+
|:--------|:---------| :------------------|
27+
| XRPL Mainnet | diadata (hex. 64696164617461) | 42 |
28+
| XRPL Testnet | diadata (hex: 64696164617461) | 1 |
29+
30+
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.
31+
32+
### 1.2 Account Funding for Transaction Fees
33+
34+
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.
35+
36+
| Network | Account |
37+
|:-------------|:------------------|
38+
| XRPL Mainnet | [rP24Lp7bcUHvEW7T7c8xkxtQKKd9fZyra7](https://livenet.xrpl.org/accounts/rP24Lp7bcUHvEW7T7c8xkxtQKKd9fZyra7) |
39+
| XRPL Testnet | [r3U1mL5u2SCPr4mApqYyF96nvwvKoGf7aH](https://testnet.xrpl.org/accounts/r3U1mL5u2SCPr4mApqYyF96nvwvKoGf7aH) |
40+
41+
You can monitor these wallets on-chain for transparency and operational assurance.
42+
43+
### 1.3 Oracle Configuration
44+
45+
Settings that dictate how the oracle computes and updates data.
46+
47+
| Setting | Details |
48+
|:-------------|:------------------|
49+
| Pricing Methodology | [VWAP](https://nexus.diadata.org/reference/pricing-methodologies/vwap-volume-weighted-average-price) |
50+
| Deviation (%) & Refresh Frequency | 1% and 120 seconds |
51+
| Heartbeat | 24h |
52+
53+
This configuration ensures that price updates are both reactive and consistent, maintaining high accuracy without overwhelming the network.
54+
55+
### 1.4 Asset Feeds
56+
57+
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.
58+
59+
| Asset Ticker | Asset Ticker (Hex) | Asset Markets Overview |
60+
|:-----------|:----------|:-------------|
61+
| BTC | 4254430000000000000000000000000000000000 | [BTC markets](https://www.diadata.org/app/price/asset/Bitcoin/0x0000000000000000000000000000000000000000/) |
62+
| ETH | 4554480000000000000000000000000000000000 | [ETH markets](https://www.diadata.org/app/price/asset/Ethereum/0x0000000000000000000000000000000000000000/) |
63+
| XRP | 5852500000000000000000000000000000000000 | [XRP markets](https://www.diadata.org/app/price/asset/XRPL/0x0000000000000000000000000000000000000000/) |
64+
| RLUSD | 524C555344000000000000000000000000000000 | [RLUSD markets](https://www.diadata.org/app/price/asset/XRPL/rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De/) |
65+
| USDC | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 | [USDC markets](https://www.diadata.org/app/price/asset/Ethereum/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/) |
66+
| USDT | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | [USDT markets](https://www.diadata.org/app/price/asset/Ethereum/0xdAC17F958D2ee523a2206206994597C13D831ec7/) |
67+
68+
69+
## How the Oracle Works
70+
71+
The `oracleUpdater` in the `DIAOracleV2` contract is the gas wallet responsible for pushing the price updates on-chain.
72+
73+
![Screenshot: How Dia Oracle Works](/blog/img/dev-reflections-how-dia-oracle-works.png)
74+
75+
Check out the full audit report [here](https://content.gitbook.com/content/TURK2sDMSvoX6oxbS6WA/blobs/vJuu8yMWLXokC7m3aqKg/02_Smart%20Contract%20Audit_DIA_Oracle_v2.pdf) for the DIAOracleV2 contract.
76+
77+
78+
## How to Access Data
79+
80+
The DIA oracle object can be retrieved with the [ledger_entry API](https://xrpl.org/resources/dev-tools/websocket-api-tool#ledger_entry-oracle) call by specifying the `account` and `oracle_document_id`. You can access the mainnet and testnet accounts [here](https://docs.google.com/document/d/1GGLxcKSYlCP-yxrcP5Gzd8nsm-WzcjNvwWMvvJjXwbw/edit?tab=t.0#heading=h.e29ryp9qtwct).
81+
82+
This is the request JSON for mainnet:
83+
84+
85+
```json
86+
{
87+
"id": "example_get_oracle",
88+
"command": "ledger_entry",
89+
"oracle": {
90+
"account": "rP24Lp7bcUHvEW7T7c8xkxtQKKd9fZyra7",
91+
"oracle_document_id": 42
92+
},
93+
"ledger_index": "validated"
94+
}
95+
```
96+
97+
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.
98+
99+
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.
100+
101+
## Glossary
102+
103+
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).
104+
105+
| Term | Definition |
106+
|:-----------|:------------|
107+
| Deviation | The percentage threshold that triggers a price update when exceeded |
108+
| Refresh frequency | A time interval for checking and updating prices if certain conditions are met |
109+
| Trade window | A time interval used to aggregate trades of an asset for price calculation |
110+
| Heartbeat | A forced price update at a fixed interval |
111+
112+
## Support
113+
114+
You can always reach out to the dedicated DIA support channel on Slack, [Discord](https://discord.gg/ZvGjVY5uvs), or [Telegram](https://t.me/diadata_org). 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](https://discord.gg/sfX3ERAMjH)

blog/sidebars.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- group: '2025'
77
expanded: false
88
items:
9+
- page: 2025/integrating-dia-oracles-on-xrpl.md
910
- page: 2025/vulnerabilitydisclosurereport-bug-apr2025.md
1011
- page: 2025/defi-use-cases-exploring-the-potential.md
1112
- page: 2025/clio-2.4.0.md

0 commit comments

Comments
 (0)