TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta • Public • Published

Eddsa proof

A library to generate and verify EdDSA proofs.

NPM license NPM version Downloads npm bundle size (scoped) Linter eslint Code style prettier

This zero-knowledge library allows you to prove and verify that you have the private key of a Semaphore identity. It will be mainly used on-chain because you can get the same result off-chain using EdDSA signatures with the @semaphore-protocol/identity package. It facilitates the demonstration of having an EdDSA hash pre-image while keeping the pre-image value confidential. Additionally, it offers a mechanism to prevent the same proof from being reused. The circuit that forms the foundation of this library is accessible via this link.

The Snark artifacts (.wasm and .zkey files) can be specified or not in the generate function parameters and can possibly be downloaded using the following URLs:

The Snark artifacts currently used to generate zero-knowledge proofs are the result of an insecure trusted setup, and the library has not yet been audited. Therefore, it is advised not to use it in production.

🛠 Install

npm or yarn

Install the @zk-kit/eddsa-proof package:

npm i @zk-kit/eddsa-proof

or yarn:

yarn add @zk-kit/eddsa-proof

📜 Usage

import { generate, verify } from "@zk-kit/eddsa-proof"

// Your private key (secret) associated with your commitment.
const privateKey = 1
// A public value used to contextualize the cryptographic proof and calculate the nullifier.
const scope = 2

// Generate the proof.
const fullProof = await generate(privateKey, scope)

    nb. commitment and scope are always the same - proof is variable.
    commitment: '5049599877119858813001062015237093339640938925333103011635461484168047396248',
    scope: '2',
    proof: [

// If not specified, the Snark artifacts are downloaded automatically.
// You can specify them as follows.

// const fullProof = await generate(privateKey, scope, {
//     wasmFilePath: "<your-path>/eddsa-proof.wasm",
//     zkeyFilePath: "<your-path>/eddsa-proof.zkey"
// })

// Verify the proof.
const response = await verify(fullProof)

// true.

📈 Benchmarks

Benchmarks were run on a MacBook Pro, Apple M2 Pro, 16 GB RAM machine, after initializing the BN128 curve with @zk-kit/groth16-buildBn128 (~230ms).

Generate proof Verify proof Constraints
528.91 ms 10. 997ms 1017
import { generate, verify } from "@zk-kit/eddsa-proof"
import { buildBn128 } from "@zk-kit/groth16"

await buildBn128()


const proof = await generate(1, 2)



console.log(await verify(proof))





Package Sidebar


npm i @zk-kit/eddsa-proof

Weekly Downloads






Unpacked Size

30.7 kB

Total Files


Last publish


  • sripwoud
  • njofce
  • akinovak
  • cedoor