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 callback into your program into a predefined function that will “consume” the randomness.
MagicBlock’s VRF Program is open-source and audited. See the Solana VRF overview for the product summary.
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.Audit
Read the full audit report
Quickstart
Learn how to add randomness capabilities

