0

On this URL: https://coin.dance/nodes

It says how many public Bitcoin nodes are currently active in the world, and how many Bitcoin Core ones.

While it's good that I can grab these numbers from that webpage, I'd like to know how exactly they determine this, and if it's simple, I'd like to calculate it myself rather than relying on a third party which could disappear tomorrow or lie to me or have a bug or anything.

Is this simple to determine? What steps have they likely taken to calculate this? Does it involve scanning every public IP address in the world repeatedly and checking for listening Bitcoin ports? If so, I'll probably leave it to them as I don't need to emit that kind of insane amount of traffic from my home... not to mention it would probably require me to use tons of IP addresses lest I want to get banned from various network and thus get inaccurate statistics.

Or does Bitcoin Core itself have this information baked in? Does the Bitcoin network send around an integer saying how many nodes there are to each other as part of the protocol, and I can just use the RPC API to my local Bitcoin Core to get this info?

2

Does the Bitcoin network send around an integer saying how many nodes there are to each other as part of the protocol,

No.

See https://en.bitcoin.it/wiki/Protocol_documentation

So far as I can see, total counts of active nodes are not part of any message but there are potentially useful messages such as:

getaddr
The getaddr message sends a request to a node asking for information about known active peers to help with finding potential nodes in the network.

By sending this message to all known but previously uncontacted nodes, it is possible to discover more previously uncontacted nodes you can send this message to until the responses only contain previously contacted nodes and all the nodes you know of are either contacted nodes or unresponsive nodes.


I'd like to know how exactly they determine this,

CoinDance don't say.


As Davidson Souza's later answer reports, at least one website (Bitnodes) uses the getaddr message to approximate the number of all currently accessible nodes.

| improve this answer | |
0

If you monitor the traffic of your network while trying to connect to Bitcoin Network using Bitcoin Core, you will notice it sends below information in the first request and gets similar response from another node:

User-Agent: //
Version: XXXXX
Lastblock: XXXXXX

I have filtered the results in Wireshark to show only "Bitcoin" protocol related requests and response

Screenshot-Wireshark-BitcoinCore1

Below is the response my node got from other node:

Screenshot-Wireshark-BitcoinCore2

I don't have my own code or tools to monitor the internet traffic and filter it for Bitcoin nodes however I tried searching using Shodan and it returned few results:

Shodan-Bitcoin

This is my guess and I am not sure how different websites and tools are working. They must be using similar ways to filter machines connected to the internet and get information about nodes.

| improve this answer | |
0

They use a crawler that connect to every single reachable node into the network recursively.
Basically connect to a node, send a getaddr request, and try to connect to the received addresses.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.