<p>The <code>getblock</code> command is used for retrieving historical blocks, not for constructing a new block. For every block in the currently active chain except for the latest block the next block hash is known.</p>

CC BY-SA 4.0
2024-03-13T07:20:54.423Z
2024-03-13T07:20:54.423Z
Vojtěch Strnad
<p>In the book &quot;Mastering Bitcoin&quot; (3rd edition), on page 46, there is an element <code>nextblockhash</code> in the block struct after issuing a <code>getblock</code> command, anyone can explain it and how to use it. You know this element will not be known in advance when constructing a block.</p>

<blockchain><json-rpc><mastering-bitcoin><getblock>
Question about nextblockhash in bitcoin block struct
fa william
# Question about nextblockhash in bitcoin block struct

(Asked by: username_0 on 2024-03-13)

In the book "Mastering Bitcoin" (3rd edition), on page 46, there is an element `nextblockhash` in the block struct after issuing a `getblock` command, anyone can explain it and how to use it. You know this element will not be known in advance when constructing a block.

**Tags:** blockchain, json-rpc, mastering-bitcoin, getblock


---

## 1 answers

### Answer by username_1 on 2024-03-13. Score: 4 | Accepted answer

The `getblock` command is used for retrieving historical blocks, not for constructing a new block. For every block in the currently active chain except for the latest block the next block hash is known.


---

