Skip to main content
The VRF Rewards example mints random rewards for a delegated account on an Ephemeral Rollup. The program requests randomness on the ER, the VRF oracle fulfills it by invoking the program’s callback with verified random bytes, the program derives the reward from those bytes, and the state commits back to the base layer.

View Repository

Build, test, and run the Anchor program and client.

Solana VRF

How verifiable randomness works on MagicBlock.

What the example demonstrates

  • VRF on a delegated account: the reward account lives on the ER, so randomness requests and reward minting run at rollup speed.
  • Oracle callback pattern: the program exposes a callback instruction that only the VRF oracle can fulfill, receiving verified random bytes on-chain.
  • Randomness-derived state: reward selection happens deterministically from the verified bytes — no off-chain draw to trust.
  • Commit-back settlement: the final reward state is committed from the ER back to Solana, ready for base-layer payouts.

VRF Quickstart

Request and consume randomness in your own program.

Ephemeral Rollups

The delegation and commit lifecycle behind the example.

SPL Token Custody

Pay rewards out in SPL tokens — ER custody or post-commit payouts.

Magic Actions

Trigger base-layer follow-ups atomically when the commit lands.