| Crates.io | entropy-rng-api |
| lib.rs | entropy-rng-api |
| version | 0.1.1 |
| created_at | 2026-01-07 21:14:56.97166+00 |
| updated_at | 2026-01-07 21:20:29.202538+00 |
| description | API for interacting with the Entropy RNG program on Solana |
| homepage | https://oil.supply/entropy |
| repository | https://github.com/oil-protocol/entropy-rng |
| max_upload_size | |
| id | 2029022 |
| size | 83,316 |
API crate for interacting with the Entropy RNG (Random Number Generator) program on Solana.
Entropy is a provably-fair random number generation protocol for Solana. It uses a commit-reveal scheme paired with slothash sampling strategy to generate random numbers on-chain in a secure and cost-effective way.
Add to your Cargo.toml:
[dependencies]
entropy-rng-api = "0.1.1"
use entropy_rng_api::prelude::*;
// Derive a Var PDA
let seed = b"my-seed";
let (var_pda, _bump) = var_pda(&seed);
// Build an Open instruction
let instruction = open(
signer,
var_address,
commit,
end_slot,
is_auto,
);
Open - Opens a new variable accountClose - Closes a variable accountNext - Moves a variable to the next valueReveal - Reveals a seed to finalize the variable valueSample - Samples the slothash from the chainVar - Variable account that tracks a unique random variableHelper functions for:
The protocol ensures provably-fair randomness by:
use entropy_rng_api::prelude::*;
use solana_program::pubkey::Pubkey;
// Derive variable PDA
let seed = b"my-random-seed";
let (var_pda, _bump) = var_pda(&seed);
// Build Open instruction
let open_ix = open(
&signer.pubkey(),
&var_pda,
commit, // From Entropy API
end_slot, // Target slot
false, // is_auto
);
// Build Sample instruction
let sample_ix = sample(
&signer.pubkey(),
&var_pda,
);
// Build Reveal instruction
let reveal_ix = reveal(
&signer.pubkey(),
&var_pda,
seed_value, // From Entropy API after sampling
);
Full API documentation is available at:
Licensed under Apache-2.0