Skip to main content

Quick Access

Check out basic randomness example:

GitHub

Repo for roll dice example

VRF dApp

Roll a dice onchain

Delegated VRF dApp

Roll a dice within 100 ms onchain

Step-By-Step Guide

Any Solana program can request and consume verifiable randomness onchain within seconds using the MagicBlock VRF SDK. By the end of this guide, you’ll have a working example that rolls a dice using verifiable randomness.
1
Write your Solana program as you normally.
2
Add CPI hooks that request and consume randomness via callback from a verified oracle.
3
Deploy your Solana program using Anchor CLI.
4
Send transactions to generate and consume randomness onchain.

Roll Dice Example

Roll Dice GIF The following software packages may be required, other versions may also be compatible:

Code Snippets

A simple roll dice program where player initialize state account to store, request and consume randomness:
⬆️ Back to Top

Solana Explorer

Get insights about your transactions and accounts on Solana:

Solana Explorer

Official Solana Explorer

Solscan

Explore Solana Blockchain

Solana RPC Providers

Send transactions and requests through existing RPC providers:

Solana

Free Public Nodes

Helius

Free Shared Nodes

Triton

Dedicated High-Performance Nodes

Solana Validator Dashboard

Find real-time updates on Solana’s validator infrastructure:

Solana Beach

Get Validator Insights

Validators App

Discover Validator Metrics

Server Status Subscriptions

Subscribe to Solana’s and MagicBlock’s server status:

Solana Status

Subscribe to Solana Server Updates

MagicBlock Status

Subscribe to MagicBlock Server Status

MagicBlock Products

Ephemeral Rollup (ER)

Execute real-time, zero-fee transactions securely on Solana.

Private Ephemeral Rollup (PER)

Protect sensitive data with privacy-preserving computation.

Verifiable Randomness Function (VRF)

Generate provably fair randomness directly on-chain.