<p>I am working on an altcoin based on bitcoin-core, version 0.12.1 (this version including <code>setgenerate</code>).
Is their an option for a miner to know (using bitcoin-cli) how many blocks mined by him (after <code>setgenerate</code> was set to true), had been accepted by the network and had been inserted to the blockchain?</p>

CC BY-SA 4.0
2018-06-19T05:30:18.803Z
You wait for a sufficient number of new blocks to be mined on top of your block and see if the chain includes your block. For bitcoin, this is 6 blocks. If you see a chain with a different block at the height you submitted, your block was dropped.
Raghav Sood
CC BY-SA 4.0
2018-06-19T05:39:05.077Z
OK, but is their a way to get the number of blocks which meets that definition by a command (or a set of commands) ? somethonk like `getblockcount`, but counted only for a specific miner.
yoka791
CC BY-SA 4.0
2018-06-19T05:47:18.927Z
No, you will have to maintain an index separately. Additionally, it may not always be possible to tell is multiple blocks were mined by the same miner
Raghav Sood
CC BY-SA 4.0
2018-06-19T06:39:06.910Z
Can you elaborate about how to maintain this index? thanks
yoka791
CC BY-SA 4.0
2018-06-20T06:14:38.333Z
@RaghavSood For bitcoin, it's [100 blocks](https://github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h#L19), I believe.
MCCCS
<bitcoin-core><bitcoind><altcoin-development><bitcoin-cli>
How can a miner know how many blocks mined by him?
yoka791
# How can a miner know how many blocks mined by him?

(Asked by: username_0 on 2018-06-19)

I am working on an altcoin based on bitcoin-core, version 0.12.1 (this version including `setgenerate`).
Is their an option for a miner to know (using bitcoin-cli) how many blocks mined by him (after `setgenerate` was set to true), had been accepted by the network and had been inserted to the blockchain?

**Tags:** bitcoin-core, bitcoind, altcoin-development, bitcoin-cli

> **Comments:**
> **username_1**: You wait for a sufficient number of new blocks to be mined on top of your block and see if the chain includes your block. For bitcoin, this is 6 blocks. If you see a chain with a different block at the height you submitted, your block was dropped.  
> **username_0**: OK, but is their a way to get the number of blocks which meets that definition by a command (or a set of commands) ? somethonk like `getblockcount`, but counted only for a specific miner.  
> **username_1**: No, you will have to maintain an index separately. Additionally, it may not always be possible to tell is multiple blocks were mined by the same miner  
> **username_0**: Can you elaborate about how to maintain this index? thanks  
> **username_2**: @username_1 For bitcoin, it's [100 blocks](https://github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h#L19), I believe.  

---

## 0 answers

