How it works

Three steps. Verifiable end-to-end.

Axion uses a commit-reveal pattern. The user commits randomness first, the provider reveals second, and the contract derives the final value onchain.

01

Request

Your contract calls requestV2() with a user-generated random value and pays the exact 0.000025 ETH fee. If unrevealed after ~60-90s, requester can refundRequest.

  • Choose a provider and generate a user random bytes32 value.
  • Call axion.requestV2(provider, userRandom, callbackGasLimit) with exactly 0.000025 ETH.
  • The oracle contract records the request and emits a Requested event.
  • If no reveal arrives within the timeout, refundRequest() returns the fee to the caller.
02

Reveal

The Tyche keeper detects the request event and submits the next hash chain value as a reveal in ~1-3 seconds typically.

  • The keeper monitors Requested events from the oracle contract.
  • It submits reveal(provider, sequence, revealValue) onchain.
  • The contract validates that revealValue hashes to the next expected chain link.
  • Reverts protect against invalid or out-of-order reveals.
03

Callback

The contract verifies the reveal, combines it with the user's value and the provider's preimage, then calls your entropyCallback() with the final random number.

  • Verification recomputes Keccak256(userRandom, revealValue, providerPreimage).
  • The resulting bytes32 is passed to your contract's entropyCallback(seq, provider, random).
  • Callback gas is capped by the limit supplied at request time.
  • Your contract can now use the random value for dice rolls, trait selection, or any logic.

Sequence at a glance

  1. User contract requests entropy with a committed random value and the exact fee.
  2. Keeper reveals the next hash-chain value onchain.
  3. Oracle verifies the reveal and calls back with the final bytes32 random value.
  4. Timeout protection lets the requester refund if the keeper fails to reveal.