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 🙏

© 2024 – Pkg Stats / Ryan Hefner

snarkit2

v0.2.0

Published

A command line tool to test circom circuit with given inputs/outputs

Downloads

36

Readme

snarkit2

A toolkit to compile and debug circom circuit.

Dependencies

Circom has two versions, the rust-based circom2, and the js-based legacy circom. The first is new but fast, the latter is old but stable.

snarkit2 works with the rust-based version. The old snarkit works with the js circom.

circom should be installed in $PATH.

Linux is the only supported OS.

Features

Better support for huge circuits

snarkit2 supports both wasm witness generator and native(cpp) witness generator. So compared to the snarkjs official tool, snarkit2 is more friendly for developing huge circuits by using native backend.

Better error detection

snarkit2 can print very helpful error messages when the circuit code goes wrong. It can display the code line number and the component/signals related to the error, so we can detect the reason for the error quickly and fix it. Example:

# display incorrect component and line number
$ snarkit2 check ./testdata/num2bits_err/

...
Error: Error: Assert Failed. Error in template CheckNumAndBits_0 line: 11
...

Example

The following demos how to test a circuit with given inputs/outputs.

$ npm install snarkit2

# first, you should prepare the circuit and input/output as the following structure
# all the input.json/output.json pair inside data/*** folder will be tested
# output.json can be an empty json file if you don't need to test against any circuit outputs.
$ find num2bits/
num2bits/
num2bits/data
num2bits/data/case01
num2bits/data/case01/output.json
num2bits/data/case01/input.json
num2bits/circuit.circom

# snarkit2 has two backend: wasm and native(cpp). Only native backend can process huge circuits, you have to install some dependencies first before using it.

# use wasm backend
# compile the circuit
$ npx snarkit2 compile num2bits --backend wasm
# test the circuit
$ npx snarkit2 check num2bits --backend wasm

# use native backend
# install deps
$ sudo apt install nlohmann-json3-dev nasm g++ libgmp-dev
# compile the circuit
$ npx snarkit2 compile num2bits --backend native
# test the circuit
$ npx snarkit2 check num2bits --backend native