mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
update readme
This commit is contained in:
parent
1af36c8475
commit
1a050950ab
23
.env.example
23
.env.example
@ -1,21 +1,24 @@
|
|||||||
NET_ID=42
|
NET_ID=1
|
||||||
HTTP_RPC_URL=https://kovan.infura.io
|
HTTP_RPC_URL=https://mainnet.infura.io
|
||||||
WS_RPC_URL=wss://kovan.infura.io/ws/v3/
|
WS_RPC_URL=wss://mainnet.infura.io/ws/v3/
|
||||||
# ORACLE_RPC_URL should always point to the mainnet
|
# ORACLE_RPC_URL should always point to the mainnet
|
||||||
ORACLE_RPC_URL=https://mainnet.infura.io
|
ORACLE_RPC_URL=https://mainnet.infura.io
|
||||||
REDIS_URL=redis://127.0.0.1:6379
|
REDIS_URL=redis://127.0.0.1:6379
|
||||||
|
|
||||||
# without 0x prefix
|
# DNS settings
|
||||||
PRIVATE_KEY=
|
VIRTUAL_HOST=example.duckdns.org
|
||||||
# 2.5 means 2.5%
|
LETSENCRYPT_HOST=example.duckdns.org
|
||||||
REGULAR_TORNADO_WITHDRAW_FEE=2.5
|
|
||||||
MINING_SERVICE_FEE=2.5
|
|
||||||
APP_PORT=8000
|
APP_PORT=8000
|
||||||
|
|
||||||
|
# without 0x prefix
|
||||||
|
PRIVATE_KEY=
|
||||||
|
# 0.05 means 0.05%
|
||||||
|
REGULAR_TORNADO_WITHDRAW_FEE=0.05
|
||||||
|
MINING_SERVICE_FEE=0.05
|
||||||
TORN_ETH_PRICE=7000000000000000
|
TORN_ETH_PRICE=7000000000000000
|
||||||
REWARD_ACCOUNT=
|
REWARD_ACCOUNT=
|
||||||
|
CONFIRMATIONS=4
|
||||||
|
|
||||||
# in GWEI
|
# in GWEI
|
||||||
MAX_GAS_PRICE=1000
|
MAX_GAS_PRICE=1000
|
||||||
CONFIRMATIONS=8
|
AGGREGATOR=0x8cb1436F64a3c33aD17bb42F94e255c4c0E871b2
|
||||||
AGGREGATOR=0x466121060aD4dCE1E421027297d7e263236cbfc3
|
|
||||||
|
76
README.md
76
README.md
@ -1,5 +1,27 @@
|
|||||||
# Relayer for Tornado Cash [![Build Status](https://github.com/tornadocash/relayer/workflows/build/badge.svg)](https://github.com/tornadocash/relayer/actions) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/tornadocash/relayer?logo=docker&logoColor=%23FFFFFF&sort=semver)](https://hub.docker.com/repository/docker/tornadocash/relayer)
|
# Relayer for Tornado Cash [![Build Status](https://github.com/tornadocash/relayer/workflows/build/badge.svg)](https://github.com/tornadocash/relayer/actions) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/tornadocash/relayer?logo=docker&logoColor=%23FFFFFF&sort=semver)](https://hub.docker.com/repository/docker/tornadocash/relayer)
|
||||||
|
|
||||||
|
## 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
|
||||||
|
2. Setup environment variables
|
||||||
|
- set `NET_ID` (1 for mainnet, 5 for Goerli)
|
||||||
|
- set `HTTP_RPC_URL` rpc url for your ethereum node
|
||||||
|
- set `WS_RPC_URL` websocket url
|
||||||
|
- set `ORACLE_RPC_URL` - rpc url for mainnet node for fetching prices(always have to be on mainnet)
|
||||||
|
- 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 `TORN_ETH_PRICE` - TORN/ETH rate that relayer will use to calculate fee for mining claim and swap
|
||||||
|
- set `MINING_SERVICE_FEE` - fee in % that is used for mining AP withdrawals
|
||||||
|
- set `REWARD_ACCOUNT` - eth address that is used to collect fees
|
||||||
|
- update `AGGREGATOR` if needed - Contract address of aggregator instance.
|
||||||
|
- 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. 3. Run `docker-compose up -d`
|
||||||
|
|
||||||
## Run locally
|
## Run locally
|
||||||
|
|
||||||
1. `npm i`
|
1. `npm i`
|
||||||
@ -9,58 +31,10 @@
|
|||||||
5. Go to `http://127.0.0.1:8000`
|
5. Go to `http://127.0.0.1:8000`
|
||||||
6. In order to execute withdraw request, you can run following command
|
6. In order to execute withdraw request, you can run following command
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -X POST -H 'content-type:application/json' --data '<input data>' http://127.0.0.1:8000/relay
|
|
||||||
```
|
|
||||||
|
|
||||||
Relayer should return a transaction hash.
|
|
||||||
|
|
||||||
_Note._ If you want to change contracts' addresses go to [config.js](./config.js) file.
|
|
||||||
|
|
||||||
## 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
|
|
||||||
2. Change environment variables for `kovan` containers as appropriate
|
|
||||||
- add `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
|
|
||||||
- customize `RELAYER_FEE`
|
|
||||||
- update `RPC_URL` if needed
|
|
||||||
- update `REDIS_URL` if needed
|
|
||||||
3. Run `docker-compose up -d`
|
|
||||||
|
|
||||||
## Run as a Docker container
|
|
||||||
|
|
||||||
1. `cp .env.example .env`
|
|
||||||
2. Modify `.env` as needed
|
|
||||||
3. `docker run -d --env-file .env -p 80:8000 tornadocash/relayer`
|
|
||||||
|
|
||||||
In that case you will need to add https termination yourself because browsers with default settings will prevent https
|
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
|
tornado.cash UI from submitting your request over http connection
|
||||||
|
|
||||||
## Input data example
|
## Architecture
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"proof": "0x0f8cb4c2ca9cbb23a5f21475773e19e39d3470436d7296f25c8730d19d88fcef2986ec694ad094f4c5fff79a4e5043bd553df20b23108bc023ec3670718143c20cc49c6d9798e1ae831fd32a878b96ff8897728f9b7963f0d5a4b5574426ac6203b2456d360b8e825d8f5731970bf1fc1b95b9713e3b24203667ecdd5939c2e40dec48f9e51d9cc8dc2f7f3916f0e9e31519c7df2bea8c51a195eb0f57beea4924cb846deaa78cdcbe361a6c310638af6f6157317bc27d74746bfaa2e1f8d2e9088fd10fa62100740874cdffdd6feb15c95c5a303f6bc226d5e51619c5b825471a17ddfeb05b250c0802261f7d05cf29a39a72c13e200e5bc721b0e4c50d55e6",
|
|
||||||
"args": [
|
|
||||||
"0x1579d41e5290ab5bcec9a7df16705e49b5c0b869095299196c19c5e14462c9e3",
|
|
||||||
"0x0cf7f49c5b35c48b9e1d43713e0b46a75977e3d10521e9ac1e4c3cd5e3da1c5d",
|
|
||||||
"0x03ebd0748aa4d1457cf479cce56309641e0a98f5",
|
|
||||||
"0xbd4369dc854c5d5b79fe25492e3a3cfcb5d02da5",
|
|
||||||
"0x000000000000000000000000000000000000000000000000058d15e176280000",
|
|
||||||
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
],
|
|
||||||
"contract": "0xA27E34Ad97F171846bAf21399c370c9CE6129e0D"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## New relayer 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
|
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
|
2. Server module is Express.js instance that accepts http requests
|
||||||
@ -69,3 +43,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
5. Status module contains handler to get a Job status. It's used by UI for pull updates
|
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
|
6. Validate contains validation logic for all endpoints
|
||||||
7. Worker is the main module that gets a Job from queue and processes it
|
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.
|
||||||
|
@ -7,8 +7,6 @@ services:
|
|||||||
command: server
|
command: server
|
||||||
env_file: .env
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
VIRTUAL_HOST: example.duckdns.org
|
|
||||||
LETSENCRYPT_HOST: example.duckdns.org
|
|
||||||
REDIS_URL: redis://redis/0
|
REDIS_URL: redis://redis/0
|
||||||
nginx_proxy_read_timeout: 600
|
nginx_proxy_read_timeout: 600
|
||||||
depends_on: [redis]
|
depends_on: [redis]
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"prettier:check": "npx prettier --check . --config .prettierrc",
|
"prettier:check": "npx prettier --check . --config .prettierrc",
|
||||||
"prettier:fix": "npx prettier --write . --config .prettierrc",
|
"prettier:fix": "npx prettier --write . --config .prettierrc",
|
||||||
"lint": "yarn eslint && yarn prettier:check",
|
"lint": "yarn eslint && yarn prettier:check",
|
||||||
"test": "mocha"
|
"test": "mocha",
|
||||||
|
"start": "yarn server & yarn priceWatcher & yarn treeWatcher & yarn worker "
|
||||||
},
|
},
|
||||||
"author": "tornado.cash",
|
"author": "tornado.cash",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user