I spent hours researching for possible solutions, but couldn't find any. I set up my RPi4 bitcoin node about a month ago. It communicates through Tor (see torrc content).

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

It took a while to sync the whole network (almost two weeks) and since then I noticed that the number of inbound connection was near to 0 or low (max was around 12 and 5 on average). In addition, the score value returned by bitcoin-cli getnetworkinfo is still 4 and unchanged since the beginning. I'm wondering what might be causing this issue and how to solve. Here the bitcoin.conf, which I think is pretty standard:

#adjust memory usage

#transaction validity


#server settings

#transaction index

# Allows LND & Bitcoin Core to communicate via ZeroMQ

## Tor Settings

I've tried to play around with some settings unsuccessfully and ended up reinstalling tor. Regarding the firewall: I opened and mapped the following ports: 8332,8333, 18333, 28332, 28333 and then for lightning 10009 and 8080. When opening and forwarding port 9050 and 9051 I observed no improvement.

getnetworkinfo output:

        "version": 210100,
        "subversion": "/Satoshi:0.21.1/",
        "protocolversion": 70016,
        "localservices": "0000000000000409",
        "localservicesnames": [
        "localrelay": true,
        "timeoffset": -3,
        "networkactive": true,
        "connections": 10,
        "connections_in": 0,
        "connections_out": 10,
        "networks": [
                "name": "ipv4",
                "limited": true,
                "reachable": false,
                "proxy": "",
                "proxy_randomize_credentials": true
                "name": "ipv6",
                "limited": true,
                "reachable": false,
                "proxy": "",
                "proxy_randomize_credentials": true
                "name": "onion",
                "limited": false,
                "reachable": true,
                "proxy": "",
                "proxy_randomize_credentials": true
        "relayfee": 0.00001,
        "incrementalfee": 0.00001,
        "localaddresses": [
                "address": "[redacted].onion",
                "port": 8333,
                "score": 4
        "warnings": ""

I'd be happy to provide more information and thank you in advance for your time.

EDIT: I've done more research:

While using Tor, it's pointless to open ports on router side. Tor handles all the request over the onion service. I tested this and even with closed port, bitcoind was connecting to Outbound peers fine. I get a few inbound connections as well, but the score didn't improve.

So I went into the source code and found out why the default score was 4. Here the link to Github. I believe (and might be wrong so please help!) that the following functions are responsible for setting the nScore value:

  1. GetLocalAddrForPeer(CNode *pnode) which return 3 if GetnScore(addrLocal) > LOCAL_MANUAL
  2. AddLocal(const CService& addr, int nScore) which adds a 1 to nScore if !fAlready || nScore >= info.nScore

This yields a 4 and it might make sense. Now, I suppose the function responsible for updating the nScore is the following:

bool SeenLocal(const CService& addr)
        if (mapLocalHost.count(addr) == 0)
            return false;
    return true;

and here I get totally lost, but I guess that mapLocalHost.count(addr) must always be 0 in my case. My knowledge of C++ reaches this point, so the additional question is what changes mapLocalHost and why doesn't it update when a new peer is added on my machine?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.