revert websnark cli

This commit is contained in:
Roman Storm 2020-10-22 09:50:15 -07:00
parent 18e6a19800
commit 1ad2158af1
No known key found for this signature in database
GPG Key ID: 522F2A785F34E71F
2 changed files with 26 additions and 13 deletions

View File

@ -9,15 +9,17 @@ Later, the user decides to make a withdrawal. In order to do that, the user shou
You can read more about it in [this medium article](https://medium.com/@tornado.cash/introducing-private-transactions-on-ethereum-now-42ee915babe0)
## Specs
- Deposit gas const: 1088354 (43381 + 50859 * tree_depth)
- Deposit gas const: 1088354 (43381 + 50859 \* tree_depth)
- Withdraw gas cost: 301233
- Circuit Constraints = 28271 (1869 + 1325 * tree_depth)
- Circuit Proof time = 10213ms (1071 + 347 * tree_depth)
- Circuit Constraints = 28271 (1869 + 1325 \* tree_depth)
- Circuit Proof time = 10213ms (1071 + 347 \* tree_depth)
- Serverless
![image](docs/diagram.png)
## Whitepaper
**[https://tornado.cash/Tornado.cash_whitepaper_v1.4.pdf](https://tornado.cash/Tornado.cash_whitepaper_v1.4.pdf)**
## Was it audited?
@ -26,13 +28,14 @@ Tornado.cash protocols, circuits, and smart contracts were audited by a group of
During the audit no critical issues were found and all outstanding issues were fixed. The results can be found here:
* Cryptographic review https://tornado.cash/Tornado_cryptographic_review.pdf
* Smart contract audit https://tornado.cash/Tornado_solidity_audit.pdf
* Zk-SNARK circuits audit https://tornado.cash/Tornado_circuit_audit.pdf
- Cryptographic review https://tornado.cash/Tornado_cryptographic_review.pdf
- Smart contract audit https://tornado.cash/Tornado_solidity_audit.pdf
- Zk-SNARK circuits audit https://tornado.cash/Tornado_circuit_audit.pdf
Underlying circomlib dependency is currently being audited, and the team already published most of the fixes for found issues
## Requirements
1. `node v11.15.0`
2. `npm install -g npx`
@ -54,12 +57,15 @@ Use browser version on Kovan:
1. Open `localhost:8080`
Use with command line version. Works for Ganache, Kovan and Mainnet:
### Initialization
1. `cp .env.example .env`
1. `npm run download`
1. `npm run build:contract`
### Ganache
1. make sure you complete steps from Initialization
1. `ganache-cli -i 1337`
1. `npm run migrate:dev`
@ -67,14 +73,16 @@ Use with command line version. Works for Ganache, Kovan and Mainnet:
1. `./cli.js --help`
### Kovan, Mainnet
1. make sure you complete steps from Initialization
1. Add `PRIVATE_KEY` to `.env` file
1. `./cli.js --help`
1. Please use https://github.com/tornadocash/tornado-cli
Reason: because tornado-core uses websnark `2041cfa5fa0b71cd5cca9022a4eeea4afe28c9f7` commit hash in order to work with local trusted setup. Tornado-cli uses `4c0af6a8b65aabea3c09f377f63c44e7a58afa6d` commit with production trusted setup of tornadoCash
Example:
```bash
./cli.js deposit ETH 0.1 --rpc https://kovan.infura.io/v3/27a9649f826b4e31a83e07ae09a87448
```
> Your note: tornado-eth-0.1-42-0xf73dd6833ccbcc046c44228c8e2aa312bf49e08389dadc7c65e6a73239867b7ef49c705c4db227e2fadd8489a494b6880bdcb6016047e019d1abec1c7652
> Tornado ETH balance is 8.9
> Sender account ETH balance is 1004873.470619891361352542
@ -86,7 +94,7 @@ Example:
./cli.js withdraw tornado-eth-0.1-42-0xf73dd6833ccbcc046c44228c8e2aa312bf49e08389dadc7c65e6a73239867b7ef49c705c4db227e2fadd8489a494b6880bdcb6016047e019d1abec1c7652 0x8589427373D6D84E98730D7795D8f6f8731FDA16 --rpc https://kovan.infura.io/v3/27a9649f826b4e31a83e07ae09a87448 --relayer https://kovan-frelay.duckdns.org
```
> Relay address: 0x6A31736e7490AbE5D5676be059DFf064AB4aC754
> Relay address: 0x6A31736e7490AbE5D5676be059DFf064AB4aC754
> Getting current state from tornado contract
> Generating SNARK proof
> Proof time: 9117.051ms
@ -96,11 +104,13 @@ Example:
> Done
## Deploy ETH Tornado Cash
1. `cp .env.example .env`
1. Tune all necessary params
1. `npx truffle migrate --network kovan --reset --f 2 --to 4`
## Deploy ERC20 Tornado Cash
1. `cp .env.example .env`
1. Tune all necessary params
1. `npx truffle migrate --network kovan --reset --f 2 --to 3`
@ -109,12 +119,13 @@ Example:
**Note**. If you want to reuse the same verifier for all the instances, then after you deployed one of the instances you should only run 4th or 5th migration for ETH or ERC20 contracts respectively (`--f 4 --to 4` or `--f 5`).
## How to resolve ENS name to DNS name for a relayer
1. Visit https://etherscan.io/enslookup and put relayer ENS name to the form.
2. Copy the namehash (1) and click on the `Resolver` link (2)
![enslookup](docs/enslookup.png)
![enslookup](docs/enslookup.png)
3. Go to `Contract` tab. Click on `Read Contract` and scrolldown to the `5. text` method.
4. Put the values:
![resolver](docs/resolver.png)
![resolver](docs/resolver.png)
5. Click `Query` and you will get the DNS name. Just add `https://` to it and use it as `relayer url`
## Credits
@ -123,6 +134,7 @@ Special thanks to @barryWhiteHat and @kobigurk for valuable input,
and to @jbaylina for awesome [Circom](https://github.com/iden3/circom) & [Websnark](https://github.com/iden3/websnark) framework
## Minimal demo example
1. `npm i`
1. `ganache-cli -d`
1. `npm run download`
@ -132,6 +144,7 @@ and to @jbaylina for awesome [Circom](https://github.com/iden3/circom) & [Websna
1. `node minimal-demo.js`
## Emulate MPC trusted setup ceremony
```bash
cargo install zkutil
npx circom circuits/withdraw.circom -o build/circuits/withdraw.json

View File

@ -47,6 +47,6 @@
"truffle-flattener": "^1.4.2",
"web3": "^1.2.2",
"web3-utils": "^1.2.2",
"websnark": "git+https://github.com/tornadocash/websnark.git#4c0af6a8b65aabea3c09f377f63c44e7a58afa6d"
"websnark": "git+https://github.com/tornadocash/websnark.git#2041cfa5fa0b71cd5cca9022a4eeea4afe28c9f7"
}
}