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

@galactica-corp/zkkyc

v0.6.2

Published

Galactica Network's zero-knowledge Know Your Customer (zkKYC) library containing ZK circuit and blockchain library

Downloads

17

Readme

zkKYC

Repository for Galactica Network's zero-knowledge Know Your Customer (zkKYC) solution.

ZkKYC is a solution concept for meeting KYC obligations while preserving user privacy. It utilizes zero-knowledge cryptography to prove statements without sharing any personal details. For example users can prove that they have passed KYC and are grown up without disclosing personal details, such as names or birthdays.

This repo contains

  • Library of ZK circuits
  • Smart contracts for on-chain storage of zkKYCs and verification
  • Library of tools and scripts for building, creating, issuing and querying zkKYCs

The project is based on:

  • hardhat for Solidity development
  • Circom for the zero knowledge part to write SNARK circuits
  • SnarkJS for creating zk proofs

The documentation can be found here.

Install

npm install

Compile

This repo contains several parts that can be compiled:

  1. The zero-knowledge circuits
  2. The smart contracts
  3. The typescript library functions

Circuits

To compile the circuits, you first need the parameters from the trusted setup ceremony. It is the basis for keeping the computation in the ZKPs private. You can download it from here and place it in the circuits folder.

The following hardhat task takes care of compiling the circuits, testing it with available input files and postprocessing the output.

wget https://galactica.com/trusted-setup/dev/pot17_final.ptau -O circuits/pot17_final.ptau
npx hardhat smartCircuitBuild --verbose

It only rebuilds the circuits for which the source changed since the last build.

If the circuits were changed, the compilation requires a valid input file for the circuit. They can be found in circuits/input/. They can be modified by hand. For complex circuits using hashes, such as zkKYC, you can use the npx hardhat run scripts/writeExampleZKKYCInputs.ts to generate the file inlcuding hashes and merkle tree data.

Smart Contracts

The simplest way to compile the smart contracts is to run the tests. This automatically compiles them.

npm run test

Library functions

The libary functions only need to be compiled if you want to publish them to NPM or make it available to some other JavaScript project. Usually, this can be skipped because you can run scripts with npx hardhat run <file>.

To compile the library functions into a node module, you can run:

npm run build

Test

Run unit and integration tests for circuits, library functions and smart contracts.

npx hardhat smartCircuitBuild --verbose
npm run test

Deploy

There are some scripts for deployment of the basic infrastructure and example dApps. Before running it, you need to configure the deployer wallet in the environment variables used in hardhat.config.ts adn fund the account.

npx hardhat run scripts/deployInfrastructure.ts --network galaTestnet

You can find the addresses of the deployed contracts in the console output. If you also want to deploy example contracts, you can enter them in the following script before running it.

npx hardhat run scripts/deployExampleDApp.ts --network galaTestnet

Create and issue zkCertificates

First collect the certificate data and holder commitment from the user. For example as in the zkKYC example. Then you can sign it using the following hardhat task (replace holder commitment and file)

npx hardhat createZkKYC --holder-commitment 839160718446872147271060736034559178228117322331346628862983451058562783963 --kyc-data-file example/test.json --random-salt 1773 --registry-address 0x855d8DeF49d550df733Afb848aC723AEEBa58adF --network galaTestnet

The task issues the resulting zkCert on-chain and provides a merkle proof for it. Then you can send the zkCert data to the user, so that he/she can create zk proofs with it.

Publish this repo on npm

First make sure that the tests run successfully

npm run test

Build code into js files and publish it on NPM

npm run build
npm publish

Create a new release version on GitHub here.