Back in December, the Tornado cash team proposed the novel idea of Anonymity Mining. It consists in incentivising people to increase the anonymity set by depositing more funds into the pool.

You can read more in the original Medium post here:

Today I want to give an overview of the smart contracts involved and the different steps. Here is an overview diagram of all the contracts involved:

Click here for interactive version with link to all smart contracts code.

You can find the Tornado ETH pools at the bottom right and the TORN token itself on the top left.

Anonymity mining steps:

  1. First the user need to deposit Ether in one of the Tornado cash pools. The pools currently supporting mining are the 0.1 ETH, 1 ETH, 10 ETH and 100 ETH. The more the user deposit funds the more reward per block the user gets. Please refers to the Medium post to know the exact reward parameters. The introduction anonymity mining introduced a new contract, the TornadoProxy that will register in the TornadoTrees contract the block number of a deposit by calling the registerDeposit function.

  2. After some period of time the user will withdraw his deposit using a relayer. Note that the longer you stay in the pool the more reward you will be able to claim. Here again, the proxy call the TornadoTrees contract to register the withdrawal block number.

  3. The user is due some rewards but cannot yet claim the reward. First the Merkle Trees in TornadoTrees need to be updated to include the deposits and withdrawals involved. For this, a stakeholder of the system need to call the updateRoots function with the adequate data. The user will not necessarily need to call the function himself, someone else might be doing it for him.

  4. The user can now claim the reward in the form of AP (anonymity points) using his secret note. The reward claim is completely anonymous. The user can use a relayer and the AP are credited to a secret account not linked to any Tornado deposit or withdrawal. The reward claim works by generating a zero knowledge proof of ownership of an entry in the TornadoTrees contract created at step 1. and 2.

  5. The final step is to exchange the AP in the secret account for TORN tokens. A Relayer can excahnge the TORN to stay anonymous. The exchange rate of AP/TORN fluctuate as people claim TORN and more reward is added to the AMM exchange pool. Please refer to the Medium post for more information on how to calculate the exchange rate.

2 Likes

Thanks for the explanation @Rezan! I was wondering if it was possible to see somewhere when the updateRoots function was last called? I tried to myself but failed, and would like to claim those rewards :blush:

Hey @morblatz !

You can see it here:

The trees were last updated around 3 days ago but before that it was 2 weeks without update.

You can do it yourself using this repo:

There is however one issue. Withdrawals and Deposits need to be updated in the order they were registered with the proxy. That means you can’t update only your withdrawals/deposits but you have to update all of those that came before yours and this will be … expensive.

Maybe @rstormsf can confirm if my understanding is correct.

1 Like

Thanks, super useful! I have some funds to spare so I will try updating them in a few days.
It’s odd though, my note is still not ready for the anonymity mining despite having spent it before the update 3 days ago… Any idea why that may be?

Because 3 days ago only 60 deposits + 60 withdrawals were updated. They are maybe hundreds (or even thousands ?) of withdrawals before yours.

1 Like

Arigato for the explanation!

yes you are correct. unfortunately, this is how it works at this moment

Maybe tree contract needs to return some TORN as a compensation to whoever submits the update

It is also possible to make tree updates significantly cheaper using snarks

2 Likes

I don’t know who is currently updating these trees, but it’s expensive. This guy spent already 17 ETH on updates: https://fees.wtf/?address=0x1b0fd2d65116e30353980b5c02b476b7b9eb85b8

And I guess we’re already falling behind by quite a bit. No sure how many deposits and withdrawals are pending for update but likely more than a 1000.

I think we need to look for a sustainable solution here.

Updating tree with a snark should cost about 300k gas per batch, and its size can be chosen arbitrarily (but all batches will be the same size). For example for a batch size of 128 (~1 day of deposits) the cost of update will be ~50x cheaper. Will post some more info in the coming days.

That would definitely be amazing! I think you could even push it up to 256 deposits. I would expect the rate of deposits to increase once TORN is tradable. Looking forward to learn more.

Looking forward to an early update. The current update progress is much behind.

thanks