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

- Your program will CPI into the MagicBlock VRF program and append a request to the queue.
- Once your randomness request is in the queue, an oracle will release the request and perform the randomness computation.
- Upon completion, it returns the result and proof to the MagicBlock VRF program.
- 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 (theoracle_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.
| Network | Base-layer queue | Delegated queue (ephemeral rollup) |
|---|---|---|
| Mainnet | DEFAULT_QUEUECuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh | DEFAULT_EPHEMERAL_QUEUE5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc |
| Devnet | DEFAULT_QUEUECuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh | DEFAULT_EPHEMERAL_QUEUE5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc |
| Localnet | DEFAULT_TEST_QUEUEGKE6d7iv8kCBrsxr78W3xVdjGLLLJnxsGiuzrsZCGEvb | DEFAULT_EPHEMERAL_TEST_QUEUESc9MJUngNbQXSXGP3F67KvKwVnhaYn6kcioxXNVowYT |
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.

