Overview

Introduction to PolkaOracle

PolkaOracle is a native, decentralized price oracle built exclusively for the Polkadot Hub. By leveraging the blazing-fast execution speeds of the Polkadot Virtual Machine (PVM) and Cross-Consensus Messaging (XCM), PolkaOracle delivers secure, high-frequency data feeds to any parachain within the ecosystem.


Architecture Overview

The system relies on a network of decentralized reporters who stake tokens to participate. Reporters fetch off-chain asset prices from multiple exchanges, sign the pricing data, and submit it directly to our core smart contracts deployed on the Polkadot Hub.

Off-Chain

CoinGecko

Reporter 1

CoinPaprika

Reporter 2

Binance

Reporter 3

submitPrice()
Polkadot Hub (PVM)

OracleStaking

stake()

unstake()

slash()

◄──►

PriceOracle

submitPrice()

getPrice()

getTWAP()

broadcastPrice()

──►

RustMedian

median() (RISC-V)

staticcall

1,829 gas

XCM Precompile
Destination Parachains

Parachain A

XcmPriceReceiver

Parachain B

XcmPriceReceiver

Parachain C

XcmPriceReceiver

  • Staking: Reporters must maintain a minimum PAS stake in the OracleStaking.sol contract.
  • Aggregation: The PriceOracle.sol contract computes the median of all received reports within a time window. The median calculation is delegated to a Rust contract compiled to PolkaVM (RISC-V) via staticcall, with automatic Solidity fallback if the Rust call fails.
  • XCM Distribution: Instead of requiring parachains to query the oracle constantly, we utilize XCM precompiles to push price updates natively across the relay chain.

Supported Feeds & Encoding

Currently, the testnet deployment supports DOT/USD, BTC/USD, and ETH/USD.

Price Encoding (8 Decimals)

All prices returned by the oracle are scaled by 1e8 (8 decimal places).
For example, a returned value of 800000000 equals $8.00.

Network Configuration

Network NamePolkadot Hub Testnet (Paseo)
Chain ID420420417
RPC URLhttps://eth-rpc-testnet.polkadot.io/
Native TokenPAS

Contract Addresses

ContractAddressExplorer
PriceOracle0xaf781298fE769738eF529816c11C121Ea8887Fc9Blockscout
OracleStaking0xd2A807a574CAEa31e6DA7102feA1b2071A6a3321Blockscout
OracleConsumer0xa442FAdAa070fB1C89d0dBFBfa0B488110E25146Blockscout
RustMedian (PVM)0x454d0fB0BBB30c08f05e2DfEF94E0fe106eDFADABlockscout
XcmPriceReceiver0xad81ed5a1e0c8Ea28E8a52Fee6aC1D51131DD0cBMoonscan

Key Parameters

  • minStake: 10 PAS
  • slashPercent: 50% — reporters deviating from median lose half their stake
  • submissionWindow: 5 minutes
  • maxDeviation: 10% (1000 bps) — wider 50% band for stale recovery
  • maxPriceAge: 60 minutes before a price is considered stale
  • minSubmissions: 3 — requires all reporters to agree
  • rustMedian: Enabled — median computed via Rust/RISC-V contract with Solidity fallback