I am running the ruimarinho/bitcoin-core docker image and trying to understand why the block reward is going to the wrong btc address.

I have the following scenario:

$ bitcoin-cli -regtest createwallet mywallet
  "name": "mywallet",
  "warning": ""
$ bitcoin-cli -regtest createwallet minerwallet
  "name": "minerwallet",
  "warning": ""

$ ADDR=$(bitcoin-cli -regtest -rpcwallet=mywallet getnewaddress mywallet legacy) 
$ MINER_ADDR=$(bitcoin-cli -regtest -rpcwallet=minerwallet getnewaddress minerwallet legacy)

muHrQQbYfhzVH4GCTZh4ZnKZvWBHVcqg66 mz3QWUnL94q2RdRxFtPq747SngoBu5uQMi

$ bitcoin-cli -regtest generatetoaddress 101 $ADDR # generate 100 blocks which will add bitcoin to 'mywallet'

$ TXID=$(bitcoin-cli -regtest -rpcwallet=mywallet sendtoaddress) "mtuFXC3oACRqVMMqN32L5VG7ZCbaE7aZxi" 10 # send 10 btc to random addr

$ bitcoin-cli -regtest -rpcwallet=minerwallet generateblock $MINER_ADDR "[\"$TXID\"]" # mine the transaction

$ bitcoin-cli -regtest -rpcwallet=mywallet getbalance
$ bitcoin-cli -regtest -rpcwallet=minerwallet getbalance

Why is the minerwallet not getting the block reward of 50 btc? I was expecting this output:

$ bitcoin-cli -regtest -rpcwallet=mywallet getbalance
$ bitcoin-cli -regtest -rpcwallet=minerwallet getbalance

1 Answer 1


When you generate a new block, its corresponding block reward needs to mature first for 100 blocks until it is spendable. In your case, it should show up as immature if you run getbalances (note the extra s).

$ bitcoin-cli -regtest -rpcwallet=minerwallet getbalances
> {
    "mine": {
    "trusted": 0.00000000,
    "untrusted_pending": 0.00000000,
    "immature": 50.00000000

This also explains why the balance of your "mywallet" shows as 89.99977500: After having received the block reward of 101 blocks, the first block reward is mature (50 BTC). You then subtract the 10 BTC you sent to your other address, and a small transaction fee. After that, you generate another block to the $MINER_ADDR, which makes the second block reward for "mywallet" mature, adding another 50 BTC to the wallet's balance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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