Pinocchio (no-Anchor) dice rolling program using Ephemeral Rollups and MagicBlock's verifiable random function (VRF) to generate random numbers.
For the Anchor-based variant and frontend demo, see Roll Dice.
The dice account is delegated to the Ephemeral Rollup. On the ER, the program requests randomness from the VRF oracle with a client seed; the oracle fulfills the request by invoking the program's callback instruction with verified random bytes, which become the dice roll.
| Software | Version | Installation Guide |
|---|---|---|
| Solana | 3.1.9 | Install Solana |
| Rust | 1.89.0 | Install Rust |
| Node | 24.10.0 | Install Node |
agave-install init 3.1.9
rustup install 1.89.0Install dependencies and build the program:
yarn
yarn buildThis example runs against a local MagicBlock cluster — a base Solana validator, an Ephemeral Rollup fronted by the Query Filtering Service, and a VRF oracle that fulfills randomness requests. Start it in one terminal and leave it running:
yarn setupyarn setup runs SETUP_ONLY=1 ./scripts/test-locally.sh pinocchio-roll-dice from the repo root: it builds this example, boots the validators and VRF oracle, and holds them until you press a key.
Then, in a second terminal, run this example's tests against that cluster:
yarn test:localtest:local sources scripts/local-env.sh so the SDK targets the local cluster (without it the tests fall back to devnet).
Tip: to build and run every example end-to-end (what CI does), run the repo-root
./scripts/test-locally.shdirectly.