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.
CoinGecko
Reporter 1
CoinPaprika
Reporter 2
Binance
Reporter 3
OracleStaking
stake()
unstake()
slash()
PriceOracle
submitPrice()
getPrice()
getTWAP()
broadcastPrice()
RustMedian
median() (RISC-V)
staticcall
1,829 gas
Parachain A
XcmPriceReceiver
Parachain B
XcmPriceReceiver
Parachain C
XcmPriceReceiver
- Staking: Reporters must maintain a minimum PAS stake in the
OracleStaking.solcontract. - Aggregation: The
PriceOracle.solcontract 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) viastaticcall, 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 Name | Polkadot Hub Testnet (Paseo) |
| Chain ID | 420420417 |
| RPC URL | https://eth-rpc-testnet.polkadot.io/ |
| Native Token | PAS |
Contract Addresses
| Contract | Address | Explorer |
|---|---|---|
| PriceOracle | 0xaf781298fE769738eF529816c11C121Ea8887Fc9 | Blockscout |
| OracleStaking | 0xd2A807a574CAEa31e6DA7102feA1b2071A6a3321 | Blockscout |
| OracleConsumer | 0xa442FAdAa070fB1C89d0dBFBfa0B488110E25146 | Blockscout |
| RustMedian (PVM) | 0x454d0fB0BBB30c08f05e2DfEF94E0fe106eDFADA | Blockscout |
| XcmPriceReceiver | 0xad81ed5a1e0c8Ea28E8a52Fee6aC1D51131DD0cB | Moonscan |
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