Oracle
Prices in NeutronX come from the validators themselves. In every block they vote on prices, the network aggregates the votes and records the resulting price. There is no external oracle and no trusted provider.
Where prices come from
Every validator runs an oracle sidecar that collects quotes from several exchanges. The validator signs the prices in the vote extension of its vote for the block. The network does not dictate the sources; it checks the result.
A price cannot be sent in a regular transaction: prices enter the network only through validator votes.
How the price is computed
- Quorum. A pair's price is accepted only if validators with 66% of the stake or more voted for it. Otherwise the pair's price is not updated in this block.
- Stake-weighted median. The final price is the point where the accumulated stake of the votes reaches one half. A validator with more stake weighs more.
- Outliers. A vote more than 5% away from the median is discarded and counts as a violation. Details are in Consensus & validators.
The price used in a block comes from the votes of the previous block.
Where the price is used
The oracle price is the only mark price in the protocol. Margin, liquidations and conditional order triggers are computed from it. It does not set trade prices: trades always execute at the prices of orders in the book.
Safeguards
| Situation | Threshold | What happens |
|---|---|---|
| Stale price | Older than 10 blocks | The market is paused automatically and its liquidations are postponed. Trading resumes on its own once the price is fresh again |
| No votes | 50 blocks without a new price | The circuit breaker trips |
| Price jump | More than 30% from the current price | The circuit breaker trips and the new price is rejected |
| Large move | More than 20% | A warning event only; the price is accepted |
While the circuit breaker is active, the pair's price is not updated and only reduce-only orders and position closes are accepted. It lifts automatically once new prices stay within 30% of each other for 120 blocks in a row.
Governance
Governance can:
- pause a pair and lift the pause;
- lift the circuit breaker early.
While a pair is paused, only reduce-only orders and position closes are accepted, and liquidations on it go through pairing.
This is done with MsgOraclePausePair, MsgOracleResumePair and MsgOracleResetCircuitBreaker.