sunspot-sdk
v1.0.2
Published
Zero-knowledge proving SDK bridging Noir and Gnark via WebAssembly.
Maintainers
Readme
Sunspot SDK
A universal, zero-config SDK for generating Groth16 Zero-Knowledge proofs in the browser, Node.js, and Bun. This library seamlessly bridges Noir (1.0.0-beta.18) circuit execution with a blazing-fast Go/Gnark WebAssembly prover.
Installation
npm install sunspot-sdk
npm install @noir-lang/[email protected]Quick Start
import { SunspotSDK } from 'sunspot-sdk';
import circuitJson from './target/circuit.json'; // Your compiled Noir circuit
async function generateProof() {
// 1. Initialize the SDK (WASM is bundled automatically)
const prover = new SunspotSDK(circuitJson);
await prover.init();
// 2. Load your Proving Keys
// circuit.ccs is generated by `sunspot compile`
const ccsBytes = await fetch('./target/circuit.ccs').then(r => r.arrayBuffer());
// pk and vk are generated by `sunspot setup`
const pkBytes = await fetch('./target/circuit.pk').then(r => r.arrayBuffer());
// 3. Define Circuit Inputs
// This depends on your noir circuit
const inputs = {
old_root: "12345...",
new_root: "67890..."
};
// 4. Generate the Proof
const { proof, publicInputs } = await prover.prove(
inputs,
new Uint8Array(ccsBytes),
new Uint8Array(pkBytes)
);
console.log("Proof Generated!", proof.length, "bytes");
}
generateProof();