Skip to content

Small trusted setup ceremony, not intended to be scalable.

Notifications You must be signed in to change notification settings

yoyoismee/trusted-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome The Privacy Pools Demo Trusted Setup Ceremony!

Contributing to the ceremony requires some command line skillz, but it should be simple.

The definitive guide on how to run a trusted setup can be found in the snarkjs readme. There's no script within this repo to do the contribution! We are going to run the raw snarkjs commands directly, because we like tinkering in the terminal more than we like being comforted behind the ever sweet convenience of JavaScript.

Again, I recommend that you definitely should have read the snarkjs readme at least one time, but doing a quick refresher might not hurt in case it's been a while.

Dependencies

Steps

1. Setup

  • Download the ptau file, and compile the circuit. Do these by running
bash scripts/download.sh && bash scripts/build.sh

1. Verify and/or download the ptau file.

  • To verify the hash, run
node scripts/verifyPtauBlake2Hash.js
  • If it is incorrect, you can download it
bash setup.sh

The blake2 hashes for each ptau file are found here.

2. Compile the Circuits

Use the command

circom -o=./build ./circuits/withdraw_from_subset_simple.circom --r1cs --wasm --sym

2. Contribute

You will have to check the latest number that hasn't been used yet by inspecting the zkeys direction, and use that value for the trusted setup ceremony. For example, with the following keys:

/zkeys/withdraw_from_subset_simple_0000.zkey
/zkeys/withdraw_from_subset_simple_0001.zkey
/zkeys/withdraw_from_subset_simple_0002.zkey

You would run the following command. If you're a kind anon, then change the numbers in the readme when you're done.

snarkjs zkc \
  ./zkeys/withdraw_from_subset_simple_0002.zkey \
  ./zkeys/withdraw_from_subset_simple_0003.zkey

Do this from the root directory to generate the next contribution. Then, commit and push to your fork. We'll use a random blockhash for the beacon portion of the ceremony.

DO NOT SHARE THE ENTROPY WITH ANYONE! Your input is a random value that can be used to deterministically break the proving keys if they are gathered with all other contributions.

The last step of the ceremony is to initiate a pull request with your newly generated contribution file. The file should be saved to the zkeys directory, before submitting a pull request.

You can verify the contributions by checking against the latest (which should be yours)

snarkjs zkv \
  ./build/withdraw_from_subset_simple.r1cs \
  ./ptau/powersOfTau28_hez_final_14.ptau \
  ./zkeys/withdraw_from_subset_simple_0003.zkey

Make sure to change the 0003 to your zkeys number.

Wallah! That's it.

Last Steps

Pull request to your own fork, have someone merge into main branch.

About

Small trusted setup ceremony, not intended to be scalable.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published