Tornado Cash Classic relayer software.
Go to file
2023-07-02 17:52:39 -07:00
.github/workflows fix: workflow 2022-04-13 21:52:53 +10:00
abis fix: calculate optimism l1 fee 2022-05-31 00:13:07 +10:00
src fix: calculate optimism l1 fee 2022-05-31 00:13:07 +10:00
test fix isKnownContract validation 2022-05-25 19:25:58 +10:00
.dockerignore fix timeouts under high load in nginx and express, fix redis persistence 2019-12-13 19:32:09 +07:00
.editorconfig watcher 2020-05-08 20:29:31 +03:00
.env.example Set default fee for sidechains as 0.1% - calculation formula here: https://docs.tornado.ws/general/guides/relayer.html 2023-07-02 17:44:53 -07:00
.eslintrc.json prettier + tidy 2020-10-02 13:26:05 +03:00
.gitignore fix: gas limit for cDAI 2021-05-31 19:22:22 +03:00
.prettierignore prettier + tidy 2020-10-02 13:26:05 +03:00
.prettierrc prettier + tidy 2020-10-02 13:26:05 +03:00
app.js linter 2020-08-04 10:39:56 +03:00
docker-compose.test.yml light relayer 2021-06-03 17:23:30 +03:00
docker-compose.yml light relayer 2021-06-03 17:23:30 +03:00
Dockerfile update refs 2020-12-16 00:15:51 +03:00
package.json Bump gas-price-oracle to correct gas estimation & add 'concurrently' and change 'start' command, because if run server without concurrently, worker and healthWatcher wont be started 2023-07-02 17:52:39 -07:00
README.md Update README.md 2022-04-13 21:11:45 +10:00
yarn.lock bump tx-manager 2022-05-25 19:25:58 +10:00

Relayer for Tornado Cash Build Status Docker Image Version (latest semver)

Deploy with docker-compose

docker-compose.yml contains a stack that will automatically provision SSL certificates for your domain name and will add a https redirect to port 80.

  1. Download docker-compose.yml and .env.example
wget https://raw.githubusercontent.com/tornadocash/tornado-relayer/light/docker-compose.yml
wget https://raw.githubusercontent.com/tornadocash/tornado-relayer/light/.env.example -O .env
  1. Setup environment variables

    • set NET_ID (1 for mainnet, 5 for Goerli)

    • set HTTP_RPC_URL rpc url for your ethereum node

    • set PRIVATE_KEY for your relayer address (without 0x prefix)

    • set VIRTUAL_HOST and LETSENCRYPT_HOST to your domain and add DNS record pointing to your relayer ip address

    • set REGULAR_TORNADO_WITHDRAW_FEE - fee in % that is used for tornado pool withdrawals

    • set REWARD_ACCOUNT - eth address that is used to collect fees

    • update CONFIRMATIONS if needed - how many block confirmations to wait before processing an event. Not recommended to set less than 3

    • update MAX_GAS_PRICE if needed - maximum value of gwei value for relayer's transaction

      If you want to use more than 1 eth address for relaying transactions, please add as many workers as you want. For example, you can comment out worker2 in docker-compose.yml file, but please use a different PRIVATE_KEY for each worker.

  2. Run docker-compose up -d

Run locally

  1. yarn
  2. cp .env.example .env
  3. Modify .env as needed
  4. yarn start
  5. Go to http://127.0.0.1:8000
  6. In order to execute withdraw request, you can run following command
curl -X POST -H 'content-type:application/json' --data '<input data>' http://127.0.0.1:8000/relay

Relayer should return a transaction hash

In that case you will need to add https termination yourself because browsers with default settings will prevent https tornado.cash UI from submitting your request over http connection

Run own RPC nodes

It is strongly recommended that you use your own RPC nodes. Instruction on how to run full nodes can be found here.

Architecture

  1. TreeWatcher module keeps track of Account Tree changes and automatically caches the actual state in Redis and emits treeUpdate event to redis pub/sub channel
  2. Server module is Express.js instance that accepts http requests
  3. Controller contains handlers for the Server endpoints. It validates input data and adds a Job to Queue.
  4. Queue module is used by Controller to put and get Job from queue (bull wrapper)
  5. Status module contains handler to get a Job status. It's used by UI for pull updates
  6. Validate contains validation logic for all endpoints
  7. Worker is the main module that gets a Job from queue and processes it

Disclaimer:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.