Low-Level Exports
The SDK re-exports primitives for advanced use cases — custom encryption, direct curve operations, or building on top of the EB protocol. Most integrations won't need these; use EBClient and EBWallet instead.
import { ... } from '@zk-privacy/eb-sdk';
Grumpkin Curve
Elliptic curve operations on the Grumpkin curve (used by Noir/Barretenberg).
scalarMulBase(scalar: bigint): Point
scalarMul(point: Point, scalar: bigint): Point
pointAdd(a: Point, b: Point): Point
pointSub(a: Point, b: Point): Point
pointNegate(point: Point): Point
pointEquals(a: Point, b: Point): boolean
isOnCurve(point: Point): boolean
isZeroPoint(point: Point): boolean
randomScalar(): bigint
GRUMPKIN_FIELD_ORDER // Field modulus
GRUMPKIN_CURVE_ORDER // Curve order
ElGamal Encryption
Exponential ElGamal over Grumpkin — additively homomorphic.
encrypt(amount: bigint, recipientBPK: Point, randomness?: bigint): ElGamalCiphertext
decryptToPoint(ct: ElGamalCiphertext, secretKey: bigint): Point
homomorphicAdd(a: ElGamalCiphertext, b: ElGamalCiphertext): ElGamalCiphertext
homomorphicSub(a: ElGamalCiphertext, b: ElGamalCiphertext): ElGamalCiphertext
homomorphicScalarMul(ct: ElGamalCiphertext, scalar: bigint): ElGamalCiphertext
rerandomize(ct: ElGamalCiphertext, recipientBPK: Point, randomness?: bigint): ElGamalCiphertext
verifyEncryption(ct: ElGamalCiphertext, amount: bigint, recipientBPK: Point, randomness: bigint): boolean
isZeroCiphertext(ct: ElGamalCiphertext): boolean
ZERO_CIPHERTEXT // Identity ciphertext
Discrete Log Solver
Solves amount * G = Point via baby-step giant-step with precomputed tables.
DlogSolver
initDlogSolver(config?): Promise<DlogSolver>
solveDlog(point: Point): bigint
L3 Crypto Primitives
Stake commitment and nullifier computation for the L3 Merkle tree.
computeStakeCommitment(amount: bigint, blinding: bigint, secret: bigint): bigint
computeNullifier(blinding: bigint, leafIndex: number): bigint
computeMerkleRoot(leaf: bigint, index: number, siblings: bigint[]): bigint
computeEmptyTreeRoot(depth: number): bigint
computeEmptyIMTRoot(depth: number): bigint
generateBlinding(): bigint
generateStakeId(): string
Stealth Key Derivation
Derive stealth keypairs from a master spending key.
deriveStealthKeys(spendingKey: bigint, index: number): StealthKeys
deriveStealthEvmKey(spendingKey: bigint, index: number): { privateKey: `0x${string}`; address: `0x${string}` }
deriveStealthEbKey(spendingKey: bigint, index: number): { spendingKey: bigint; bpk: Point }