XChain Platform Action - PRICE
This action publishes oracle price data on-chain. PRICE has two versions. Version 0 is the validator batch: one transaction per publishing window (split at the boundary where the window straddles an oracle flag day; see Straddle Rule) carries the full body of every PBFT-finalized COIN/FIAT round in that window under a single quorum signature set. The rounds are produced by validators qualifying for the price capability, and the batch is broadcast on-chain by a validator qualifying for the oracle_publish capability (both capabilities are auto-qualified by aggregate stake amount per the capability model; see STAKE). Version 1 is permissionless: any address may operate a user-run TOKEN/FIAT price oracle, no stake required. Any other version value is recorded invalid: VERSION (unknown).
PARAMS
Version 1: User Oracle TOKEN/FIAT Price
| Name | Type | Description |
|---|---|---|
VERSION |
String | Format version (1) |
COIN |
String | Chain identifier for the token (e.g. BTC, LTC, DOGE) |
TICK |
String | Token name (e.g. PEPECASH) |
FIAT |
String | Fiat currency code (e.g. USD, JPY, EUR) |
VALUE |
String | Price as decimal string, 8 decimal places |
FEE |
String | Oracle usage fee as decimal (e.g. 0.01 = 1%) |
MEMO |
String | Optional description or timestamp |
Version 0: Validator COIN/FIAT Price Rounds (batched)
A whole finalized round (ROUND, TIMESTAMP, ANCHOR_HEIGHT, its own PAIR_ID/PAIR_PRICE list) repeats ROUND_COUNT times in the wire payload, once per round the batch carries. PUBKEY and SIG repeat SIG_COUNT times, but only once for the whole batch, not once per round. See the Formats section below for the exact wire layout, including the compressed form.
| Name | Type | Description |
|---|---|---|
VERSION |
String | Format version (0) |
FIRST_ROUND |
Integer | The lowest oracle round number carried in this batch, or the literal Z marking the compressed wire form (see Formats) |
LAST_ROUND |
Integer | The highest oracle round number carried in this batch; paired with FIRST_ROUND as the batch’s EQUIV round id |
BTC_BLOCK_HEIGHT |
Integer | The batch anchor: numerically equal to the ANCHOR_HEIGHT of the last included round, duplicated here so the flag-day and equivocation gates can resolve before the round loop is parsed |
ROUND_COUNT |
Integer | Number of rounds carried by this batch, 1 to 256 |
ROUND |
Integer | A carried round’s own oracle round number (repeated per round) |
TIMESTAMP |
Integer | That round’s own block_time of the BTC block that triggered it, seconds (repeated per round) |
ANCHOR_HEIGHT |
Integer | That round’s OWN BTC anchor height, distinct from BTC_BLOCK_HEIGHT above (repeated per round; see Rules for why it is kept) |
PAIR_COUNT |
Integer | Number of COIN/FIAT price pairs in that round (repeated per round) |
PAIR_ID |
String | COIN/FIAT pair identifier for that round, e.g. BTC/USD (repeated per pair, per round) |
PAIR_PRICE |
String | Price as decimal string, 8 decimal places (repeated per pair, per round) |
SIG_COUNT |
Integer | Number of price-capable validator signatures over the WHOLE batch |
PUBKEY |
String | 64-char hex Ed25519 signing pubkey (repeated per signature) |
SIG |
String | 128-char hex Ed25519 signature over the batch canonical (repeated per signature) |
Formats
Version 1: User Oracle TOKEN/FIAT Price
VERSION|COIN|TICK|FIAT|VALUE|FEE|MEMO
Version 0: Validator COIN/FIAT Price Rounds (batched)
VERSION|FIRST_ROUND|LAST_ROUND|BTC_BLOCK_HEIGHT|ROUND_COUNT|ROUND|TIMESTAMP|ANCHOR_HEIGHT|PAIR_COUNT|PAIR_ID|PAIR_PRICE|...|SIG_COUNT|PUBKEY|SIG|...
The ROUND|TIMESTAMP|ANCHOR_HEIGHT|PAIR_COUNT|PAIR_ID|PAIR_PRICE|... group repeats ROUND_COUNT times, once per carried round; each round’s own pair data (PAIR_ID|PAIR_PRICE) repeats PAIR_COUNT times within that group. Signature data (PUBKEY|SIG) repeats SIG_COUNT times, once for the whole batch, after every round group.
A batch may also travel compressed:
VERSION|Z|BASE64_DEFLATE
Z sits in the slot FIRST_ROUND occupies in the uncompressed form. FIRST_ROUND is always a decimal integer and Z never is, so a parser tells the two wire forms apart by looking at that one field, with no lookahead into anything after it. BASE64_DEFLATE is zlib.deflateRaw of the exact byte string of the uncompressed body (everything after PRICE|0|), encoded with the standard base64 alphabet and canonical padding. Decompression happens before every other check: once inflated and parsed, a compressed wire is validated exactly like an uncompressed one, so the two forms cannot diverge in what they accept. See Rules for the compression bounds and exactly what gets signed.
BTC_BLOCK_HEIGHT is the batch anchor: numerically equal to the ANCHOR_HEIGHT of the last included round, and it is the flag-day and EQUIV anchor for the whole batch, resolved before any round is parsed. Each round’s own ANCHOR_HEIGHT is not redundant with it; see Rules.
Examples
PRICE|0|1402|1403|850016|2|1402|1712500000|850010|2|BTC/USD|100000.12345678|DOGE/USD|0.15000000|1403|1712500600|850016|2|BTC/USD|100050.00000000|DOGE/USD|0.15100000|3|aabb...01|ccdd...sig1|aabb...02|ccdd...sig2|aabb...03|ccdd...sig3
A batch covering oracle rounds 1402-1403 (production windows typically carry six), batch-anchored at BTC height 850016 (the last round's own anchor height); round 1402 carries its own anchor 850010 and round 1403 carries 850016, each with its own pair set, signed once by 3 price-capable validators over the whole batch
PRICE|0|Z|XY07DsJAEENvNNizn6SGoJQUJAfIR0LUtD48YjdEAXfzLL9hhIsRQW0CmFUuFxt6wie1gFzn4XIa751YuNFDTLlp1d36aylgrBtU5SbJX0n+kyQYtvxK6gcFTdM8mxmoZVlXM3s9H9ypH6jvNBxoeAM=
The same batch, deflate-compressed and base64-encoded; the publisher emits whichever wire form comes out smaller for a given window
PRICE|0|1402|1402|850010|1|1402|1712500000|850010|6|BTC/USD|100000.12345678|BTC/EUR|92000.00000000|LTC/USD|85.50000000|LTC/EUR|78.50000000|DOGE/USD|0.15000000|DOGE/EUR|0.14000000|5|aa...01|cc...s1|aa...02|cc...s2|aa...03|cc...s3|aa...04|cc...s4|aa...05|cc...s5
A one-round batch with a multi-FIAT round (round 1402, BTC anchor block 850010): 3 coins × 2 fiat currencies = 6 pairs, signed by 5 validators
PRICE|1|BTC|PEPECASH|USD|0.05000000|0.01|hourly update
User oracle publishes PEPECASH price on BTC chain at $0.05 USD with 1% usage fee
PRICE|1|BTC|PEPECASH|JPY|7.50000000|0.02|
User oracle publishes PEPECASH price in JPY with 2% usage fee
Rules
Version 1: User Oracle TOKEN/FIAT Price
Chain
- Publishable on any supported chain (BTC, LTC, DOGE)
- DOGE recommended for low-cost frequent updates
Publisher
- Any address may publish PRICE v1. No staking requirement
- The
SOURCEaddress becomes the oracle identity - Dispensers reference the oracle by
SOURCEaddress
COIN Field
- Identifies which chain’s token the price is for
- A DOGE transaction can publish a price for a BTC token (cross-chain oracle)
- Dispensers on any chain may reference any oracle regardless of publishing chain
VALUE and FEE Canonical Form
- From
PRICE_V1_CANONICAL_ACTIVATION, keyed on the action’s ownblock_time, the canonical checks below run after the unchanged legacy checks. The gate is armed on BTC, LTC and DOGE testnet, inert on mainnet until the operator arms it, and genesis-active on regtest; Protocol Activation names the registry row that holds its testnet instant, and Flag-Day Values lists its mainnet instant once one is set. VALUEmust have no leading zero: its integer part is0or starts with a nonzero digit, followed by an optional point and 1 to 8 decimal digits, the same pattern asPRICE_VALUE_RE_CANONICAL. It must also be at most 19 characters (PRICE_V1_VALUE_MAX_LENGTH), or the action isinvalid: VALUE (format).- The 19-character
VALUElimit is the grammar bound: 10 integer digits below the hub’s exclusive price ceiling, a point, and 8 decimal digits. FEE, when present, must have no leading zero: its integer part is0or starts with a nonzero digit, followed by an optional point and 1 to 18 decimal digits. It must also be at most 20 characters (PRICE_V1_FEE_MAX_LENGTH), or the action isinvalid: FEE (format).- The 20-character
FEElimit is the grammar bound: an integer part of0or1, a point, and 18 decimal digits. - Below the gate, only the legacy checks apply.
VALUEis digits with an optional point and 1 to 8 decimal digits and must be above zero.FEEis digits with an optional point and 1 to 18 decimal digits and must be within 0 to 1. A zero-padded value of any length is valid.
Price Lock Window
- Every PRICE v1 broadcast for a
(SOURCE, COIN, TICK, FIAT)combination (the first one included) takes effect 86400 seconds (24 hours) afterblock_time - For updates, the delay prevents oracle front-running attacks on dispensers: without it, an oracle operator could see an incoming dispenser payment and rush a price update to manipulate the exchange rate
- For first publishes, the delay is a consensus requirement: an immediately-effective first publish would be retroactively effective, its
effective_at(the action’sblock_time) precedes the moment the price can exist in any indexer’s hub-DB mirror (source-chain indexing lag plus propagation). A FIAT dispense settled in that window would settle differently on replay, forking the ledger. The uniform delay guarantees every operator holds the row long before any block can read it - 24-hour delay matches the
FIAT_DISPENSER_PRICE_WINDOW; any payment that enters the mempool before a price update will settle at the old price before the new one activates - User TOKEN/FIAT oracles target illiquid markets where prices change infrequently, so the 24-hour delay (including the one-time onboarding delay for a new oracle) is not a practical limitation
- Enforced by the
effective_atcolumn on the hub’soracle_pricestable
FIAT Dispenser Reverse Price Matching
- When a FIAT dispenser referencing a user oracle receives a payment, the system reverse-matches the payment amount against historical oracle prices within a 24-hour window (86400 seconds) before the payment’s
block_time - Cross-conversion combines the user oracle (TOKEN/FIAT) with the validator oracle (COIN/FIAT) for the same currency:
- User oracle: 1 PEPECASH = ¥7.50 JPY
- Validator oracle: 1 BTC = ¥15,000,000 JPY
- Buyer pays 0.001 BTC → receives
floor((0.001 × 15000000) / 7.50)= 2000 PEPECASH
- See
DISPENSERdocumentation for full reverse price matching details and examples
FEE Field
- Decimal value representing the oracle usage fee percentage
0.01= 1%,0.05= 5%, etc.- Dispensers that reference this oracle pay the fee to the oracle
SOURCEaddress. The charge lands once, up front, on the address opening (or refilling) the dispenser - not on buyers per dispense - and is paid as a real native-coin output in theDISPENSERtransaction itself:
oracle_fee = FEE x (oracle_price x GIVE_ESCROW) / validator_coin_price
which is FEE percent of the coin the whole escrow is projected to earn. A DISPENSER naming an ORACLE_ADDRESS is invalid without that output, or with one below the amount, so compose it with the quote endpoint rather than by hand:
GET /{COIN}/api/oraclefeequote?oracleAddress=..&giveTick=..&fiatCode=USD&giveEscrow=..
→ { requiredFeeNative, requiredFeeSats, belowDust } (SDK: explorer.getOracleFeeQuote())
The indexer computes that quote from the same code path it validates against, so an output sized from it is accepted. No output is required when FEE is 0 (the common case) or when the computed fee falls below the chain’s dust threshold. A refill is charged on the escrow it adds, not on the whole balance.
The referenced oracle must already have an effective price, which means published at least 24 hours earlier (see the effective-time rule above). A dispenser pointing at an oracle with no effective price is rejected.
The paying DISPENSER must name the oracle by its full address, not a ^<id> reference: the fee output is recognized by reading ORACLE_ADDRESS out of that transaction’s payload, and an id reference cannot be resolved there. On mainnet the output is recognized from the coordinated contract-era flag day onward, so a fee-charging oracle earns nothing from dispensers created before that instant (their creates are rejected); testnet and regtest recognize it from genesis.
BETmarkets do not usePRICEoracles. A betting market’s oracle is the address that created the market, and itsFEEis a percent of that market’s own pot
Version 0: Validator COIN/FIAT Price Rounds (batched)
Chain & Publisher
- Publishable on BTC, LTC and DOGE; DOGE is recommended for its low fees
- Broadcast by an
oracle_publish-capable validator (see Staking gate below). One transaction carries a whole window of rounds rather than one transaction per round, so the publisher pays one fee per window
Two Wire Forms, Told Apart With No Lookahead
- A batch travels either uncompressed or deflate-compressed with a
Zmarker (see Formats above for the exact layout of both) - The
Zmarker sits in the slotFIRST_ROUNDoccupies in the uncompressed form.FIRST_ROUNDis always a decimal integer andZnever is, so a parser distinguishes the two forms from that single field, immediately afterVERSION, with no lookahead into the rest of the payload - A
Z-marked action is base64-decoded andinflateRaw-decompressed before anything else runs; a decode failure, non-canonical base64, or a bound breach (see Compression Bounds below) invalidates the action outright and never falls back to reading the raw bytes as an uncompressed body - Once decompressed, a
Z-marked batch is validated exactly like an uncompressed one; the two forms cannot diverge in what they accept
Round Window & Per-Round Anchors
FIRST_ROUNDandLAST_ROUNDare the closed round-number window this action carries; they need not be six rounds wide, and validation does not assume any particular window sizeBTC_BLOCK_HEIGHTis the batch anchor and is numerically equal to theANCHOR_HEIGHTof the last included round, duplicated in the header so the flag-day and equivocation gates can resolve before the round loop is parsedROUND_COUNTis bounded at 256. The bound is checked before the round-parsing loop runs, not after, so an attacker-supplied count cannot be used to spin the parser indefinitely; the wire’s own byte ceiling already makes a batch anywhere near that size physically impossible, so the bound is a defensive floor under the parser rather than a realistic operating limit- Each carried round keeps its own
ANCHOR_HEIGHT, and this is deliberate rather than redundant with the batch anchor. Three separate consumers read a round’s own anchor rather than the batch’s: the VM’s causality cap on what a contract may read as of a given block, the rollback path that deletes rows by the anchor they were written under, and the hub’s resolution of which capability snapshot a round’s signers are checked against. Collapsing every round in a batch onto one anchor would move every round’s visibility to the VM and re-verify the earlier rounds in the batch against a capability snapshot they were never signed under
One Signature Set Over the Whole Batch
- A batch carries exactly one signature set, covering every round in the batch, produced by a dedicated post-window signing round rather than by PBFT prepare/commit (which only ever produces per-round signatures)
- What is signed is the canonical JSON
{first_round, last_round, btc_block_height, rounds}, whereroundsis the sorted array of per-round objects (round, timestamp, btc_block_height, pairs), each shaped exactly like a per-round canonical and EQUIV-wrapped as described under Equivocation Tag below - Compression never changes what is signed. A validator signs the canonical JSON of the uncompressed body; compression is applied strictly after signing, purely as a transport optimization, and is stripped back out before a verifier checks a signature. No validator ever signs compressed bytes, and the deflate implementation is not required to be reproducible across zlib versions: only inflation (decompression) needs to be deterministic, because that is the only direction consensus depends on
- The qualified signers must meet the
pricequorum, resolved the same way the per-round canonical resolves it (count-or-stake, keyed on the batch anchor) but evaluated once for the whole batch rather than once per round
Equivocation Tag
- A batch canonical is wrapped with a distinct EQUIV engine tag,
XORACLEB, rather than theXORACLEtag the per-round canonical uses. The round id for that tag is<anchor>|<first_round>|<last_round>, not a bare round number - A distinct tag is required, not optional. The equivocation judge reads a signed content’s
roundfield to compare two things a pubkey signed at one anchor; a batch canonical has noroundfield (it hasfirst_round/last_roundinstead), and reusingXORACLEfor it would either break that read or manufacture a false equivocation between an honest per-round signature and an honest batch signature by the same validator at the same anchor. The window (first_round|last_round) inside the round id also keeps two different, equally honest batch splits at one anchor from colliding on the same equivocation key
Compression Bounds (checked before the inflate buffer grows)
- The inflated size of a
Z-marked batch is checked against two consensus caps, and both are enforced with a bounded output limit on the decompressor itself, so an oversized or maliciously crafted payload is refused before the buffer is allowed to grow rather than being decompressed first and measured after - A payload whose inflated size would exceed a fixed maximum inflate-to-compressed ratio, or whose inflated size would exceed the same wire byte ceiling the uncompressed form is held to, is invalid on every node
- Base64 must be strictly canonical: non-canonical padding or any character outside the standard alphabet is invalid, so a given batch has exactly one valid wire encoding, not several byte-equivalent ones
- A batch that would deflate larger than its own uncompressed body is published uncompressed; compression is an optimization the publisher applies only when it actually shrinks the wire
Straddle Rule
- The per-round canonical resolves its sig-tally and stake-weighted-quorum flag days, and its mirror admission era, on each round’s own anchor. A batch resolves them once, on the batch anchor, so a window whose rounds straddle one of those flag days would otherwise have its earlier rounds judged under the later rule
- Therefore: a batch whose FIRST round’s anchor and LAST round’s anchor fall on opposite sides of any armed oracle flag day is invalid. A publisher must split its window at the boundary rather than assemble a straddling batch. This keeps one signed action resolved under one consistent rule set, without inventing a way to resolve a flag day separately for each round inside a single signature
Activation
- The batch format has no activation gate of its own: a canonically framed batch is valid on its own merits
- Later validity tightenings on the batch wire each carry their own flag day, so replay keeps the verdict older nodes gave a historical wire: the trailing-data refusal on a compressed wire (
PRICE_WIRE_TRAILING_ACTIVATION, keyed on the carrying chain’s block) and the strict field-count check (the mirror admission era,MIRROR_ADMISSION_ACTIVATION, keyed on the batch anchor). Activation Catalogue lists both, and Flag-Day Values lists each mainnet instant once one is set - A
VERSIONother than0or1,2included, is recordedinvalid: VERSION (unknown)
Staking gate for oracle_publish
PRICE v0 publishers are auto-qualified by the capability model. No special “Tier 3 STAKE” exists. A pubkey gets the oracle_publish capability iff its aggregate active stake ≥ min_stake[oracle_publish] (governance-configurable). Same model applies to the price capability used by signers; a single pubkey can hold both capabilities simultaneously.
| Property | Value |
|---|---|
| Capability | oracle_publish |
| Role | Broadcasts PRICE v0 batches of finalized rounds on-chain |
| Stake gate | SUM(amount) across the pubkey’s active stake rows ≥ min_stake[oracle_publish] (governance default; see hub ProviderRegistry / capability config) |
| Chain | STAKE happens on BTC; PRICE v0 can be published on any chain (DOGE recommended for fees) |
| Overlap | Allowed: same pubkey may hold both price and oracle_publish. No oracle round reward is minted today (see COLLECT → Reward Population Path); the claimable reward tied to oracle_publish is the ANCHOR publisher reward (anchor_bundle) |
| Cooldown | Configurable, default 1000 blocks |
| Activation delay | 6 BTC blocks (~1 hour) |
To become an oracle_publish publisher, stake against a pubkey using the standard STAKE action:
STAKE|1|<AMOUNT>|<SIGNING_PUBKEY> # new stake
STAKE|2|<AMOUNT>|<SIGNING_PUBKEY> # top-up of existing pubkey
See STAKE.md for the full action spec.
Publishing-chain wallet (e.g. the DOGE wallet for broadcasting PRICE v0 to DOGE) is operator-side configuration on the hub; it is not recorded on-chain. Each oracle_publish-capable validator chooses its own publishing-chain address; the protocol simply verifies that the broadcasting SOURCE address owns a stake against a pubkey with the capability at the publishing BLOCK_INDEX.
Architecture
Data Flow: Validator Prices (v0)
This mirrors the PRICE Oracle Data Flow diagram in architecture/Data_Pipeline.md, with the extra detail specific to v0.
flowchart TD
FETCH["price-capable validators fetch prices from<br>CoinGecko, Kraken and Coinbase (keyless, always active),<br>plus CoinMarketCap if a key is configured"]
PBFT["PBFT consensus<br>(2/3+ agree on prices per BTC block)"]
SIGN["Each validator signs the per-round<br>canonical during prepare/commit"]
BATCHSIGN["After the window closes, a batch-signing round<br>collects one signature set over every round in it"]
PUBLISH["An oracle_publish-capable validator writes<br>one PRICE v0 batch (optionally compressed)<br>to a chain (DOGE recommended)"]
DECODE["That chain's decoder picks up the action"]
VALIDATE["That chain's indexer validates the batch signature set<br>and writes each carried round to its local prices table"]
PUSH["Indexer pushes the validated rounds to hub"]
DEDUPE["Hub deduplicates by round_number,<br>writes to unified price_snapshots table"]
BROADCAST["Hub broadcasts new row to all connected<br>indexers' local hub DB copies"]
FETCH --> PBFT --> SIGN --> BATCHSIGN --> PUBLISH --> DECODE --> VALIDATE --> PUSH --> DEDUPE --> BROADCAST
Data Flow: User Oracle Prices (v1)
flowchart TD
BCAST["User broadcasts PRICE v1 on any chain"]
DECODE2["Chain's decoder extracts PRICE action"]
VALIDATE2["Chain's indexer validates fields<br>and writes to local prices table"]
PUSH2["Indexer pushes to hub oracle_prices table"]
LOCK["Hub applies the uniform 24-hour lock window<br>(every publish effective at block_time + 86400)"]
BROADCAST2["Hub broadcasts new row to all connected<br>indexers' local hub DB copies"]
QUERY["All indexers query their local hub DB for<br>oracle data (no hub round-trip during<br>block processing)"]
BCAST --> DECODE2 --> VALIDATE2 --> PUSH2 --> LOCK --> BROADCAST2 --> QUERY
Three-Database Model
Each indexer maintains three database connections:
| Database | Connection | Owner | Contains |
|---|---|---|---|
| Decoder DB | Read | Decoder | Raw blockchain data, decoded txs |
| Indexer DB | Read/Write | Indexer | Chain-specific indexed state: actions, balances, tokens, plus the local prices action log |
| Hub DB (local) | Read | Hub (synced via WebSocket) | Cross-chain infrastructure: price_snapshots, oracle_prices, cross-chain settlement and federation-state tables |
The indexer’s prices table is the raw on-chain action log (one row per PRICE tx). The hub’s price_snapshots and oracle_prices tables are the deduplicated, cross-chain aggregated views that indexers actually query for price lookups.
DOGE Chain Role
- DOGE is the recommended publishing chain for PRICE v0 due to lowest tx fees
- However the protocol allows publishing on any supported chain:
source_chainis recorded in the hub’sprice_snapshotsfor audit - Indexers do not need to run a DOGE node; they get prices from their local hub DB copy
- A new node syncing from genesis can reconstruct full oracle history from any chain that carried PRICE v0 transactions
Determinism Guarantee
- Two independent nodes reading the same blockchains and running the same validator set arrive at identical price state
- Validator prices are anchored on-chain with full PBFT cryptographic proof (publishable on any chain)
- User oracle prices are on-chain on their publishing chain
- Hub aggregates
price_snapshotsandoracle_pricesfrom all chains, single source of truth - Indexers query their local hub DB copy. No hub round-trip during block processing
- No off-chain data is required to reconstruct the complete oracle history
Notes
- This action replaces the oracle functionality previously available via
BROADCASTversion 1 - Validator price snapshots include all 12 supported FIAT currencies per coin, enabling cross-currency dispenser pricing without double-conversion
- The reverse price matching mechanism for FIAT dispensers is documented in the
DISPENSERaction specification PRICEcan coexist withBROADCAST, existing BROADCAST oracles continue to function
Copyright © 2025–2026 Dankest, LLC
Based on XChain Platform by Dankest, LLC – https://dankest.llc
Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later) with a commercial license available for proprietary use.
You may use, modify, and distribute this material under the terms of the License. See LICENSE and NOTICE for full terms. See the licensing overview.