Skip to main content
For the product overview, see Solana VRF. See the Ephemeral Rollup documentation for an overview of the runtime. MagicBlock exposes randomness as a first-class primitive through the ephemeral_vrf_sdk. Rollup programs call create_request_randomness_ix (the RequestRandomness instruction) with a caller_seed and a callback such as consume_randomness. An oracle from the MagicBlock Solana VRF network then executes the ProvideRandomness instruction to deliver the result. Random numbers are generated via a VRF built on Curve25519’s Ristretto group and proven using a Schnorr-like signature as described in RFC 9381. The proof and output are returned to the rollup with a signed callback from the MagicBlock VRF signer PDA. Your program verifies the caller and then uses the randomness in gameplay logic. Helper utilities like random_u32, random_u8_with_range, and random_bool make it simple to convert the [u8; 32] output into usable values. Because the request and consume steps occur inside the ephemeral execution window, users get real-time results with verifiable fairness and without relying on external servers.

Flow

The flow starts with a “Request for randomness”.
  1. Your program will CPI into the MagicBlock VRF program and append a request to the queue.
  2. Once your randomness request is in the queue, an oracle will release the request and perform the randomness computation.
  3. Upon completion, it returns the result and proof to the MagicBlock VRF program.
  4. After verifying the proof, the VRF program will call back into your program into a predefined function that will “consume” the randomness.
The VRF program has a published audit. Review the report and test thoroughly before integrating it into production rollups.

Oracle queues

Every randomness request names an oracle queue account (the oracle_queue field of RequestRandomnessParams). Like every Solana account, the queue lives on Solana — but a delegated queue is directly writable only from inside an ephemeral rollup, while a non-delegated queue is directly writable on the base layer. Request randomness from the queue that matches where your transaction runs — the base-layer queue from Solana, or the delegated queue from inside the ephemeral rollup. Reference the SDK constants from ephemeral_vrf_sdk::consts instead of hardcoding addresses wherever possible.
NetworkBase-layer queueDelegated queue (ephemeral rollup)
MainnetDEFAULT_QUEUE
Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh
DEFAULT_EPHEMERAL_QUEUE
5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc
DevnetDEFAULT_QUEUE
Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh
DEFAULT_EPHEMERAL_QUEUE
5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc
LocalnetDEFAULT_TEST_QUEUE
GKE6d7iv8kCBrsxr78W3xVdjGLLLJnxsGiuzrsZCGEvb
DEFAULT_EPHEMERAL_TEST_QUEUE
Sc9MJUngNbQXSXGP3F67KvKwVnhaYn6kcioxXNVowYT
Mainnet and Devnet share the same default queue addresses — only the cluster you connect to differs. Localnet uses dedicated test queues that the local validator clones from Devnet; the DEFAULT_TEST_QUEUE / DEFAULT_EPHEMERAL_TEST_QUEUE constants ship with the VRF SDK.

Quickstart

Follow the Solana VRF setup guide.

Open Source VRF

Inspect the open-source VRF program and examples on GitHub.