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

@0xagnish/zkverifier

v1.0.0

Published

The purpose of this module is to put the zkSNARK into a proper feasible workflow.

Downloads

20

Readme

This is the Verification API (Backend Server)

The purpose of this module is to put the zkSNARK into a proper feasible workflow.

This package too will be published as an npm package. To install this head over to your terminal and type:

$ npm i @0xagnish/zkVerifier

To initialise the library:

import { Prover, UserVerifier } from "0xagnish/zkVerifier";
import { MerkleSumTree } from "0xagnish/zkDataPrep";

Prover here is the core API class that generates the Proof of Solvency zkSNARK for each of the users in the given input.csv. Since, the proof is a Zero-Knowledge Proof, it doesn't provide much information about the internal details about the entries of the database. Entries here refer to as the username -> balance structs of the individual users. Thereby, not revealing the number of users, or any kind of numerical value to the ongoing assets and liabilities of the Company/Organization.

UserVerifier is a class, rather an Abstraction Layer that lets a user verify a proof, without getting into the hassle of how the internals of the zero-knowledge verifier is working.

MerkleSumTree, as explained in 0xagnish/zkDataPrep structures the input.csv data into a merkle sum tree, a data structure that helps in construction of the dataset into a zk-friendly manner.

Usage

new Prover (tree: MerkleSumTree, assetsSum bigInt, proverArtifacts SnarkProverArtifacts) : Prover

import { Prover } from "0xagnish/zkVerifier";
import { MerkleSumTree } from "0xagnish/zkDataPrep";

const tree = new MerkleSumTree(
  "provide the relative path of the input.csv file"
);

const assetsSum = BigInt(4000000000);

const pathToWasm = "..enter your file path for WASM";
const pathToZKey = "..enter your file path to ZKEY";

const proverArtifacts = {
  wasmFilePath: pathToWasm,
  zkeyFilePath: pathToZKey,
};

const prover = new Prover(tree, assetsSum, proverArtifacts);

Initializes the prover object and takes inputs from the Merkle Sum Tree, the total assets owned by the Company/Organization. Along with the zkSNARK artifacts, which mainly consists of the Proof file, Proving Key and Verification Key.

The circuit repository is available in the @0xagnish/zkCircuits npm package, you can install by calling :

$ npm install 0xagnish/zkCircuits

generateProof (user index number : int) : FullProof

Generates a Proof-of-Solvency proof for a specific user in the Merkle Sum Tree.

const userIndex = 0;
const proof = await prover.generateProofForUser(userIndex);

APIs -> UserVerifier

new UserVerifier (username: string, balance: uint, verificationKey: JSON) : UserVerifier

import { UserVerifier } from "0xagnish/zkVerifierServer";

const username = "randome-string";
const balance = BigInt(2204);
const verificationKey = require("...add the file path to the verification key...");

const userVerifier = new UserVerifier(username, balance, verificationKey);