update readme

This commit is contained in:
smart_ex 2022-07-28 18:12:34 +10:00
parent 0ce5dcbf50
commit 32b7714371

@ -2,7 +2,8 @@
## Deploy with docker-compose ## 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. 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](/docker-compose.yml) and [.env.example](/.env.example) 1. Download [docker-compose.yml](/docker-compose.yml) and [.env.example](/.env.example)
@ -13,60 +14,110 @@ wget https://raw.githubusercontent.com/tornadocash/tornado-relayer/master/.env.e
2. Setup environment variables 2. Setup environment variables
- set `NET_ID` (1 for mainnet, 5 for Goerli) - set `NET_ID` (1 for mainnet, [networks list](#compatible-networks))
- set `HTTP_RPC_URL` rpc url for your ethereum node - 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 `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 `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 `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 `REGULAR_TORNADO_WITHDRAW_FEE` - fee in % that is used for tornado pool withdrawals
- set `MINING_SERVICE_FEE` - fee in % that is used for mining AP withdrawals
- set `REWARD_ACCOUNT` - eth address that is used to collect fees - set `REWARD_ACCOUNT` - eth address that is used to collect fees
- update `AGGREGATOR` if needed - Contract address of aggregator instance. - 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 `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 - update `MAX_GAS_PRICE` if needed - maximum value of gwei value for relayer's transaction
- update `BASE_FEE_RESERVE_PERCENTAGE` if needed - how much in % will the network baseFee increase - update `BASE_FEE_RESERVE_PERCENTAGE` if needed - how much in % will the network baseFee increase
- set `TELEGRAM_NOTIFIER_BOT_TOKEN` and `TELEGRAM_NOTIFIER_CHAT_ID` if your want get notify to telegram
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. 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` 3. Run `docker-compose up -d`
## V5 Migration Guide
This guide is intended to help with migration from Relayer v4 to v5.
1. Stop relayer
```
docker-compose down
```
2. Download the latest version of relayer`s docker compose file
```
wget https://raw.githubusercontent.com/tornadocash/tornado-relayer/master/docker-compose.yml
```
3. Check your environment variables, add new ones if needed
4. Run updated docker compose file
```
docker-compose up -d --pull
```
## Run locally ## Run locally
1. `yarn` 1. `yarn`
2. `cp .env.example .env` 2. `cp .env.example .env`
3. Modify `.env` as needed 3. Modify `.env` as needed
4. `yarn start` 4. `docker-compose up -d redis`
5. Go to `http://127.0.0.1:8000` 5. `yarn start`
6. In order to execute withdraw request, you can run following command 6. Go to `http://127.0.0.1:8000`
7. In order to execute withdraw request, you can run following command
```bash ```bash
curl -X POST -H 'content-type:application/json' --data '<input data>' http://127.0.0.1:8000/relay curl -X POST -H 'content-type:application/json' --data '<input data>' http://127.0.0.1:8000/v1/tornadoWithdraw
``` ```
Relayer should return a transaction hash Relayer should return a job id in uuid v4 format.
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
## Run geth node ## Run geth node
It is strongly recommended that you use your own RPC node. Instruction on how to run full node with `geth` can be found [here](https://github.com/feshchenkod/rpc-nodes). It is strongly recommended that you use your own RPC node. Instruction on how to run full node with `geth` can be
found [here](https://github.com/feshchenkod/rpc-nodes).
## Monitoring ## Monitoring
### Basic
For basic monitoring setup telegram bot and fill variables in .env file
Alerts about:
- Main relayer currency balance
- Torn balance
- Withdraw transactions send errors
How to create bot: https://core.telegram.org/bots#3-how-do-i-create-a-bot
How to get chat
id: https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id/32572159#32572159
### Advanced
You can find the guide on how to install the Zabbix server in the [/monitoring/README.md](/monitoring/README.md). You can find the guide on how to install the Zabbix server in the [/monitoring/README.md](/monitoring/README.md).
## Architecture ## Compatible networks
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 - Ethereum Mainnet (1)
2. Server module is Express.js instance that accepts http requests - Binance Smart Chain (56)
3. Controller contains handlers for the Server endpoints. It validates input data and adds a Job to Queue. - Polygon (Matic) Network (137)
4. Queue module is used by Controller to put and get Job from queue (bull wrapper) - Optimism (10)
5. Status module contains handler to get a Job status. It's used by UI for pull updates - Arbitrum One (42161)
6. Validate contains validation logic for all endpoints - Gnosis Chain (100)
7. Worker is the main module that gets a Job from queue and processes it - Avalanche Mainnet (43114)
- Ethereum Goerli (5)
Disclaimer: 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. 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.