<p>The bitcoin network is only as connected as each node wants to be. The protocol is designed in such a way as to incentivize being connected to the network, so in practice, almost every full node is connected to a lot of other nodes and hence, there's at least a very good chance of a short path between any two nodes.</p>

<p>However, that's not to say that every node is connected. It is entirely possible to run a full node that's not connected, like you seem to have done. In your case, it seems C does not have any peers, so C's mined block won't get to anyone else.</p>

<p>Run this command to see which peers it has:</p>

<pre><code>$ bitcoin-cli getpeerinfo
</code></pre>

<p>You'll want to add connections this way:</p>

<pre><code>$ bitcoin-cli addnode &lt;node ip and port&gt; add
</code></pre>

CC BY-SA 3.0
2015-10-30T02:23:13.060Z
getpeerinfo tells me that it does not have any connections. The only change I did is made it pick up my hardcoded addresses. So you mean to say this is completely possible in bitcoin? I do not want to check manually and add nodes explicitly. Is there a way where I can achieve this peerdiscovery automatically?
Guhan S
CC BY-SA 3.0
2015-10-30T14:48:04.703Z
So if bitcoind is ever connected to the network, it will keep a list of previously connected peers around and use that every time it starts up. You only need to do this once.
Jimmy Song
CC BY-SA 3.0
2015-10-29T23:33:49.880Z
2015-10-29T23:33:49.880Z
Jimmy Song
<p>In bitcoin's gossip network will there be a path from every node to every other node? It can certainly have different number of hops.</p>

<p>I have a private testnet in which I modified some source code. I get a graph like this</p>

<pre><code>A-&gt;B-&gt;C 
</code></pre>

<p>So we have a path from A to C but not C to A. So when C mines a block, the information is remained with it and it does not send <em>inv</em> messages out. Not sure if I am wrong or this is expected?</p>

<p><strong>Edit:</strong></p>

<p>The only change I did is to make testnet work on my localhost. Removed the IsLocal() check from IsRoutable() and added my own hardcoded seeds.</p>

CC BY-SA 3.0
2015-10-30T01:34:35.973Z
To clarify - did you modify any code that would prevent the nodes from sharing blocks? For example, if you added code that caused a node to never accept a block from a node with a higher port number than itself, that would produce the behavior you see.
Nick ODell
CC BY-SA 3.0
2015-10-30T02:18:03.130Z
The only change I did is to make testnet work on my localhost. Removed the IsLocal() check from IsRoutable() and added my own hardcoded seeds.
Guhan S
<bitcoind><protocol>
In bitcoin network will there be a path from every node to every other node?
Guhan S
# In bitcoin network will there be a path from every node to every other node?

(Asked by: username_0 on 2015-10-29)

In bitcoin's gossip network will there be a path from every node to every other node? It can certainly have different number of hops.
I have a private testnet in which I modified some source code. I get a graph like this
A->B->C 

So we have a path from A to C but not C to A. So when C mines a block, the information is remained with it and it does not send inv messages out. Not sure if I am wrong or this is expected?
Edit:
The only change I did is to make testnet work on my localhost. Removed the IsLocal() check from IsRoutable() and added my own hardcoded seeds.

**Tags:** bitcoind, protocol

> **Comments:**
> **username_1**: To clarify - did you modify any code that would prevent the nodes from sharing blocks? For example, if you added code that caused a node to never accept a block from a node with a higher port number than itself, that would produce the behavior you see.  
> **username_0**: The only change I did is to make testnet work on my localhost. Removed the IsLocal() check from IsRoutable() and added my own hardcoded seeds.  

---

## 1 answers

### Answer by username_2 on 2015-10-29. Score: 1

The bitcoin network is only as connected as each node wants to be. The protocol is designed in such a way as to incentivize being connected to the network, so in practice, almost every full node is connected to a lot of other nodes and hence, there's at least a very good chance of a short path between any two nodes.
However, that's not to say that every node is connected. It is entirely possible to run a full node that's not connected, like you seem to have done. In your case, it seems C does not have any peers, so C's mined block won't get to anyone else.
Run this command to see which peers it has:
$ bitcoin-cli getpeerinfo

You'll want to add connections this way:
$ bitcoin-cli addnode  add

> **Comments:**
> **username_0**: getpeerinfo tells me that it does not have any connections. The only change I did is made it pick up my hardcoded addresses. So you mean to say this is completely possible in bitcoin? I do not want to check manually and add nodes explicitly. Is there a way where I can achieve this peerdiscovery automatically?  
> **username_2**: So if bitcoind is ever connected to the network, it will keep a list of previously connected peers around and use that every time it starts up. You only need to do this once.  

---

