Author

Topic: Solved:Need help setting up Bitcoin Core full node over Tor hidden service only. (Read 148 times)

newbie
Activity: 3
Merit: 14


Question: I wonder how actually Bitcoin Core -datadir/bitcoin.conf handling works, does in OP case that the app read the bitcoin.conf from the home folder and then read the datadir config, thus the app read the bitcoin.conf(which I assume is none since the Tor configs aren't loaded properly) on the specified datadir directory? Or it should specifically rely on where was the bitcoin.conf was first set(e.g., in OP case, on the home directory)?

vv181,

Great question.

I tried to figure out an answer to your question by doing these steps.

Not sure if it will help in answering your question.

Code:
desktop:~$

desktop:~$ sudo nano ~/.bitcoin/bitcoin.conf
/ Deleted everything inside ~/.bitcoin/bitcoin.conf

desktop:~$

desktop:~$ cat ~/.bitcoin/bitcoin.conf
/ Nothing is in the file , as expected

desktop:~$

desktop:~$ bitcoin-cli stop
 --- > Output:

error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (~/.bitcoin/bitcoin.conf)
/ Error message. Looks like cannot stop bitcoind running

desktop:~$

desktop:~$ sudo nano ~/.bitcoin/bitcoin.conf
/ Went back inside ~/.bitcoin/bitcoin.conf and added this 1 line only
datadir=/mnt/bitcoin

desktop:~$

desktop:~$ bitcoin-cli stop
/ Now no problem shutting down. No error messages this time.

..........Reboot the computer. Logged back in.

No problem getting Bitcoin Core full node as well as Tor running , both automatically.

I confirmed this by running the following commands:

Code:
bitcoin-cli getconnectioncount
bitcoin-cli getblockchaininfo
bitcoin-cli getnetworkinfo
systemctl status tor
ls -lt /mnt/bitcoin
df -h
bitcoin-cli getpeerinfo | grep addr

legendary
Activity: 1932
Merit: 1273
Grats, you made it work. Wink


Question: I wonder how actually Bitcoin Core -datadir/bitcoin.conf handling works, does in OP case that the app read the bitcoin.conf from the home folder and then read the datadir config, thus the app read the bitcoin.conf(which I assume is none since the Tor configs aren't loaded properly) on the specified datadir directory? Or it should specifically rely on where was the bitcoin.conf was first set(e.g., in OP case, on the home directory)?
newbie
Activity: 3
Merit: 14
I can't see what is wrong with your configurations. But since your bitcoin.conf is on your home folder, i would try to copy the bitcoin.conf to /mnt/bitcoin/bitcoin.conf, and then run
Code:
bitcoind -conf=/mnt/bitcoin/bitcoin.conf
After it running, try to check it again.

vv181,

Thank you very much for the suggestion.

It works.

I ran this command and it is a success in getting IPv4 and IPv6 flags set to false:
      
Code:
bitcoind -daemon -conf=/mnt/bitcoin/bitcoin.conf

AdolfinWolf,
Your suggestion seems good to use for future problems.
I shall remember it.
Thank you very much.

For those who are new to this. Check out the references I listed in my first post to get started.

If I can do it , you can do it.
legendary
Activity: 1946
Merit: 1427
I don't fully understand the issue, from the looks of your debug.log your RPC can't bind to the port specified in your bitcoin.conf (which is also the default port, so the command is redundant?), though it seems that this has not interfered with the syncing of your wallet and thus does not relate to your networking issues?



It's been a while since i prodded around and I currently don't have my node synced to try and replicate this getnetworkinfo output

The only thing I can think of is that the
Code:
-bind 127.0.0.1
is not correctly cancelling out the
Code:
listen=1

Or that your conf file is indeed not loaded at all.


Reduce the number of parameters to just
Code:
-onlynet=onion -bind=127.0.0.1 -listen=1 -proxy=127.0.0.1:9050
and see if that resolves the issue.
legendary
Activity: 1932
Merit: 1273
I can't see what is wrong with your configurations. But since your bitcoin.conf is on your home folder, i would try to copy the bitcoin.conf to /mnt/bitcoin/bitcoin.conf, and then run
Code:
bitcoind -conf=/mnt/bitcoin/bitcoin.conf
After it running, try to check it again.
newbie
Activity: 3
Merit: 14
Hello helpful souls,

Fetching getnetworkinfo should result in IPv4 and IPv6 flags set to false and Tor to `true`. This will ensure that I am operating my node privately.
But this is not the case for me.

Problem:
Need to fix IPv4 and IPv6 flags to set to false.

This is what I should get , but am not getting ( see below for more):

Code:
   "name": "ipv4",
    "limited": true,
    "reachable": false,

      "name": "ipv6",
    "limited": true,
    "reachable": false,

I am trying to run a full node with Bitcoin Core over Tor (solely) in Ubuntu (no bitcoin-qt) but the steps I am following are from many sources and I feel like I have been missing steps in between, not to mention that my technical skills are fairly basic.

Here's where I'm at (Ubuntu 20.04 LTS ; bitcoind ; no bitcoin-qt).

I use a static IP address from my ISP.

I use an external SATA drive mounted at      /mnt/bitcoin      to store Bitcoin full node data.


..........
desktop:~$      bitcoin-cli getnetworkinfo
 --- > Output extracts:
Code:
   {
      "name": "ipv4",
      "limited": false,
      "reachable": true,
      "proxy": "127.0.0.1:9050",
      "proxy_randomize_credentials": true
    },
    {
      "name": "ipv6",
      "limited": false,
      "reachable": true,
      "proxy": "127.0.0.1:9050",
      "proxy_randomize_credentials": true
    },
    {
      "name": "onion",
      "limited": false,
      "reachable": true,
      "proxy": "127.0.0.1:9050",
      "proxy_randomize_credentials": true
    },

..........This is what is in my      ~/.bitcoin/bitcoin.conf

Code:
assumevalid=0


zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333


debug=tor
onion=127.0.0.1:9050
listenonion=1
onlynet=onion
proxy=127.0.0.1:9050
bind=127.0.0.1
proxyrandomize=1


alertnotify=echo %s | mail -s "Bitcoin Alert" [email protected]

server=1
daemon=1
listen=1
rpcport=8332
rpcauth=.................XXXXXXXXXXX
datadir=/mnt/bitcoin
txindex=1
maxconnections=15
maxmempool=50
maxreceivebuffer=2500
maxsendbuffer=500
minrelaytxfee=0.0001

discover=0
torcontrol=127.0.0.1:9051

dbcache=100
maxorphantx=10
maxuploadtarget=5000



..........Running ubuntu and this is my      "/etc/tor/torrc"

Code:
SOCKSPort 9050
Log notice stdout
ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1
HiddenServiceDir /var/lib/tor/lnd/
HiddenServicePort 8080 127.0.0.1:8080

..........This is my      "/usr/share/tor/tor-service-defaults-torrc"

Code:
DataDirectory /var/lib/tor
PidFile /run/tor/tor.pid
RunAsDaemon 1
User debian-tor

ControlSocket /run/tor/control GroupWritable RelaxDirModeCheck
ControlSocketsGroupWritable 1
SocksPort unix:/run/tor/socks WorldWritable
SocksPort 9050

CookieAuthentication 1
CookieAuthFileGroupReadable 1
CookieAuthFile /run/tor/control.authcookie

Log notice syslog



..........These seem OK to me.

desktop:~$      cat /mnt/bitcoin/debug.log
 --- > Output extracts:

Code:
2021-12-02T15:01:11Z Bitcoin Core version v22.0.0 (release build)

2021-12-02T15:01:11Z InitParameterInteraction: parameter interaction: -proxy set -> setting -upnp=0
2021-12-02T15:01:11Z InitParameterInteraction: parameter interaction: -proxy set -> setting -natpmp=0
2021-12-02T15:01:11Z InitParameterInteraction: parameter interaction: -proxy set -> setting -discover=0


2021-12-02T15:03:41Z loadblk thread start
2021-12-02T15:03:41Z torcontrol thread start
2021-12-02T15:03:41Z Bound to 127.0.0.1:8333
2021-12-02T15:03:41Z Bound to 127.0.0.1:8334
2021-12-02T15:03:41Z init message: Loading P2P addresses…
2021-12-02T15:03:41Z Leaving InitialBlockDownload (latching to false)
2021-12-02T15:03:41Z tor: Got service ID XXXXXXXXXXX, advertising service XXXXXXXXXXX.onion:8333
2021-12-02T15:03:41Z AddLocal(XXXXXXXXXXX.onion:8333,4)


..........
..........When I ran this , I get this. May be because my   debug.log   is at   /mnt/bitcoin/debug.log      (see above):
desktop:~$      tail -f ~/.bitcoin/debug.log
Code:
2021-11-14T21:35:25Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-11-14T21:35:25Z Script verification uses 3 additional threads
2021-11-14T21:35:25Z scheduler thread start
2021-11-14T21:35:25Z Binding RPC on address ::1 port 8332 failed.
2021-11-14T21:35:25Z Binding RPC on address 127.0.0.1 port 8332 failed.
2021-11-14T21:35:25Z Unable to bind any endpoint for RPC server
2021-11-14T21:35:25Z Error: Unable to start HTTP server. See debug log for details.
2021-11-14T21:35:25Z Shutdown: In progress...
2021-11-14T21:35:25Z scheduler thread exit
2021-11-14T21:35:25Z Shutdown: done

..........The node seems fully synced

desktop:~$      bitcoin-cli getblockchaininfo
Code:
{
  "chain": "main",
  "blocks": 712330,
  "headers": 712330,
  "bestblockhash": "XXXXXXXXXXX",
  "difficulty": 22335659268936.39,
  "mediantime": 1638500142,
  "verificationprogress": 0.9999986191151918,
  "initialblockdownload": false,

Thank you very much.




..........References consulted include , but not limited to:
https://www.youtube.com/watch?v=n2IUYL7hCOI
https://jlopp.github.io/bitcoin-core-config-generator/
https://en.bitcoin.it/wiki/Setting_up_a_Tor_hidden_service
https://stopanddecrypt.medium.com/running-bitcoin-lightning-nodes-over-the-tor-network-2021-edition-489180297d5
https://www.linuxuprising.com/2018/10/how-to-install-and-use-tor-as-proxy-in.html
https://ubuntuhandbook.org/index.php/2021/01/install-tor-tor-browser-ubuntu-20-10-20-04/
https://8bitcoin.medium.com/how-to-run-a-bitcoin-full-node-over-tor-on-an-ubuntu-linux-virtual-machine-bdd7e9415a70
https://bitsquabi.medium.com/setting-up-a-tor-hidden-service-knowledge-base-322dca4ce4c0
https://ishaana-misra.medium.com/using-raspberry-pi-to-run-a-full-bitcoin-node-a30c6339b06e
https://gist.github.com/nvk/c9f4fdcaa40cf639d157ef2ac45e28a4
https://bitcoin.org/en/full-node#network-configuration
https://old.reddit.com/r/Bitcoin/comments/cndynu/help_setting_up_bitcoin_core_node_with_tor_hidden/
https://blog.lopp.net/tor-only-bitcoin-lightning-guide/
Jump to: