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

@axiom-crypto/halo2-wasm

v0.3.4

Published

Halo2 wasm bindings

Downloads

2,620

Readme

halo2-wasm

This repository aims to streamline the process of building WASM modules from zero-knowledge proof circuits written on top of halo2-lib. To discuss or collaborate, join our community on Telegram.

Getting Started

For a brief overview on writing halo2-lib circuits, see this doc. In addition to the halo2-lib setup, you will need wasm-pack installed:

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

The template folder includes everything you need to turn your circuit into a WASM bundle. In particular, template/src/lib.rs is an example of a simple circuit that uses the context of a Halo2Wasm struct. You can then build your WASM bundle (from the template subdirectory) with:

./scripts/build.sh <PLATFORM>

where <PLATFORM> is either nodejs or web.

Multithreading

Halo2 uses Rayon for multithreading, and we use wasm-bindgen-rayon to support this in the browser. It does not work outside the browser, however, so when nodejs is the compilation target, Rayon will be turned off (it is enabled using the rayon feature flag).

Setting up the WASM module in JS

Web

import {
  init,
  initThreadPool,
  initPanicHook,
  Halo2Wasm,
  MyCircuit,
} from "<IMPORT PATH>";

const main = async () => {
  //setup Halo2Wasm and MyCircuit
  await init();
  initPanicHook();
  await initThreadPool(numThreads);
  const halo2wasm = new Halo2Wasm();
  const myCircuit = new MyCircuit(halo2wasm);
};

Node.js

import { Halo2Wasm, initPanicHook, MyCircuit } from "<IMPORT PATH>";

const main = async () => {
  //setup Halo2Wasm and MyCircuit
  initPanicHook();
  const halo2wasm = new Halo2Wasm();
  const myCircuit = new MyCircuit(halo2wasm);
};

You can now run MyCircuit witness generation with myCircuit.run() (following the example in the template subdirectory). You can then call any of the Halo2Wasm operations (mock, keygen, prove, etc.),

halo2-js

halo2-js is a Typescript wrapper for easily using the halo2-wasm module's functions (ie. proving, keygen, etc). Check out the repo for more info.

Benchmarks

Coming soon!

Projects built with halo2-wasm

Acknowledgements

This work would not be possible without Nalin's guide on using raw halo2 in WASM. Check out his guide here.