Connect to Bitcoin Node behind tor network

1

I configured my full bitcoin node behind tor (nowadays there aren't much bitcoin nodes behind tor network, this website: https://bitnodes.21.co/nodes/?q=Tor%20network tell us that there are just 323 nodes), for the moment I hadn't any problem configuring it behind tor. But the problem comes when I want to connect through a rpc client to my bitcoin node. I am using this project as code base: https://github.com/aceat64/EasyBitcoin-PHP and I modify the function __call in the following way:

$options = array(
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_USERPWD        => $this->username . ':' . $this->password,
            CURLOPT_PROXY          => '127.0.0.1:9050',
            CURLOPT_PROXYTYPE      => 7,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_FOLLOWLOCATION => TRUE,
            CURLOPT_MAXREDIRS      => 10,
            CURLOPT_HTTPHEADER     => array('Content-type: application/json'),
            CURLOPT_POST           => TRUE,
            CURLOPT_POSTFIELDS     => $request
        );

I am very stuck with this issue, due to that I am getting all time Can't complete SOCKS5 connection to 0.0.0.0:0., I have the tor service running and I didn't find any tutorial about how to connect and authenticate to a bitcoin node using php and curl.

Best regards and thanks in advance

John Graham

Posted 2017-08-31T18:13:23.990

Reputation: 73

Answers

1

The RPC interface is not exposed over Tor. The only thing that goes over Tor is the P2P connection. To access the RPC server, you need to connect directly to the node's IP address, not connect to it over Tor. Note that the RPC interface and the P2P interface are two different things; the RPC interface is private facing while the P2P interface is public facing.

Andrew Chow

Posted 2017-08-31T18:13:23.990

Reputation: 40 910

Thanks for your reply! I was really stuck and I didn't know that the RPC can't be exposed over TOR!John Graham 2017-09-01T19:23:18.363