<blockquote>
<p><strong>Does the Bitcoin network send around an integer saying how many nodes there are to each other as part of the protocol,</strong></p>
</blockquote>
<p>No.</p>
<p>See <a href="https://en.bitcoin.it/wiki/Protocol_documentation" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Protocol_documentation</a></p>
<p>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:</p>
<blockquote>
<p><strong>getaddr</strong><br />
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.</p>
</blockquote>
<p>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.</p>
<hr />
<blockquote>
<p><strong>I'd like to know how exactly they determine this,</strong></p>
</blockquote>
<p>CoinDance don't say.</p>
<hr />
<p>As <a href="https://bitcoin.stackexchange.com/a/98850/13866">Davidson Souza's later answer</a> reports, at least one website (<a href="https://bitcoin.stackexchange.com/a/98850/13866">Bitnodes</a>) uses the <code>getaddr</code> message to approximate the number of all currently accessible nodes.</p>

CC BY-SA 4.0
2020-08-21T16:41:11.143Z
2020-10-13T14:24:32.053Z
2020-10-13T14:24:32.053Z
RedGrittyBrick
<p>They use a <a href="https://github.com/ayeowch/bitnodes" rel="nofollow noreferrer">crawler</a> that connect to every single reachable node into the network recursively.<br />
Basically connect to a node, send a <code>getaddr</code> request, and try to connect to the received addresses.</p>

CC BY-SA 4.0
2020-09-03T13:58:01.327Z
2020-09-03T13:58:01.327Z
Davidson Souza
<p>On this URL: <a href="https://coin.dance/nodes" rel="nofollow noreferrer">https://coin.dance/nodes</a></p>
<p>It says how many public Bitcoin nodes are currently active in the world, and how many Bitcoin Core ones.</p>
<p>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.</p>
<p>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.</p>
<p>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?</p>

CC BY-SA 4.0
2020-09-02T06:49:24.443Z
My guess would use `getaddr`, make new connections and repeat.
sanket1729
<bitcoin-core><protocol><nodes><statistics>
How exactly does "CoinDance" determine the current number of public Bitcoin nodes?
J. Alkurdi
# How exactly does "CoinDance" determine the current number of public Bitcoin nodes?

(Asked by: username_0 on 2020-08-21)

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?

**Tags:** bitcoin-core, protocol, nodes, statistics

> **Comments:**
> **username_1**: My guess would use `getaddr`, make new connections and repeat.  

---

## 2 answers

### Answer by username_2 on 2020-08-21. Score: 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 [username_3 username_3's later answer](https://bitcoin.stackexchange.com/a/98850/13866) reports, at least one website ([Bitnodes](https://bitcoin.stackexchange.com/a/98850/13866)) uses the `getaddr` message to approximate the number of all currently accessible nodes.


---

### Answer by username_3 on 2020-09-03. Score: 0

They use a [crawler](https://github.com/ayeowch/bitnodes) 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.


---

