npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zkpersona/noir-helpers

v0.2.1

Published

Helpers utilities for Noir proofs and input generation.

Readme

Noir Helpers

Noir Helpers is a collection of utilities and helper function to generate proofs and inputs for noir circuits.

Installation

To install the @zkpersona/noir-helpers package, you can use any of the following package managers:

npm install @zkpersona/noir-helpers
# or
yarn add @zkpersona/noir-helpers
# or
pnpm add @zkpersona/noir-helpers
# or
bun add @zkpersona/noir-helpers

Usage

Generating Proofs

The @zkpersona/noir-helpers package provides a Prover class that can be used to generate proofs for Noir circuits. Here's an example of how to use the Prover class:

import { Prover , U8, toCircuitInputs } from '@zkpersona/noir-helpers';
import type { CompiledCircuit } from '@noir-lang/noir_js';

import circuit from '../target/circuits.json' assert { type: 'json' };

const inputs = { x: new U8(1), y: new U8(2) };
const parsedInputs = toCircuitInputs(inputs);

// Supported types are: "plonk", "honk", "all"
const prover = new Prover(circuit as CompiledCircuit, { type: 'plonk' });

// Simulate Witness
const { witness, returnValue } = await prover.simulateWitness(parsedInputs);

// Generate Proof
const proof = await prover.prove(witness);

// Verify Proof
const isValid = await prover.verify(proof);

console.log('Proof verification:', isValid);

Generating Prover.toml file

The @zkpersona/noir-helpers package also provides a function to generate a Prover.toml file from a JSON object. Here's an example of how to use the generateToml function:

import { generateToml , toCircuitInputs, U8 } from '@zkpersona/noir-helpers';

const data = toCircuitInputs({ x: new U8(1), y: new U8(2) });
const filePath = 'absolute/path/to/Prover.toml';

generateToml(data, filePath);

Using Data Types

The package exports Noir primitive data types such as Field, Signed/Unsigned Integers, BoundedVec for generating Prover.toml Inputs.

Here's an example of how to these data types can be used:

import {
  Bool,
  BoundedVec,
  Field,
  FixedSizeArray,
  I8,
  Str,
  U8,
  toJSON,
} from '@zkpersona/noir-helpers';

const a = new Field(1); // Field element
const b = new Field('0x10'); // Hex Representation

// Initialize BoundedVec with MaxLength, default value, and initial items.
const c = new BoundedVec(2, new Field(0), []); // BoundedVec<Field,2>;

// struct A {
//     x: Field,
//     y: Field,
// }

// BoundedVec<A, 2>;
const d = new BoundedVec(2, {
  x: new Field(0),
  y: new Field(0),
});

// bool
const e = new Bool(true);
// str
const f = new Str('hello');
// u8
const g = new U8(12);
// i8
const h = new I8(12);

// BoundedVec<[u8;2],2>
const ele = () =>
  new BoundedVec(2, new FixedSizeArray(2, [new U8(0), new U8(0)]));

const updatedEle = ele();
updatedEle.push(new FixedSizeArray(2, [new U8(1), new U8(2)]));

const i = new BoundedVec(2, {
  x: ele(),
});

i.push({ x: updatedEle });
console.log(
  toCircuitInputs({
    a,
    b,
    c,
    d,
    e,
    f,
    g,
    h,
    i,
  })
);

This outputs the following JSON object:

{
  "a": "0x1",
  "b": "0x10",
  "c": {
    "storage": [
      "0x0",
      "0x0"
    ],
    "len": 0
  },
  "d": {
    "storage": [
      {
        "x": "0x0",
        "y": "0x0"
      },
      {
        "x": "0x0",
        "y": "0x0"
      }
    ],
    "len": 0
  },
  "e": true,
  "f": "hello",
  "g": "12",
  "h": "12",
  "i": {
    "storage": [
      {
        "x": {
          "storage": [
            ["1","2"],
            ["0","0"]
          ],
          "len": 1
        }
      },
      {
        "x": {
          "storage": [
            ["0","0"],
            ["0","0"]
          ],
          "len": 0
        }
      }
    ],
    "len": 1
  }
}

Supported types: Field, U1, U8, U16, U32, U64, I1, I8, I16, I32, I64, Bool, Str, FixedSizeArray and BoundedVec.


Getting Started

To get started with the project, clone the repository and install the dependencies:

git clone https://github.com/zkpersona/noir-helpers.git
cd noir-helpers
pnpm install

To run the tests, use the following command:

pnpm test

Contributing

Contributions are welcome! Please open an issue or submit a pull request.