Skip to content

Oracle

[Source]

(Added by the PriceOracle amendment.)

An Oracle ledger object represents a Price Oracle created by an account on the Xahau ledger. It stores one or more asset price data points and is identified by the owner account together with a document ID. Oracle objects are created and updated via OracleSet transactions and deleted via OracleDelete transactions.

{
"LedgerEntryType": "Oracle",
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"OracleDocumentID": 1,
"Provider": "70726F7669646572",
"AssetClass": "63757272656E6379",
"LastUpdateTime": 816348759,
"PriceDataSeries": [
{
"PriceData": {
"BaseAsset": "XAH",
"QuoteAsset": "USD",
"AssetPrice": 74560,
"Scale": 4
}
},
{
"PriceData": {
"BaseAsset": "BTC",
"QuoteAsset": "USD",
"AssetPrice": 6800000,
"Scale": 2
}
}
],
"URI": "697066733A2F2F",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "5463C6E08862A1FAE5EDAC12D70ADB16546A1F674930521295BC082494B62924",
"PreviousTxnLgrSeq": 6,
"index": "49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0"
}

An Oracle object has the following fields:

FieldJSON TypeInternal TypeRequired?Description
OwnerStringAccountIDYesThe account that created and owns this Oracle. Only this account can update or delete it.
OracleDocumentIDNumberUInt32YesThe unique identifier for this Oracle within the owner account.
ProviderStringBlobYesHex-encoded identifier of the data provider (e.g. the oracle service name). Max 256 bytes.
AssetClassStringBlobYesHex-encoded string describing the category of assets (e.g. 63757272656E6379 = “currency”). Max 16 bytes.
LastUpdateTimeNumberUInt32YesRipple Epoch timestamp (seconds since January 1, 2000) of the last price update.
PriceDataSeriesArrayArrayYesArray of PriceData objects (1–10 entries). Entries are stored in canonical sorted order by BaseAsset/QuoteAsset pair.
URIStringBlobNoHex-encoded URI pointing to supplementary off-chain data (e.g. an IPFS CID). Max 256 bytes.
OwnerNodeStringUInt64YesA hint indicating which page of the owner’s directory links to this object.
PreviousTxnIDStringHash256YesThe identifying hash of the transaction that most recently modified this object.
PreviousTxnLgrSeqNumberUInt32YesThe ledger index of the ledger that contains the transaction that most recently modified this object.
LedgerEntryTypeStringUInt16YesThe value 0x0080, mapped to the string Oracle, indicates this is an Oracle object.

Each entry in PriceDataSeries contains a PriceData object:

FieldJSON TypeInternal TypeRequired?Description
BaseAssetStringCurrencyYesThe asset being priced (e.g. "XAH", "BTC").
QuoteAssetStringCurrencyYesThe denomination currency (e.g. "USD", "EUR").
AssetPriceNumberUInt64NoThe price as a scaled integer. The effective price is AssetPrice × 10^(-Scale).
ScaleNumberUInt8NoDecimal exponent (0–10) used to derive the effective price. Example: AssetPrice = 74560, Scale = 4 → effective price = 7.456.

An Oracle object consumes owner reserves based on the number of PriceData pairs stored:

PairsOwner reserves consumed
1–51
6–102

The ID of an Oracle object is the SHA-512Half of the following values, concatenated in order:

  • The Oracle space key (0x0152)
  • The AccountID of the Owner
  • The OracleDocumentID as a 32-bit unsigned integer