<p>If you look in <code>debug.log</code>, you should see a message that says "proof-of-work found".</p>

<p>Here is an excerpt from <code>debug.log</code> for a testnet block that I found.  (It was immediately orphaned; in fact an earlier block had been found several minutes earlier but had not yet reached me.  So you won't find it in the blockchain.)</p>

<pre><code>BitcoinMiner:
proof-of-work found  
  hash: 00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54  
target: 00000000ffff0000000000000000000000000000000000000000000000000000
CBlock(hash=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54, ver=2, hashPrevBlock=00000000b96e8a2e2f27bf209a1059fd10b117cdf5a6373559eb93268853bc04, hashMerkleRoot=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, nTime=1383697696, nBits=1d00ffff, nNonce=2576125723, vtx=1)
  CTransaction(hash=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 0330f6010101062f503253482f)
    CTxOut(nValue=50.00000000, scriptPubKey=0226fe62f7b1812c421efd7638907f)
  vMerkleTree: f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50 
generated 50.00
keypool keep 6
AddToWallet f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50  new
Committing 1 changed transactions to coin database...
SetBestChain: new best=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54  height=128560  log2_work=57.064666  tx=708022  date=2013-11-06 00:28:16 progress=1.000000
ProcessBlock: ACCEPTED
</code></pre>

<p>I believe <code>debug.log</code> is overwritten periodically, so if your block was created some time ago, you may no longer have this entry in yours.</p>

<p>Newly generated coins <a href="https://en.bitcoin.it/wiki/Confirmation" rel="nofollow noreferrer">require 100 confirmations</a> before they can be spent, and <code>bitcoind</code> apparently won't show them as spendable until 120.  See also <a href="https://bitcoin.stackexchange.com/questions/10825/why-must-generated-coins-mature-120-blocks-before-they-can-be-spent?rq=1">this question</a>.  As far as I know these rules are the same on testnet.</p>

<p>Congratulations on your newfound fake wealth!</p>

CC BY-SA 3.0
2013-12-04T22:43:02.183Z
The debug log is way too huge to manually sift through. Searching through it though for "proof", "work", or "found" revealed nothing obvious though
Earlz
CC BY-SA 3.0
2013-12-04T23:28:24.233Z
@Earlz: I added an excerpt.  If you didn't find it, it may have been overwritten.  Another idea would be to use Block Explorer on the address that received the generated coins, find the block that created them, and grep debug.log for its hash.
Nate Eldredge
CC BY-SA 3.0
2013-12-04T22:35:48.607Z
2013-12-04T23:02:14.057Z
2017-04-13T12:47:36.647Z
Nate Eldredge
<p>As described in <a href="https://en.bitcoin.it/wiki/Running_Bitcoin" rel="nofollow">Running Bitcoin</a>, you need to either use the -blocknotify command line switch or enable the setting in your Bitcoin.conf file.</p>

<p>As the page says, you use a command line script/program and the %s in the command line gets replaced by the new block's hash.  If you need info about the block, you can then look it up using a <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list" rel="nofollow">JSON-RPC command</a> like get-block, for example.</p>

<p>My bitcoind installation has a command-line script that uses CURL, which I then use to post an HTTP notification to my web site.  Just an example of how this can be used.</p>

CC BY-SA 3.0
2014-03-10T22:34:09.827Z
2014-03-10T22:34:09.827Z
ChrisW
<p>I'm using the traditional <code>bitcoind -gen</code> on the testnet to mine some test bitcoins. I did this on one machine for a few hours, and stopped when I found a faucet. Later though, I magically obtained 50 coins in my wallet. I think because blocks have a long confirmation? </p>

<p>Anyway, so how can I tell when bitcoind has successfully mined a block (and now just waiting for confirmations) </p>

<bitcoind><testnet><mining-reward><immature-coins><logging>
How can I tell when bitcoind has found a block?
Earlz
# How can I tell when bitcoind has found a block?

(Asked by: username_0 on 2013-12-04)

I'm using the traditional `bitcoind -gen` on the testnet to mine some test bitcoins. I did this on one machine for a few hours, and stopped when I found a faucet. Later though, I magically obtained 50 coins in my wallet. I think because blocks have a long confirmation?

Anyway, so how can I tell when bitcoind has successfully mined a block (and now just waiting for confirmations)

**Tags:** bitcoind, testnet, mining-reward, immature-coins, logging


---

## 2 answers

### Answer by username_1 on 2013-12-04. Score: 3

If you look in `debug.log`, you should see a message that says "proof-of-work found".

Here is an excerpt from `debug.log` for a testnet block that I found. (It was immediately orphaned; in fact an earlier block had been found several minutes earlier but had not yet reached me. So you won't find it in the blockchain.)

```
BitcoinMiner:
proof-of-work found  
  hash: 00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54  
target: 00000000ffff0000000000000000000000000000000000000000000000000000
CBlock(hash=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54, ver=2, hashPrevBlock=00000000b96e8a2e2f27bf209a1059fd10b117cdf5a6373559eb93268853bc04, hashMerkleRoot=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, nTime=1383697696, nBits=1d00ffff, nNonce=2576125723, vtx=1)
  CTransaction(hash=f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 0330f6010101062f503253482f)
    CTxOut(nValue=50.00000000, scriptPubKey=0226fe62f7b1812c421efd7638907f)
  vMerkleTree: f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50 
generated 50.00
keypool keep 6
AddToWallet f25394d1360a276fa5e3c51b245969d193710d06b5bda12468e11074c8740d50  new
Committing 1 changed transactions to coin database...
SetBestChain: new best=00000000609b21ea1d67f7220d12f7e6f06542907fa24511fa416b286e11cb54  height=128560  log2_work=57.064666  tx=708022  date=2013-11-06 00:28:16 progress=1.000000
ProcessBlock: ACCEPTED

```

I believe `debug.log` is overwritten periodically, so if your block was created some time ago, you may no longer have this entry in yours.

Newly generated coins [require 100 confirmations](https://en.bitcoin.it/wiki/Confirmation) before they can be spent, and `bitcoind` apparently won't show them as spendable until 120. See also [this question](https://bitcoin.stackexchange.com/questions/10825/why-must-generated-coins-mature-120-blocks-before-they-can-be-spent?rq=1). As far as I know these rules are the same on testnet.

Congratulations on your newfound fake wealth!

> **Comments:**
> **username_0**: The debug log is way too huge to manually sift through. Searching through it though for "proof", "work", or "found" revealed nothing obvious though  
> **username_1**: @username_0: I added an excerpt.  If you didn't find it, it may have been overwritten.  Another idea would be to use Block Explorer on the address that received the generated coins, find the block that created them, and grep debug.log for its hash.  

---

### Answer by username_2 on 2014-03-10. Score: 0

As described in [Running Bitcoin](https://en.bitcoin.it/wiki/Running_Bitcoin), you need to either use the -blocknotify command line switch or enable the setting in your Bitcoin.conf file.

As the page says, you use a command line script/program and the %s in the command line gets replaced by the new block's hash. If you need info about the block, you can then look it up using a [JSON-RPC command](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list) like get-block, for example.

My bitcoind installation has a command-line script that uses CURL, which I then use to post an HTTP notification to my web site. Just an example of how this can be used.


---

