Bitcoin Forum

Other => Beginners & Help => Topic started by: almbfsek on June 16, 2011, 01:43:16 PM



Title: Mining using a proxy
Post by: almbfsek on June 16, 2011, 01:43:16 PM
hello guys,

I have an SSH tunnel that I use as a SOCKS proxy for my web browser. I would also like to use it with mining softwares.
is it even possible? I thought since miners use HTTP protocol it should be possible.
if so, which 3rd party application can I use in order to route the miner's connection through the proxy? or may be the miner's code should be modified?

thank you in advance


Title: Re: Mining using a proxy
Post by: cynikal on June 16, 2011, 03:04:34 PM
if your miner uses something like libcurl, it will respect the http_proxy environment variable, look into the underlying software/libs you're using and research their proxy support


Title: Re: Mining using a proxy
Post by: torusJKL on June 16, 2011, 03:14:30 PM
You can tunnel your localhost port to any homepage.
e.g. localhost:8332 --> pool.com:8332

You can even change port numbers in the process (if you use several pools)
e.g. localhost:8555 --> otherpool.com:8332

Then you connect your miner to localhost:8332 instead to the pool's address.


Title: Re: Mining using a proxy
Post by: nuclearstar on June 16, 2011, 04:32:02 PM
for the record my work has a proxy and my miner works fine without having to configure anything extra.


Title: Re: Mining using a proxy
Post by: cynikal on June 16, 2011, 05:24:45 PM
You can tunnel your localhost port to any homepage.
e.g. localhost:8332 --> pool.com:8332

You can even change port numbers in the process (if you use several pools)
e.g. localhost:8555 --> otherpool.com:8332

Then you connect your miner to localhost:8332 instead to the pool's address.

have you actually tried this? I have and depending on how the pool's rpc server is configured, it may not return the data if the request it gets doesn't contain the desired host (e.g. Host: localhost as opposed to actual hostname of the pool server).  Again this depends on the config of the pool but i ran into issues trying to do it this way.

If you really want to scale better, run a proxy service like https://github.com/cdhowie/Bitcoin-mining-proxy (this is what i'm using)


Title: Re: Mining using a proxy
Post by: almbfsek on June 16, 2011, 06:08:42 PM
@cynikal: thank you. http_proxy is what I was looking for. I did "export http_proxy=socks5://127.0.0.1:11334" and it doesn't work because according to this(http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY) my curl version(7.21.3) doesn't support protocol prefix(socks5://) on the URL. so I did some research but I couldn't find how to specify socks5 with env. variables. do you know how?

thank you


Title: Re: Mining using a proxy
Post by: cynikal on June 16, 2011, 06:12:35 PM
@cynikal: thank you http_proxy is what I was looking for. I did "export http_proxy=socks5://127.0.0.1:11334" and it doesn't work because according to this(http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY) my curl version(7.21.3) doesn't support protocol prefix(socks5://) on the URL. so I did some research but I couldn't find how to specify socks5 with env. variables? do you know how?

thank you

sorry, i use a http proxy myself (i run one on a server remotely and then i ssh tunnel to that proxy directly, rather than use ssh tunnel as a socks proxy).  upgrade your curl version? or staticly compile a local version of newer libcurl and link/include that static lib into your miner ?


Title: Re: Mining using a proxy
Post by: almbfsek on June 16, 2011, 06:23:45 PM
upgrading the libcurl is the easiest I guess, thanks!


Title: Re: Mining using a proxy
Post by: almbfsek on June 16, 2011, 06:43:21 PM
well modifying the source was easier afterall :)

Quote
curl_easy_setopt(curl, CURLOPT_PROXY, "socks://127.0.0.1:11334");
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);

works like a charm...