@vrand.io/client
v0.1.1
Published
Low-level TypeScript client for VRAND, the verifiable randomness (VRF) protocol on Solana: instruction builders, PDA derivations, local proof verification, and bias-free provably-fair outcome shaping (dice, shuffles, weighted picks, floats).
Maintainers
Readme
@vrand.io/client
The low-level TypeScript client for VRAND — the
verifiable randomness protocol on Solana. This is the layer
@vrand.io/web is built on;
use it directly for servers, bots, and anything that assembles its own
transactions.
import { VrandClient, verifyBoundBeta, uniformBelow } from "@vrand.io/client";
const client = new VrandClient(connection);
// Build the request instruction — every account derived for you:
const ix = client.requestIx({ payer, requester, compDest, prover, seed, atRiskLamports: 0n });
// … sign & send …
const req = await client.awaitFulfillment(requester, seed);What's in the box
- Instruction builders —
requestIx,acknowledgeTermsIx,closeRequestIx,slashIx(discriminators read from the bundled IDL). - PDA derivations — pinned byte-for-byte to the Rust SDK by cross-language golden tests.
- Account decoding —
decodeRequest, terms/acknowledgment state. - The full local proof verifier —
verifyProof,verifyBeta,verifyBoundBeta(binds the proof to your requester and seed, so a served record that isn't your request's genuine result is rejected no matter how valid its proof looks in isolation). - Bias-free outcome shaping — the
scalemodule:uniformBelow,shuffleIndices,weighted,unitFloat, and the statefulStream, all rejection-sampled and byte-identical to the on-chain Rust implementation.
Live on Solana mainnet and devnet. Program ID:
4HeYPD3be4YVGGGShLgrHwFS2aakss7gMD6tWcjXA4nx.
Links
- Docs: docs.vrand.io
- The one-liner for browsers:
@vrand.io/web - Protocol: vrand.io
Apache-2.0.
