docs · api reference

The whole surface, one page.

On-chain instructions, Rust helper crates, and the TypeScript SDK. Stable contracts — anything that ships under 0.1.x stays in 0.x.

On-chain instructions (Anchor program)

The yoroi_core program exposes the verify path for every primitive. Each instruction is one CPI line from your caller.

rust
pub fn verify_aggregate( ctx: Context<VerifyAggregate>, agg_pubkey: [u8; 96], message: Vec<u8>, agg_signature: [u8; 48], ) -> Result<()>; pub fn verify_threshold( ctx: Context<VerifyThreshold>, committee_id: u64, threshold_sig: [u8; 48], message: Vec<u8>, ) -> Result<()>; pub fn verify_vrf( ctx: Context<VerifyVrf>, seed: Vec<u8>, proof: [u8; 48], expected_output: [u8; 64], ) -> Result<()>;

Rust crates

Each library can be used standalone (no_std host) or wired into the on-chain program. Same trait surface in both contexts.

rust
use yoroi_bls::{ generate_keypair, sign, aggregate_signatures, aggregate_pubkeys, verify_aggregate, }; let kp = generate_keypair(&seed)?; let sig = sign(&kp.secret, b"message"); let agg = aggregate_signatures(&[sig_a, sig_b, sig_c])?; let agg_pub = aggregate_pubkeys(&[pk_a, pk_b, pk_c])?; verify_aggregate(&agg_pub, b"message", &agg)?;
  • yoroi_blsBLS aggregate sign + verify, BatchVerifier
  • yoroi_thresholdShamir split + combine, t-of-n threshold signing
  • yoroi_dkgPedersen DKG round-1/round-2 helpers
  • yoroi_vrfBLS-VRF prove + verify, aggregate-VRF helpers
  • yoroi_ibeBoneh-Franklin IBE setup / extract / encrypt / decrypt
  • yoroi_pqWOTS+ keygen / sign / verify behind SignatureScheme

TypeScript SDK

Browser + Node. WASM bindings to the Rust crates, plus an Anchor client for the on-chain program.

ts
import { generateKeypair, sign, aggregate, AggregateBuilder, YoroiClient, } from "@yoroi/sdk"; const builder = new AggregateBuilder(); signers.forEach((kp, idx) => builder.push({ pubkey: kp.public, signature: sign(kp.secret, msg), index: idx }), ); const bundle = builder.finalize(msg); const client = new YoroiClient({ rpcUrl: RPC }); const tx = client.buildVerifyAggregateTx({ payer: signer.publicKey, committeeId: new BN(1), bundle, }); await client.sendTx(tx, signer);

Error codes

On-chain errors surface through Anchor's ProgramError. Mapping below stays stable across patch releases.

6000InvalidSignatureaggregate signature failed pairing check
6001InvalidPublicKeyG1 / G2 decoding failed
6002SyscallUnavailableSIMD-0388 not yet activated on runtime
6003CommitteeMismatchsigners do not match registered committee
6004ThresholdNotMett-of-n quorum not reached
6005StaleProofVRF proof against expired seed window