Compare commits

...

4 Commits

4 changed files with 747 additions and 738 deletions

673
README.md

@ -2,10 +2,8 @@
Command line tool to interact with [Tornado Cash](https://tornado.ws). Command line tool to interact with [Tornado Cash](https://tornado.ws).
### Warning!
Current cli version doesn't support [Anonymity Mining](https://tornado-cash.medium.com/tornado-cash-governance-proposal-a55c5c7d0703)
### How to install tornado cli ### How to install tornado cli
Download and install [node.js](https://nodejs.org/en/download/). Download and install [node.js](https://nodejs.org/en/download/).
You also need to install C++ build tools in order to do 'npm install', for more information please checkout https://github.com/nodejs/node-gyp#on-unix. You also need to install C++ build tools in order to do 'npm install', for more information please checkout https://github.com/nodejs/node-gyp#on-unix.
@ -36,6 +34,7 @@ If you want to use Tor connection to conceal ip address, install [Tor Browser](h
Note that you should reset your tor connection by restarting the browser every time when you deposit & withdraw otherwise you will have the same exit node used for connection. Note that you should reset your tor connection by restarting the browser every time when you deposit & withdraw otherwise you will have the same exit node used for connection.
### Goerli, Mainnet, Binance Smart Chain, Gnosis Chain, Polygon Network, Arbitrum, Avalanche ### Goerli, Mainnet, Binance Smart Chain, Gnosis Chain, Polygon Network, Arbitrum, Avalanche
1. `node cli.js --help` 1. `node cli.js --help`
2. If you want to use secure, anonymous tor connection add `--tor <torPort>` behind the command. 2. If you want to use secure, anonymous tor connection add `--tor <torPort>` behind the command.
3. Add `PRIVATE_KEY` to `.env` file (optional, only if you want to use it for many operations) - open `.env.example` file, add private key after `PRIVATE_KEY=` and rename file to `.env`. 3. Add `PRIVATE_KEY` to `.env` file (optional, only if you want to use it for many operations) - open `.env.example` file, add private key after `PRIVATE_KEY=` and rename file to `.env`.
@ -51,6 +50,7 @@ Note that `--tor <torPort>` is optional, and use `--private-key <private key>` o
For RPC nodes please refer to the list of public RPC nodes below. For RPC nodes please refer to the list of public RPC nodes below.
##### Example: ##### Example:
```bash ```bash
$ node cli.js deposit ETH 0.1 --rpc https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607 --tor 9150 $ node cli.js deposit ETH 0.1 --rpc https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607 --tor 9150
@ -91,6 +91,7 @@ Done
``` ```
### (Optional) Creating Deposit Notes & Invoices offline ### (Optional) Creating Deposit Notes & Invoices offline
One of the main features of tornado-cli is that it supports creating deposit notes & invoices inside the offline computing environment. One of the main features of tornado-cli is that it supports creating deposit notes & invoices inside the offline computing environment.
After the private-key like notes are backed up somewhere safe, you can copy the created deposit invoices and use them to create new deposit transaction on online environment. After the private-key like notes are backed up somewhere safe, you can copy the created deposit invoices and use them to create new deposit transaction on online environment.
@ -144,348 +145,348 @@ Sender account balance is x.xxxxxxx ETH
```json ```json
{ {
"netId1":{ "netId1": {
"rpcUrls":{ "rpcUrls": {
"publicRpc1":{ "publicRpc1": {
"name":"1RPC", "name": "1RPC",
"url":"https://1rpc.io/eth" "url": "https://1rpc.io/eth"
},
"Chainnodes":{
"name": "Chainnodes",
"url": "https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
}, },
"relayers": { "Chainnodes": {
"0xproxy.eth": { "name": "Chainnodes",
"url": "0xproxy.eth", "url": "https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
"name": "0xproxy.eth",
"cachedUrl": "http://mainnet.0x0relayer.xyz/"
},
"0xtornadocash.eth": {
"url": "0xtornadocash.eth",
"name": "0xtornadocash.eth",
"cachedUrl": "http://mainnet-tornado-0xtornadocash-eth.crypto-bot.exchange/"
},
"available-reliable-relayer.eth": {
"url": "available-reliable-relayer.eth",
"name": "available-reliable-relayer.eth",
"cachedUrl": "http://mainnet-tornado-arr-eth.crypto-bot.exchange/"
},
"bitah.eth": {
"url": "bitah.eth",
"name": "bitah.eth",
"cachedUrl": "http://tornado.bitah.link/"
},
"cheap-relayer.eth": {
"url": "cheap-relayer.eth",
"name": "cheap-relayer.eth",
"cachedUrl": "http://mainnet-tornado.cheap-relayer.xyz/"
},
"em3tornado.eth": {
"url": "em3tornado.eth",
"name": "em3tornado.eth",
"cachedUrl": "http://em3torn.com/"
},
"lowcost.eth": {
"url": "lowcost.eth",
"name": "lowcost.eth",
"cachedUrl": "http://mainnet-tornado.low-fee.xyz/"
},
"relayer007.eth": {
"url": "relayer007.eth",
"name": "relayer007.eth",
"cachedUrl": "http://torn.relayersdao.finance/"
},
"reltor.eth": {
"url": "reltor.eth",
"name": "reltor.eth",
"cachedUrl": "http://reltor.su/"
},
"shadow-out.eth": {
"url": "shadow-out.eth",
"name": "shadow-out.eth",
"cachedUrl": "http://torn-relayer.shadowninjas.xyz/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://thornadope.xyz/"
},
"torn-eth.eth": {
"url": "torn-eth.eth",
"name": "torn-eth.eth",
"cachedUrl": "http://mainnet-tornado.50swap.com/"
},
"torn-relayers.eth": {
"url": "torn-relayers.eth",
"name": "torn-relayers.eth",
"cachedUrl": "http://mainnet.tornrelayers.com/"
},
"torn-secure.eth": {
"url": "torn-secure.eth",
"name": "torn-secure.eth",
"cachedUrl": "http://mainnet-tornado.secure-relays.site/"
},
"torn69.eth": {
"url": "torn69.eth",
"name": "torn69.eth",
"cachedUrl": "http://m2.torn69.gq/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://eth-tornado.zkany.com/"
},
"tornrelayers.eth": {
"url": "tornrelayers.eth",
"name": "tornrelayers.eth",
"cachedUrl": "http://mainnet-tornado-tornrelayer-eth.crypto-bot.exchange/"
}
}
},
"netId56":{
"rpcUrls":{
"publicRpc1":{
"name":"BSC Public RPC 1",
"url":"https://1rpc.io/bnb"
},
"publicRpc2":{
"name":"BSC Public RPC 2",
"url":"https://bsc-dataseed1.defibit.io"
},
"publicRpc3":{
"name":"BSC Public RPC 3",
"url":"https://bsc-dataseed1.ninicoin.io"
},
},
"relayers": {
"0xproxy.eth": {
"url": "0xproxy.eth",
"name": "0xproxy.eth",
"cachedUrl": "http://bsc.0x0relayer.xyz/"
},
"bitah.eth": {
"url": "bitah.eth",
"name": "bitah.eth",
"cachedUrl": "http://bsc-tornado.bitah.link/"
},
"cheap-relayer.eth": {
"url": "cheap-relayer.eth",
"name": "cheap-relayer.eth",
"cachedUrl": "http://bsc-tornado.cheap-relayer.xyz/"
},
"em3tornado.eth": {
"url": "em3tornado.eth",
"name": "em3tornado.eth",
"cachedUrl": "http://bsc.em3torn.com/"
},
"lowcost.eth": {
"url": "lowcost.eth",
"name": "lowcost.eth",
"cachedUrl": "http://bsc-tornado.low-fee.xyz/"
},
"relayer007.eth": {
"url": "relayer007.eth",
"name": "relayer007.eth",
"cachedUrl": "http://bsc.relayersdao.finance/"
},
"reltor.eth": {
"url": "reltor.eth",
"name": "reltor.eth",
"cachedUrl": "http://bsc.reltor.su/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://tornado-bsc.thornadope.xyz/"
},
"torn-relay.eth": {
"url": "torn-relay.eth",
"name": "torn-relay.eth",
"cachedUrl": "http://bsc.torn-relay.com/"
},
"torn-relayers.eth": {
"url": "torn-relayers.eth",
"name": "torn-relayers.eth",
"cachedUrl": "http://bsc.tornrelayers.com/"
},
"torn-secure.eth": {
"url": "torn-secure.eth",
"name": "torn-secure.eth",
"cachedUrl": "http://bsc-v0.secure-relays.site/"
},
"torn69.eth": {
"url": "torn69.eth",
"name": "torn69.eth",
"cachedUrl": "http://bsc.0x111111.xyz/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-bsc.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://bsc-tornado.zkany.com/"
}
}
},
"netId100":{
"rpcUrls":{
"publicRpc":{
"name":"Gnosis Chain RPC",
"url":"https://rpc.gnosischain.com"
}
},
"relayers":{
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://gnosis-tornado.zkany.com/"
}
} }
}, },
"netId137":{ "relayers": {
"rpcUrls":{ "0xproxy.eth": {
"publicRpc1":{ "url": "0xproxy.eth",
"name":"1RPC", "name": "0xproxy.eth",
"url":"https://1rpc.io/matic" "cachedUrl": "http://mainnet.0x0relayer.xyz/"
},
"Chainnodes":{
"name": "Chainnodes",
"url": "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
}, },
"relayers": { "0xtornadocash.eth": {
"cheap-relayer.eth": { "url": "0xtornadocash.eth",
"url": "cheap-relayer.eth", "name": "0xtornadocash.eth",
"name": "cheap-relayer.eth", "cachedUrl": "http://mainnet-tornado-0xtornadocash-eth.crypto-bot.exchange/"
"cachedUrl": "http://polygon-tornado.cheap-relayer.xyz/" },
}, "available-reliable-relayer.eth": {
"lowcost.eth": { "url": "available-reliable-relayer.eth",
"url": "lowcost.eth", "name": "available-reliable-relayer.eth",
"name": "lowcost.eth", "cachedUrl": "http://mainnet-tornado-arr-eth.crypto-bot.exchange/"
"cachedUrl": "http://polygon-tornado.low-fee.xyz/" },
}, "bitah.eth": {
"relayer007.eth": { "url": "bitah.eth",
"url": "relayer007.eth", "name": "bitah.eth",
"name": "relayer007.eth", "cachedUrl": "http://tornado.bitah.link/"
"cachedUrl": "http://matic.relayersdao.finance/" },
}, "cheap-relayer.eth": {
"reltor.eth": { "url": "cheap-relayer.eth",
"url": "reltor.eth", "name": "cheap-relayer.eth",
"name": "reltor.eth", "cachedUrl": "http://mainnet-tornado.cheap-relayer.xyz/"
"cachedUrl": "http://polygon.reltor.su/" },
}, "em3tornado.eth": {
"thornadope.eth": { "url": "em3tornado.eth",
"url": "thornadope.eth", "name": "em3tornado.eth",
"name": "thornadope.eth", "cachedUrl": "http://em3torn.com/"
"cachedUrl": "http://tornado-polygon.thornadope.xyz/" },
}, "lowcost.eth": {
"torn-secure.eth": { "url": "lowcost.eth",
"url": "torn-secure.eth", "name": "lowcost.eth",
"name": "torn-secure.eth", "cachedUrl": "http://mainnet-tornado.low-fee.xyz/"
"cachedUrl": "http://poly-v0.secure-relays.site/" },
}, "relayer007.eth": {
"tornado-crypto-bot-exchange.eth": { "url": "relayer007.eth",
"url": "tornado-crypto-bot-exchange.eth", "name": "relayer007.eth",
"name": "tornado-crypto-bot-exchange.eth", "cachedUrl": "http://torn.relayersdao.finance/"
"cachedUrl": "http://tornado-polygon.crypto-bot.exchange/" },
}, "reltor.eth": {
"torndao.eth": { "url": "reltor.eth",
"url": "torndao.eth", "name": "reltor.eth",
"name": "torndao.eth", "cachedUrl": "http://reltor.su/"
"cachedUrl": "http://polygon-tornado.zkany.com/" },
} "shadow-out.eth": {
"url": "shadow-out.eth",
"name": "shadow-out.eth",
"cachedUrl": "http://torn-relayer.shadowninjas.xyz/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://thornadope.xyz/"
},
"torn-eth.eth": {
"url": "torn-eth.eth",
"name": "torn-eth.eth",
"cachedUrl": "http://mainnet-tornado.50swap.com/"
},
"torn-relayers.eth": {
"url": "torn-relayers.eth",
"name": "torn-relayers.eth",
"cachedUrl": "http://mainnet.tornrelayers.com/"
},
"torn-secure.eth": {
"url": "torn-secure.eth",
"name": "torn-secure.eth",
"cachedUrl": "http://mainnet-tornado.secure-relays.site/"
},
"torn69.eth": {
"url": "torn69.eth",
"name": "torn69.eth",
"cachedUrl": "http://m2.torn69.gq/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://eth-tornado.zkany.com/"
},
"tornrelayers.eth": {
"url": "tornrelayers.eth",
"name": "tornrelayers.eth",
"cachedUrl": "http://mainnet-tornado-tornrelayer-eth.crypto-bot.exchange/"
} }
}, }
"netId42161":{ },
"rpcUrls":{ "netId56": {
"publicRpc1":{ "rpcUrls": {
"name":"Arbitrum Public RPC", "publicRpc1": {
"url":"https://arb1.arbitrum.io/rpc" "name": "BSC Public RPC 1",
}, "url": "https://1rpc.io/bnb"
"publicRpc2":{
"name": "ChainnodesRPC",
"url": "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
}, },
"relayers":{ "publicRpc2": {
"tornado-crypto-bot-exchange.eth": { "name": "BSC Public RPC 2",
"url": "tornado-crypto-bot-exchange.eth", "url": "https://bsc-dataseed1.defibit.io"
"name": "tornado-crypto-bot-exchange.eth", },
"cachedUrl": "http://tornado-arbitrum.crypto-bot.exchange/" "publicRpc3": {
}, "name": "BSC Public RPC 3",
"torndao.eth": { "url": "https://bsc-dataseed1.ninicoin.io"
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://arbitrum-tornado.zkany.com/"
}
} }
}, },
"netId43114":{ "relayers": {
"rpcUrls":{ "0xproxy.eth": {
"publicRpc":{ "url": "0xproxy.eth",
"name":"1RPC", "name": "0xproxy.eth",
"url":"https://1rpc.io/avax/c" "cachedUrl": "http://bsc.0x0relayer.xyz/"
}
}, },
"relayers":{ "bitah.eth": {
"cheap-relayer.eth": { "url": "bitah.eth",
"url": "cheap-relayer.eth", "name": "bitah.eth",
"name": "cheap-relayer.eth", "cachedUrl": "http://bsc-tornado.bitah.link/"
"cachedUrl": "http://avalanche-tornado.cheap-relayer.xyz/" },
}, "cheap-relayer.eth": {
"lowcost.eth": { "url": "cheap-relayer.eth",
"url": "lowcost.eth", "name": "cheap-relayer.eth",
"name": "lowcost.eth", "cachedUrl": "http://bsc-tornado.cheap-relayer.xyz/"
"cachedUrl": "http://avalanche-tornado.low-fee.xyz/" },
}, "em3tornado.eth": {
"thornadope.eth": { "url": "em3tornado.eth",
"url": "thornadope.eth", "name": "em3tornado.eth",
"name": "thornadope.eth", "cachedUrl": "http://bsc.em3torn.com/"
"cachedUrl": "http://tornado-avalanche.thornadope.xyz/" },
}, "lowcost.eth": {
"tornado-crypto-bot-exchange.eth": { "url": "lowcost.eth",
"url": "tornado-crypto-bot-exchange.eth", "name": "lowcost.eth",
"name": "tornado-crypto-bot-exchange.eth", "cachedUrl": "http://bsc-tornado.low-fee.xyz/"
"cachedUrl": "http://tornado-avalanche.crypto-bot.exchange/" },
} "relayer007.eth": {
"url": "relayer007.eth",
"name": "relayer007.eth",
"cachedUrl": "http://bsc.relayersdao.finance/"
},
"reltor.eth": {
"url": "reltor.eth",
"name": "reltor.eth",
"cachedUrl": "http://bsc.reltor.su/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://tornado-bsc.thornadope.xyz/"
},
"torn-relay.eth": {
"url": "torn-relay.eth",
"name": "torn-relay.eth",
"cachedUrl": "http://bsc.torn-relay.com/"
},
"torn-relayers.eth": {
"url": "torn-relayers.eth",
"name": "torn-relayers.eth",
"cachedUrl": "http://bsc.tornrelayers.com/"
},
"torn-secure.eth": {
"url": "torn-secure.eth",
"name": "torn-secure.eth",
"cachedUrl": "http://bsc-v0.secure-relays.site/"
},
"torn69.eth": {
"url": "torn69.eth",
"name": "torn69.eth",
"cachedUrl": "http://bsc.0x111111.xyz/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-bsc.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://bsc-tornado.zkany.com/"
} }
}, }
"netId10":{ },
"rpcUrls":{ "netId100": {
"publicRpc1":{ "rpcUrls": {
"name":"1RPC", "publicRpc": {
"url":"https://1rpc.io/op" "name": "Gnosis Chain RPC",
}, "url": "https://rpc.gnosischain.com"
"Chainnodes":{
"name": "Chainnodes",
"url": "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
},
"relayers":{
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-optimism.crypto-bot.exchange/"
}
} }
}, },
"netId5":{ "relayers": {
"rpcUrls":{ "torndao.eth": {
"Chainnodes":{ "url": "torndao.eth",
"name":"Chainnodes RPC", "name": "torndao.eth",
"url":"https://goerli.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607" "cachedUrl": "http://gnosis-tornado.zkany.com/"
} }
}
},
"netId137": {
"rpcUrls": {
"publicRpc1": {
"name": "1RPC",
"url": "https://1rpc.io/matic"
}, },
"relayers":{} "Chainnodes": {
} "name": "Chainnodes",
"url": "https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
},
"relayers": {
"cheap-relayer.eth": {
"url": "cheap-relayer.eth",
"name": "cheap-relayer.eth",
"cachedUrl": "http://polygon-tornado.cheap-relayer.xyz/"
},
"lowcost.eth": {
"url": "lowcost.eth",
"name": "lowcost.eth",
"cachedUrl": "http://polygon-tornado.low-fee.xyz/"
},
"relayer007.eth": {
"url": "relayer007.eth",
"name": "relayer007.eth",
"cachedUrl": "http://matic.relayersdao.finance/"
},
"reltor.eth": {
"url": "reltor.eth",
"name": "reltor.eth",
"cachedUrl": "http://polygon.reltor.su/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://tornado-polygon.thornadope.xyz/"
},
"torn-secure.eth": {
"url": "torn-secure.eth",
"name": "torn-secure.eth",
"cachedUrl": "http://poly-v0.secure-relays.site/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-polygon.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://polygon-tornado.zkany.com/"
}
}
},
"netId42161": {
"rpcUrls": {
"publicRpc1": {
"name": "Arbitrum Public RPC",
"url": "https://arb1.arbitrum.io/rpc"
},
"publicRpc2": {
"name": "ChainnodesRPC",
"url": "https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
},
"relayers": {
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-arbitrum.crypto-bot.exchange/"
},
"torndao.eth": {
"url": "torndao.eth",
"name": "torndao.eth",
"cachedUrl": "http://arbitrum-tornado.zkany.com/"
}
}
},
"netId43114": {
"rpcUrls": {
"publicRpc": {
"name": "1RPC",
"url": "https://1rpc.io/avax/c"
}
},
"relayers": {
"cheap-relayer.eth": {
"url": "cheap-relayer.eth",
"name": "cheap-relayer.eth",
"cachedUrl": "http://avalanche-tornado.cheap-relayer.xyz/"
},
"lowcost.eth": {
"url": "lowcost.eth",
"name": "lowcost.eth",
"cachedUrl": "http://avalanche-tornado.low-fee.xyz/"
},
"thornadope.eth": {
"url": "thornadope.eth",
"name": "thornadope.eth",
"cachedUrl": "http://tornado-avalanche.thornadope.xyz/"
},
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-avalanche.crypto-bot.exchange/"
}
}
},
"netId10": {
"rpcUrls": {
"publicRpc1": {
"name": "1RPC",
"url": "https://1rpc.io/op"
},
"Chainnodes": {
"name": "Chainnodes",
"url": "https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
},
"relayers": {
"tornado-crypto-bot-exchange.eth": {
"url": "tornado-crypto-bot-exchange.eth",
"name": "tornado-crypto-bot-exchange.eth",
"cachedUrl": "http://tornado-optimism.crypto-bot.exchange/"
}
}
},
"netId5": {
"rpcUrls": {
"Chainnodes": {
"name": "Chainnodes RPC",
"url": "https://goerli.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607"
}
},
"relayers": {}
}
} }
``` ```

22
cli.js

@ -10,14 +10,13 @@ const circomlib = require('@tornado/circomlib');
const bigInt = snarkjs.bigInt; const bigInt = snarkjs.bigInt;
const merkleTree = require('@tornado/fixed-merkle-tree'); const merkleTree = require('@tornado/fixed-merkle-tree');
const Web3 = require('web3'); const Web3 = require('web3');
const Web3HttpProvider = require('@tornado/web3-providers-http');
const buildGroth16 = require('@tornado/websnark/src/groth16'); const buildGroth16 = require('@tornado/websnark/src/groth16');
const websnarkUtils = require('@tornado/websnark/src/utils'); const websnarkUtils = require('@tornado/websnark/src/utils');
const { toWei, fromWei, toBN, BN } = require('web3-utils'); const { toWei, fromWei, toBN, BN } = require('web3-utils');
const BigNumber = require('bignumber.js'); const BigNumber = require('bignumber.js');
const config = require('./config'); const config = require('./config');
const program = require('commander'); const program = require('commander');
const { TornadoFeeOracleV4, TornadoFeeOracleV5, TokenPriceOracle } = require('@tornado/tornado-oracles'); const { TornadoFeeOracleV4, TornadoFeeOracleV5 } = require('@tornado/tornado-oracles');
const { SocksProxyAgent } = require('socks-proxy-agent'); const { SocksProxyAgent } = require('socks-proxy-agent');
const is_ip_private = require('private-ip'); const is_ip_private = require('private-ip');
const readline = require('readline'); const readline = require('readline');
@ -486,7 +485,15 @@ async function withdraw({ deposit, currency, amount, recipient, relayerURL, refu
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' }
}; };
} }
const relayerStatus = await axios.get(relayerURL + '/status', options);
let relayerStatus;
try {
relayerURL = new URL(relayerURL).origin;
relayerStatus = await axios.get(relayerURL + '/status', options);
} catch (err) {
console.error(err);
throw new Error('Cannot get relayer status');
}
const { rewardAccount, netId, ethPrices, tornadoServiceFee } = relayerStatus.data; const { rewardAccount, netId, ethPrices, tornadoServiceFee } = relayerStatus.data;
assert(netId === (await web3.eth.net.getId()) || netId === '*', 'This relay is for different network'); assert(netId === (await web3.eth.net.getId()) || netId === '*', 'This relay is for different network');
@ -1359,7 +1366,7 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', balanceC
console.log('Using tor network'); console.log('Using tor network');
web3Options = { agent: { https: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort) }, timeout: 60000 }; web3Options = { agent: { https: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort) }, timeout: 60000 };
// Use forked web3-providers-http from local file to modify user-agent header value which improves privacy. // Use forked web3-providers-http from local file to modify user-agent header value which improves privacy.
web3 = new Web3(new Web3HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 }); web3 = new Web3(new Web3.providers.HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 });
ipOptions = { ipOptions = {
httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort), httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort),
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' }
@ -1368,21 +1375,22 @@ async function init({ rpc, noteNetId, currency = 'dai', amount = '100', balanceC
console.log('Using tor network'); console.log('Using tor network');
web3Options = { agent: { http: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort) }, timeout: 60000 }; web3Options = { agent: { http: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort) }, timeout: 60000 };
// Use forked web3-providers-http from local file to modify user-agent header value which improves privacy. // Use forked web3-providers-http from local file to modify user-agent header value which improves privacy.
web3 = new Web3(new Web3HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 }); web3 = new Web3(new Web3.providers.HttpProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 });
ipOptions = { ipOptions = {
httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort), httpsAgent: new SocksProxyAgent('socks5h://127.0.0.1:' + torPort),
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' } headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' }
}; };
} else if (rpc.includes('ipc')) { } else if (rpc.includes('ipc')) {
console.log('Using ipc connection'); console.log('Using ipc connection');
web3 = new Web3(new Web3.providers.IpcProvider(rpc, net), null, { transactionConfirmationBlocks: 1 }); web3 = new Web3(new Web3.providers.IpcProvider(rpc, {}), null, { transactionConfirmationBlocks: 1 });
} else if (rpc.startsWith('ws') || rpc.startsWith('wss')) { } else if (rpc.startsWith('ws') || rpc.startsWith('wss')) {
console.log('Using websocket connection (Note: Tor is not supported for Websocket providers)'); console.log('Using websocket connection (Note: Tor is not supported for Websocket providers)');
web3Options = { web3Options = {
clientConfig: { keepalive: true, keepaliveInterval: -1 }, clientConfig: { keepalive: true, keepaliveInterval: -1 },
reconnect: { auto: true, delay: 1000, maxAttempts: 10, onTimeout: false } reconnect: { auto: true, delay: 1000, maxAttempts: 10, onTimeout: false }
}; };
web3 = new Web3(new Web3.providers.WebsocketProvider(rpc, web3Options), net, { transactionConfirmationBlocks: 1 }); web3 = new Web3(new Web3.providers.WebsocketProvider(rpc, web3Options), null, { transactionConfirmationBlocks: 1 });
if (!(await web3.eth.net.isListening())) throw new Error('Cannot connect to websocket provider');
} else { } else {
console.log('Connecting to remote node'); console.log('Connecting to remote node');
web3 = new Web3(rpc, null, { transactionConfirmationBlocks: 1 }); web3 = new Web3(rpc, null, { transactionConfirmationBlocks: 1 });

779
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -11,12 +11,11 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@ethersproject/transactions": "^5.7.0", "@ethersproject/transactions": "^5.7.0",
"@tornado/circomlib": "0.0.20-p2", "@tornado/circomlib": "0.0.21",
"@tornado/fixed-merkle-tree": "0.6.1-p1", "@tornado/fixed-merkle-tree": "0.6.1",
"@tornado/snarkjs": "0.1.20-p2", "@tornado/snarkjs": "0.1.20",
"@tornado/tornado-oracles": "^3.3.0", "@tornado/tornado-oracles": "^3.3.0",
"@tornado/web3-providers-http": "1.6.5-p1", "@tornado/websnark": "0.0.4",
"@tornado/websnark": "0.0.4-p1",
"axios": "^0.19.2", "axios": "^0.19.2",
"bignumber.js": "^9.0.0", "bignumber.js": "^9.0.0",
"circom": "0.0.35", "circom": "0.0.35",
@ -25,7 +24,7 @@
"es5-ext": "0.10.53", "es5-ext": "0.10.53",
"private-ip": "^2.3.3", "private-ip": "^2.3.3",
"socks-proxy-agent": "^6.1.1", "socks-proxy-agent": "^6.1.1",
"web3": "^1.6.1" "web3": "^1.10.2"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.0.0" "eslint": "^7.0.0"