<p>You only see the balance of blocks that have at least another 100 on top. This is because coinbase outputs only become spendable after 101 confirmations (the maturity period).</p>

<p>After the nodes reconnect, and one block is mined by node0, node1's previous chain is reorganized away, and from that point on, both nodes work on the same chain.</p>

<p>However, whenever a new block is mined, the balance of the node who mined the block 100 before that is increased.</p>

<p>It has nothing to do with the nBits bug. This is an actual bug in the software which is being fixed now, but it does not affect you.</p>

CC BY-SA 3.0
2015-05-03T22:00:42.027Z
Thanks! But does it make sense to earn bitcoins without generating any blocks? Because apperently, node0, in this case, is earning the reward from the blocks node1 generates!? Or am I misunderstanding/missing something?
Aliakbar Ahmadi
CC BY-SA 3.0
2015-05-04T09:24:32.360Z
You are misunderstanding. In step 11, node1 generates block number 103. This is the 100th block on top of block number 3, whose coinbase matures at that point. This makes block number 3's generated coin (which belongs to node0, not node1), spendable.
Pieter Wuille
CC BY-SA 3.0
2015-05-04T09:34:29.720Z
Ah ok, of course, because both bodes work on node0's blockchain. Thanks!
Aliakbar Ahmadi
CC BY-SA 3.0
2015-05-01T20:22:04.460Z
2015-05-01T20:22:04.460Z
Pieter Wuille
<p><br/>
I'm running 2 bitcoind servers on the same machine, called node0 and node1.<br/>
In the following I'm listing steps I take and results I get and I'm wondering <strong>what is causing one node nullifying other node's balance by block generation?</strong><br/></p>

<ol>
<li>Started two independent (by independent configuration files) servers</li>
<li>node0 generates 101 blocks</li>
<li>node1 generates 101 blocks</li>
<li>each node has a balance of 50 BTC</li>
<li>connected them by adding one by the other node via "addnode "localhost:port" add"</li>
<li>version messages are exchanged</li>
<li>getconnectioncount returns "1" on behalf of each node</li>
<li>node0 generates 1 block</li>
<li>node0: getbalance: 100 BTC</li>
<li>node1: getbalance: 0 BTC<br/></li>
</ol>

<p><em>...trying to figure out what's happening...<br/></em></p>

<ol start="11">
<li>node1 generates 1 block</li>
<li>node1: getbalance: 0 BTC</li>
<li>node0: getbalance 150 BTC</li>
<li>node1 generates 100 blocks</li>
<li>node1: getbalance: 50 BTC</li>
<li>node0: getbalance: 5100 BTC</li>
</ol>

<p>I guess this problem has to do with an error I get after generation of blocks - see my corresponding question <a href="https://bitcoin.stackexchange.com/questions/37189/generating-blocks-in-regtest-hash-doesnt-match-nbits">here</a>.</p>

<p><strong>Or is it because of the settled connection which causes a conflict on which blockchain to work on and thus abandonning one node's blockchain - in this case, abandonning node1's blockchain?</strong> </p>

<blockchain><block><balance><peers><regtest>
Regtest: One node nullifying other node's balance
Aliakbar Ahmadi
# Regtest: One node nullifying other node's balance

(Asked by: username_0 on 2015-05-01)

I'm running 2 bitcoind servers on the same machine, called node0 and node1.  
In the following I'm listing steps I take and results I get and I'm wondering **what is causing one node nullifying other node's balance by block generation?**

1. Started two independent (by independent configuration files) servers
2. node0 generates 101 blocks
3. node1 generates 101 blocks
4. each node has a balance of 50 BTC
5. connected them by adding one by the other node via "addnode "localhost:port" add"
6. version messages are exchanged
7. getconnectioncount returns "1" on behalf of each node
8. node0 generates 1 block
9. node0: getbalance: 100 BTC
10. node1: getbalance: 0 BTC

*...trying to figure out what's happening...*

11. node1 generates 1 block
12. node1: getbalance: 0 BTC
13. node0: getbalance 150 BTC
14. node1 generates 100 blocks
15. node1: getbalance: 50 BTC
16. node0: getbalance: 5100 BTC

I guess this problem has to do with an error I get after generation of blocks - see my corresponding question [here](https://bitcoin.stackexchange.com/questions/37189/generating-blocks-in-regtest-hash-doesnt-match-nbits).

**Or is it because of the settled connection which causes a conflict on which blockchain to work on and thus abandonning one node's blockchain - in this case, abandonning node1's blockchain?**

**Tags:** blockchain, block, balance, peers, regtest


---

## 1 answers

### Answer by username_1 on 2015-05-01. Score: 4 | Accepted answer

You only see the balance of blocks that have at least another 100 on top. This is because coinbase outputs only become spendable after 101 confirmations (the maturity period).

After the nodes reconnect, and one block is mined by node0, node1's previous chain is reorganized away, and from that point on, both nodes work on the same chain.

However, whenever a new block is mined, the balance of the node who mined the block 100 before that is increased.

It has nothing to do with the nBits bug. This is an actual bug in the software which is being fixed now, but it does not affect you.

> **Comments:**
> **username_0**: Thanks! But does it make sense to earn bitcoins without generating any blocks? Because apperently, node0, in this case, is earning the reward from the blocks node1 generates!? Or am I misunderstanding/missing something?  
> **username_1**: You are misunderstanding. In step 11, node1 generates block number 103. This is the 100th block on top of block number 3, whose coinbase matures at that point. This makes block number 3's generated coin (which belongs to node0, not node1), spendable.  
> **username_0**: Ah ok, of course, because both bodes work on node0's blockchain. Thanks!  

---

