Education · 5 min read

Verifiable Randomness with Pyth Entropy

How Entropy generates on-chain randomness that nobody — including Pyth — can predict or manipulate.

The randomness problem on-chain

Blockchains are deterministic — every node must compute the same result. That makes true randomness impossible from on-chain data alone. Common workarounds like blockhashare manipulable by miners/validators. NFT mints, lotteries, and games need better guarantees.

Why blockhash is unsafe

A miner who sees an unfavorable blockhash result can simply discard their block and mine a new one. The expected cost to manipulate a lottery: approximately (expected profit) / (block reward). For high-value NFT mints, this is economically rational.

How Pyth Entropy works

Pyth Entropy uses a commit-reveal scheme between two parties: the user and the Pyth Fortuna provider. Neither party can know the final random number in advance.

The protocol
1
You: Generate a random number locally. Submit its hash to the Entropy contract on-chain. The contract records your commitment.
2
Fortuna: The Pyth provider sees your commitment and reveals its pre-committed random number (from a hash chain it cannot change retroactively).
3
Contract: XOR your random number with the provider's. The result is verifiably random — neither party could have predicted it alone.

Why neither party can cheat

You can't cheat

Your random number is committed before the provider reveals theirs. You can't change it retroactively — the hash binds you.

Pyth can't cheat

The provider's random numbers come from a pre-published hash chain. They're committed long before any request is made — the provider cannot retroactively change them.

Entropy in this app

The Oracle Challenge uses Pyth Entropy to seed each round. The app reads the current sequence number from the Fortuna provider on Base mainnet — a value that changes with every entropy request made by any user on the network. This is used as a deterministic, verifiable seed to pick which price feed appears in the game round.

Contracts on Base mainnet

Entropy contract0x98046Bd2D8978603
Fortuna provider0x52DeaA1c1c616506

Use cases

NFT mints

Assign traits randomly at mint time — verified fairly on-chain.

Gaming

Loot drops, critical hits, matchmaking — all provably fair.

Lotteries / raffles

No miner manipulation — the random seed is unknowable until reveal.