#solana #vrf #ed25519

orao-solana-vrf

ORAO Verifiable Random Function for Solana

15 unstable releases (5 breaking)

new 0.6.0 Mar 22, 2025
0.4.0 Jun 10, 2024
0.2.5 Jan 6, 2024
0.2.4 Jan 18, 2023
0.2.1 Jul 28, 2022

#5 in #vrf

Download history 122/week @ 2024-11-30 221/week @ 2024-12-07 192/week @ 2024-12-14 87/week @ 2024-12-21 17/week @ 2024-12-28 170/week @ 2025-01-04 446/week @ 2025-01-11 243/week @ 2025-01-18 127/week @ 2025-01-25 192/week @ 2025-02-01 286/week @ 2025-02-08 156/week @ 2025-02-15 273/week @ 2025-02-22 154/week @ 2025-03-01 225/week @ 2025-03-08 407/week @ 2025-03-15

1,064 downloads per month

Apache-2.0

72KB
1K SLoC

VRF v2 Rust SDK with Anchor

Crate to interact with orao-vrf smart contract on Solana network.

Provides interface to request for a verifiable randomness (Ed25519 Signature) on the Solana network.

API-Docs

Usage example - Rust Native

Please look at the off-chain example.

Cross-Program-Invocation (CPI) example

Browse through the cpi for more info.


lib.rs:

ORAO VRF

Crate to interact with orao-vrf smart contract on Solana network.

Provides an interface to request verifiable randomness (Ed25519 Signature) on the Solana network.

Documentation

Please look into the following functions and structures:

Cross Program Invocation

For CPI please look into the cpi example and account requirements for the Request instruction.

Note: requires cpi feature to be enabled and sdk feature to be disabled.

// assuming ctx to be a context of an instruction that performs CPI
let vrf_program = ctx.accounts.vrf.to_account_info();
let request_accounts = orao_solana_vrf::cpi::accounts::Request {
    payer: ctx.accounts.player.to_account_info(),
    network_state: ctx.accounts.config.to_account_info(),
    treasury: ctx.accounts.treasury.to_account_info(),
    request: ctx.accounts.request.to_account_info(),
    system_program: ctx.accounts.system_program.to_account_info(),
};
let cpi_ctx = CpiContext::new(vrf_program, request_accounts);
orao_solana_vrf::cpi::request(cpi_ctx, seed)?;

Dependencies

~19–40MB
~740K SLoC