question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running CCXT through Tor: Is This Possible

See original GitHub issue

In 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:open
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ttoduacommented, Aug 15, 2022

Have you tried to setup TOR as proxy in its configuration (i.e. see this) and then use that as CCXT’s proxy property?

0reactions
samgermaincommented, Jul 13, 2022

Anyone else have any ideas regarding how to run CCXT through Tor?

I believe this was the book that I used to learn everything I know about using Tor

Read more comments on GitHub >

github_iconTop Results From Across the Web

is dry run available in ccxt ( like freqtrade)? #7051 - GitHub
Hi @AronWater. As far as I can remember there is no explicit dry_run, but you can simulate it in some ways like :...
Read more >
Exchanges — ccxt 2.4.71 documentation
The ccxt library is a collection of available crypto exchanges or exchange classes. Each class implements the public and private API for a...
Read more >
Avoiding Webscraping Throttling Using Python and Tor as a ...
In order to hide your IP address and to try and limit throttling when web scraping, it might be a good idea to...
Read more >
Running A Full Node
Read the Manual for more details. You can get CCXT installed in a container along with all the supported languages and dependencies. This...
Read more >
Getting started with CCXT Crypto Exchange Library and Python
It is available in Python, Javascript, and PHP. It supports both public and private APIs offered by different exchanges but I am only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found