Skip to content

Small trusted setup ceremony, not intended to be scalable.

Notifications You must be signed in to change notification settings

dhadrien/privacy-pools-trusted-setup

 
 

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_0007.zkey \
  ./zkeys/withdraw_from_subset_simple_0008.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.

Latest Contribution Hashes Snapshot

Each of these files have been verified individually.

[INFO]  snarkJS: Circuit Hash:
                85228df9 7eff386d e76a4e08 82e4d68d
                0f699a86 e161e1e0 f939eb26 2af74e4b
                23f6a075 1973dc55 54a088a7 ac286188
                9ecb5050 3d7a2dc8 a8a832b8 3c1ae8ab
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: contribution #5 :
                f760906f fc311509 91d73cb6 104a2548
                f9dfe24c 09331d87 95dec2e3 ba656a13
                6f003df9 ea35a697 9a6e0a90 2f6ba474
                966c3189 a8778a89 2f149743 1f2cd1a0
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: contribution #4 :
                d1411103 65d1bdd2 3a185ede ba05f20a
                f2413f44 9d3d5543 aade1cec 0020d80f
                b81f3d89 f5922131 4d9b14ec 2d6f87a2
                71f7911d 55bf14c1 d3058393 5a1a4eac
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: contribution #3 :
                836632c5 bb975810 c1a64b90 5e0cea73
                f7f3b2ca bb1b2d14 aeaec8b8 2b148f42
                73f7c434 15c57ae4 efc88d5e c367b128
                bedd7fdc 4c618021 97369702 f01a4b74
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: contribution #2 :
                aaef97aa 77387a01 3da73510 b423302f
                649e2ede 864dfcfa 808e9ea0 69e07579
                3971e85c 419b5529 f7718226 e5a94012
                13778667 c4e316e7 b6cb0907 2bf76faa
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: contribution #1 :
                cef921fd cfaf8b0a a1f8e19e 5bb87309
                fb5a4302 b2e4c33d 07e9c48d 57e3ae4e
                e89422d5 f46b65fe 219a0e6b fb1613e1
                316bc704 4f537cb7 4f65f889 2b237b08
[INFO]  snarkJS: -------------------------
[INFO]  snarkJS: ZKey Ok!

About

Small trusted setup ceremony, not intended to be scalable.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 61.7%
  • JavaScript 38.3%