Install
cargo add alea-sdkLatest: 0.1.0 on crates.io. Crate name is alea-sdk, the importable module is alea_sdk. It re-exports the types your Anchor program needs for CPI, plus the two helpers config_pda() and is_round_recent().
BPF rustc lag pin
Section titled “BPF rustc lag pin”Solana’s cargo-build-sbf embeds a rustc that lags the public release by several minor versions. The transitive dependency constant_time_eq bumps its MSRV faster than that. If your cargo build-sbf fails with requires rustc 1.95.0, pin the dependency in your consumer Cargo.toml:
[dependencies]constant_time_eq = "=0.4.2"A future Solana toolchain release will move the floor up. Until then every BPF consumer of alea-sdk (and many other crates) needs this pin. See Common Pitfalls for the full story.
TypeScript
Section titled “TypeScript”npm install @alea-drand/sdkLatest: 0.2.0 on npmjs.com. Peer dependencies you must already have:
npm install @solana/web3.js@^1.95 @coral-xyz/anchor@^0.30.1Why pin web3.js to 1.95+ rather than 2.x: Alea was built against the current Anchor toolchain, which is itself web3.js 1.x. Anchor 2 / web3.js 2 will land later and the SDK will follow. The specific incompatibility between Anchor 0.30.1 and web3.js 1.98+ is documented in Common Pitfalls — the SDK works around it internally.
Verify the install
Section titled “Verify the install”Rust:
use alea_sdk::PROGRAM_ID;println!("{}", PROGRAM_ID);// ALEAydzHd4cN2EWcdHKp4hehAE4B88b16gqVtVqsck2UTypeScript:
import { DEVNET_PROGRAM_ID } from "@alea-drand/sdk";console.log(DEVNET_PROGRAM_ID.toBase58());// ALEAydzHd4cN2EWcdHKp4hehAE4B88b16gqVtVqsck2UIf both print that base58 address, the install is good. Next: CPI Integration Guide walks through a complete program.