Running CCXT through Tor: Is This Possible
See original GitHub issueIn node.js, I am trying to run CCXT through Tor, with the Tor app running in the background on my Mac computer. That is to say, I want to connect to the crypto exchange through the Tor network.
Connecting node.js to Tor involves connecting to a local SOCKS proxy.
This article provides some node.js code facilitating connection to Tor via a SOCKS proxy, using the module socks-proxy-agent.
This CCXT documentation gives a code example for routing CCXT through a https proxy, using the node.js module https-proxy-agent.
So I combined the two pieces of code, and was hoping that the following code I created would route CCXT through Tor. However, it does not seem to work, because I still appear to be connected to the exchange via my regular IP, and not through Tor.
const ccxt = require ('ccxt')
const { SocksProxyAgent } = require('socks-proxy-agent')
const agent = new SocksProxyAgent('socks5h://127.0.0.1:9050')
const exchange = new ccxt.kraken({ agent })
exchange.apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
exchange.secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Any suggestions on getting this code working gratefully received.
I have presently set up the exchange API to only accept requests from my regular IP. So if the above code was working, the exchange would reject requests to retrieve exchange private account information, and this is how I would be able to tell that CCXT has been successfully routed through Tor.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Have you tried to setup TOR as proxy in its configuration (i.e. see this) and then use that as CCXT’s
proxy
property?I believe this was the book that I used to learn everything I know about using Tor