Bitcoin Forum
May 02, 2024, 04:19:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to set up a proxy for bitcoind  (Read 1113 times)
TheFootMan (OP)
Hero Member
*****
Offline Offline

Activity: 490
Merit: 500


View Profile
February 07, 2014, 05:49:40 PM
 #1


How to set up a proxy for bitcoind.


Operating system: Any linux distro.
Prerequisites:
* Downloaded and verified ready to run bitcoind binary.
You should be able to find the bitcoind software at bitcoin.org:
https://bitcoin.org/en/download
* Openssh must've been installed and a working ssh connection between machine A and B must have been established. Please refer to openssh documentation to learn more.


On private network there is machine A and machine B.

Machine A has full internet access.

Machine B only has access to machines on the local net (range 192.168.1.xxx) and no Internet access.

The goal is to run a bitcoind instance on machine B, and tunnel all bitcoind traffic through machine A, making for a functional bitcoind instance that can communicate with other bitcoin nodes online.

First, configure the machine with full internet access by making it a socks proxy:

Open a terminal window on machine A and run:
Code:
ssh -N -D 0.0.0.0:1080 localhost -p 22

(Look up the different parameters in the manual if you're curious as to what they do, the "-p 22" can be omitted, but in the event you use a non-standard port for ssh, you need to specify it there.)

You do not need to be root to do this, and you might be asked for your password. Once you've entered the password and you receive no error message, the window appears to be non-responsive. Just leave it at that, and open a new terminal window.

In the new terminal window, ssh into machine B.

Go to the directory containing the bitcoind binary. Then issue the following command:

Code:
./bitcoind -daemon -proxy=IPMACHINEA:1080

Just exchange the 'IPMACHINEA' with the IP-address of machine A.

If you've left the first terminal open, you'll see some messages pop up there, don't worry about these.

Now, you can issue the command:

Code:
./bitcoind getconnectioncount

If you have the number 0 returned, just wait a bit, then try again. Eventually this number will increase.

If you want to have a closer peek at what's happening, you can have a look at the debug information for bitcoind.

Now go to the bitcoin home directory:

Code:
cd ~/.bitcoin

Now issue the following command:

Code:
tail -f debug.log

You will then be able to see as it happens that blockdata is flowing in.

While this is quite simple when you know how to use the right commands, it took me a while to figure it out, so I hope this can be helpful for others too!

While this was a guide for how to setup a bitcoind instance on a machine only with local net access on a home network, similar setups could be used to protect your real ip. For instance if you live somewhere or work somewhere where running a bitcoind instance is not condoned, this could be a way of running it locally without anyone snooping on the traffic between you and the proxy. Since everything goes over a secure ssh connection.









Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!