Cover photo

How to use Tornado Cash in 2025 (Run the command line tool from Python source code)

Security Warnings:

  1. Only run the open source code and scripts locally or binaries compiled on your machine

  2. Do not trust or use ANY Tornado Cash service from the webpage or IPFS

  3. There’s no longer any such thing as an "official website" after the sanctions

  4. Any websites that claim themselves as "official" are 100% FAKE

  5. See 👉 [Block Domain] Fake ethereum Tornado cash websites Phishing

Background

I got scammed by a Tornado Cash honeypot website and it really frustrated me, so I did a lot of research and found out that almost all of the Tornado Cash websites are fake.

And actually, there is no need for an “Official“ website to use the Tornado Cash, since it is an open sourced protocol.

So the best way to use it is write a simple script yourself, or using an existing code, to interact with the smart contract.

Code Repositories

Although the official website is dead and there are many phishing website that imitates it closely, the official code repository remains archived but outdated and has not been maintained for years after the sanctions.

A fork of the official repository, running it from source code requires older version of node.js runtime and dependency, which cost me a lot of time to set up the environment.

Even though it provides a prebuilt Windows executable for convenient, I don’t think I can trust it.

I hate Javascript personally and I really don’t want to develop new features based on it, so I re-implement the whole tornado-cli in Python and add some cool features like “Batch Deposit“.

https://github.com/gokgokdak/tornadocash-py

In the Python version, contract event cache was managed by SQLite database instead of JSON files. I create a Github repository to publish the latest database cache per 15 days.

https://github.com/gokgokdak/tornadocash-db

This tutorial is based on the tornadocash-py implementation, if you want to use the original cli tool, please checkout another article 👉 How to Use the Tornado-CLI Command Line Tool

Step 1: Download the source code

Git clone or download the repository to your local machine.

Download the source code
Download the source code
Download the source code
Download the source code

Step 2: Download the database cache

To make a withdrawal from the Tornado Cash smart contract, user are required to provide a zero knowledge proof calculated from the latest merkle tree.

The merkle tree contains all historical commitments, which means we have to download all the deposit events from the blockchain.

To skip the blockchain syncing, just download the latest database cache from Github.

post image

Under the db directory of the project, you should see these .sqlite files.

Download the database
Download the database

Step 3: Install the PIP packages

Under the source code directory, simply run pip install -r requirements.txt

Install PIP dependencies
Install PIP dependencies

Make a deposit

The command line option is python cli.py --deposit <key> <chain> <symbol> <unit>

  • key: The address contains ETHs to deposit, also pay for the gas fee

  • chain: Which chain to deposit, ethereum, polygon, bsc, avalance, optimism and arbitrum, etc…

  • symbol: Which kind of coins or token, eth, dai, pol, usdt and usdc, etc…

  • unit: How many coins to deposit, for ETH, avaialable units are 0.1, 1, 10, 100

The private note will be like: ethereum-eth-0.1-d9a5f2eb782a50932fec4fdeecf0bda409070686caecb68bfd9822192f6626-14e44248c0956fba5259651f617a771ac54c3df2a65e64392bd30203e66f1c, please keep it private.

If succeed, you should see console output like below:

Deposit example
Deposit example

Make a batch deposit

This is my favorite feature😋

For example, you have an address holds 136 ETHs and 11000 POLs, going to deposit them separately into 1x100 ETHs, 2x10 ETHs and 16x1 ETHs on Ethereum mainnet, also 1x10000 POLs and 1000 POLs on Polygon, you could do this in one command.

I don’t have too much money so I will demonstrate it in 3x0.1 ETHs

The command line option is python cli.py <key> <json>

key: The address contains ETHs to deposit and pay for the gas fee

json: Specify the multi-deposit configuration in JSON string, “{ ‘<chain>‘: { ‘<symbol>‘: { ‘<unit>‘: <num_of_deposit> } } }“

Batch deposit example
Batch deposit example

Make a withdraw

The command line option is python cli.py --withdraw <note> <recipient> <key/relayer>

note: The private note generated during the deposit

key/relayer: Private key to pay for the gas fee

Withdraw example
Withdraw example

Make a withdraw with a relayer

The command line option is python cli.py --withdraw <note> <recipient> <key/relayer>

note: The private note generated during the deposit.

key/relayer: The relayer to pay for the gas fee

Withdraw example with a relayer
Withdraw example with a relayer

Keep synced to the block chain

To sync a single deployment: python cli.py --sync <chain> <symbol> <unit>

To sync all contract deployments: python cli.py --sync_all

It is recommended to keep the program running to stay synchronized with the blockchain, simply add a --keep option to --sync or --sync_all command.

What’s more

The WebUI interface is under developing, which will supports wallet connect.

Buy me a coffee if you like this project😘

EVM Address: 0xd54eA9e8106227080f72bfD4b9d99BbD96Eacd11
EVM Address: 0xd54eA9e8106227080f72bfD4b9d99BbD96Eacd11