How MagicBlock integrates verifiable randomness
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 EphemeralVrf 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.