[go: up one dir, main page]

Skip to content

Tornado Cash as a foundry project, using latest versions of tools such as Circom, snarkJS, etc.

Notifications You must be signed in to change notification settings

nkrishang/tornado-cash-rebuilt

Repository files navigation

Tornado Cash [Re-built]

Tornado Cash is a non-custodial Ethereum and ERC20 privacy solution based on zkSNARKs.

This repository re-builds Tornado Cash for educational purposes as a Foundry project, and uses the latest versions of Circom (circomlib and circomlibjs) and snarkJS to generate proofs.

The original-repository is built with older versions of tools, and it is difficult to use it as educational reference material to understand the latest Solidity <-> Circom workflow for writing smart contracts with ZK-SNARK capabilities.

Installation

Clone this repository

git clone https://github.com/nkrishang/tornado-cash-rebuilt.git

Install dependencies:

forge install
yarn

Usage

Compiling circom circuits

The main workflow of this repo is:

  1. Compile circuits to generate circuit artifacts
  2. Perform a powers of tau ceremony
  3. Generate zkey and verifier Solidity smart contract

These three steps are written as bash commands in the makefile. Run the following to perform these steps:

make all

This will create a /circuit_artifacts folder that contains everything needed to run tests.

Running tests

There is a single forge test file /test/ETHTornado.t.sol and scripts used in this test /forge-ffi-scripts. The test and script files are annotated.

Run the following command to run tests (after you have generated circuit artifacts):

forge test

Credits

For a comprehensive understanding of ZK-SNARKs, see the Rareskills ZK Book and their article on how Tornado Cash works.

About

Tornado Cash as a foundry project, using latest versions of tools such as Circom, snarkJS, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published