v0.5.13 · live on npm

SDK

@kirite/sdk is the TypeScript surface for the KIRITE privacy protocol on Solana. ZK shield pool + stealth address recipients, with Solana-native deposit/withdraw helpers shipped as ESM.

install
npm install @kirite/sdk @solana/web3.js

What ships

shield-poolv3 deposit / withdraw
Real Groth16 + Poseidon Merkle code in @kirite/sdk/zk. Browser proof generation via snarkjs WASM (~1s desktop, ~3s mobile). Exposed as ESM helpers; the client uses them directly.
stealthDKSAP utilities
Meta-address generation, ECDH-derived one-time addresses, view-tag fast scan, on-chain registry instructions.
staking$KIRITE stake / unstake / claim
Token-2022 compatible staking instructions for the deployed mainnet program. Re-exported from @kirite/sdk/staking.
typestyped primitives
DepositNote, ShieldPoolState,StealthMetaAddress, Groth16Proof,WithdrawPublicInputs, and event types matching the on-chain program.

Quick start

Resolve a pool by denomination

import { Connection, PublicKey } from "@solana/web3.js";
import {
  KIRITE_PROGRAM_ID,
  SEEDS,
  DEFAULT_DENOMINATIONS,
} from "@kirite/sdk";
import BN from "bn.js";

const connection = new Connection("https://api.mainnet-beta.solana.com");

const denomination = DEFAULT_DENOMINATIONS[3]; // 1 SOL
const [poolPda] = PublicKey.findProgramAddressSync(
  [SEEDS.POOL_STATE, denomination.toArrayLike(Buffer, "le", 8)],
  KIRITE_PROGRAM_ID
);

Generate a stealth meta-address

import { Keypair } from "@solana/web3.js";
import { generateStealthMetaAddress } from "@kirite/sdk";

const wallet = Keypair.generate();
const meta = generateStealthMetaAddress(wallet);
// meta.spendingKey, meta.viewingKey  → publish to a recipient

Deposit and withdraw via the v3 ZK helpers

import { deposit, withdraw } from "@kirite/sdk/zk";

// note never leaves the device
const note = await deposit({ connection, payer: wallet, denomination });

// later, withdraw to a stealth address
const sig = await withdraw({
  connection,
  note,
  recipient: stealthAddress.address,
  relayerUrl: "https://relayer.kirite.dev",
});

Stake $KIRITE

import { stake, unstake, claim } from "@kirite/sdk/staking";
import BN from "bn.js";

const sig = await stake({
  connection,
  owner: wallet,
  amount: new BN(1_000_000_000),
});

Errors

codemeaning
NullifierSpentErrorNote was already withdrawn.
InvalidMerkleRoot / ProofErrorProof verification failed on-chain.
TreeFullErrorMerkle tree at capacity (32,768 leaves on v2).
PoolFrozenErrorPool authority froze the pool for emergency response.
InvalidDenominationErrorSubmitted denomination is not in the active ladder.
RelayerErrorRelayer refused the request (sanctions, malformed payload, etc.).

Priority fees

Proof-heavy instructions benefit from a compute-unit price bump. The SDK queries the RPC for recent priority fees and attaches a setComputeUnitPrice instruction automatically.

kirite.configure({
  priorityFee: "dynamic",     // or a fixed number of microlamports
  computeUnitLimit: 400_000,  // bumped above the 200k default
});