contribution verification scripts

This commit is contained in:
poma 2020-05-12 02:58:29 +03:00
parent 24a1b1fe10
commit 732f09b908
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
7 changed files with 1273 additions and 0 deletions

@ -0,0 +1,5 @@
node_modules
phase1radix2m15
*.json
Verifier.sol
response_*

@ -0,0 +1,14 @@
# Tornado.Cash ceremony verification
This dir contains scripts that allow to verify tornado.cash trusted setup ceremony
```sh
# Download all tornado.cash contributions
./download.sh
# Verify each contribution
./verify.sh
# Generate keys and Verifier.sol contract
./generate.sh
```

@ -0,0 +1,11 @@
#!/bin/bash
set -e
wget https://tornado-cash-ceremony.s3-us-west-2.amazonaws.com/circuit.json
wget https://tornado-cash-ceremony.s3-us-west-2.amazonaws.com/phase1radix2m15
wget https://tornado-cash-ceremony.s3-us-west-2.amazonaws.com/initial.params
mv initial.params response_0
for i in $(seq 1 1114); do
wget https://tornado-cash-ceremony.s3-us-west-2.amazonaws.com/response_$i
done

@ -0,0 +1,18 @@
#!/bin/bash
set -e
npm ci
# Generating dummy key files to extract circuit data from
npx snarkjs setup --protocol groth
# generate actual keys from the last contribution
cargo run --release --bin export_keys response_1114 vk.json pk.json
# patch dummy keys with actual keys params
cargo run --release --bin copy_json proving_key.json pk.json transformed_pk.json
# generate solidity verifier
cargo run --release --bin generate_verifier response_1114 Verifier.sol
# rename key files
rm proving_key.json verification_key.json pk.json
mv circuit.json withdraw.json
mv transformed_pk.json withdraw_proving_key.json
mv vk.json withdraw_verification_key.json

File diff suppressed because it is too large Load Diff

@ -0,0 +1,14 @@
{
"name": "phase2",
"version": "1.0.0",
"description": "This library is still under development.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"snarkjs": "git+https://github.com/kobigurk/snarkjs.git"
}
}

@ -0,0 +1,7 @@
#!/bin/bash
set -e
cargo build --release --bin verify_contribution
for i in $(seq 1 1114); do
../target/release/verify_contribution circuit.json response_$((i - 1)) response_$i
done