<p>The chances of two blocks having the same hash are extraordinarily low. Having the same hash would essentially ensure that they must be the same block (two copies of the same block with the same transactions at the same height with the same ancestor).</p>

<p>While the blocks themselves do not contain the height, most full node software keeps track of the height of each block. In Bitcoin Core you can use <code>getblockchaininfo</code> to see how many blocks your node has or, <code>getblockcount</code> to see how many blocks your node knows about.</p>

CC BY-SA 3.0
2018-04-30T13:43:49.530Z
All blocks after 2012 contain the height in the block's coinbase transaction, see https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki
Claris
CC BY-SA 3.0
2018-04-30T10:26:17.533Z
2018-04-30T10:26:17.533Z
Willtech
<p>Why block index or block height is not included in the block header?<br>
Do we have to go through the whole chain if we want to know how many blocks are there in a chain?<br>
On the other hand, if some blocks have the same hash, how to find them and get their content individually?</p>

<block-header><height>
Why there is no block index or block height included in the block header?
Bill
# Why there is no block index or block height included in the block header?

(Asked by: username_0 on 2018-04-30)

Why block index or block height is not included in the block header?  
Do we have to go through the whole chain if we want to know how many blocks are there in a chain?  
On the other hand, if some blocks have the same hash, how to find them and get their content individually?

**Tags:** block-header, height


---

## 1 answers

### Answer by username_1 on 2018-04-30. Score: 3 | Accepted answer

The chances of two blocks having the same hash are extraordinarily low. Having the same hash would essentially ensure that they must be the same block (two copies of the same block with the same transactions at the same height with the same ancestor).

While the blocks themselves do not contain the height, most full node software keeps track of the height of each block. In Bitcoin Core you can use `getblockchaininfo` to see how many blocks your node has or, `getblockcount` to see how many blocks your node knows about.

> **Comments:**
> **username_2**: All blocks after 2012 contain the height in the block's coinbase transaction, see https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki  

---

