<p>This occurs because the genesis block is a special block. It is not written to disk like all other blocks are. It cannot be undone so there is no undo data for it. <code>getblockstats</code> uses the undo data (essentially a compact representation of the UTXOs spent by the transactions in a block) to calculate many of the block stats, but because the genesis block does not have undo data, you see this error.</p>
<p>The error could be improved, or a special case added for the genesis block. Regardless, this error is because of how the RPC is implemented, not with your nodes.</p>

CC BY-SA 4.0
2022-01-15T04:05:18.140Z
2022-01-15T04:05:18.140Z
Ava Chow
<p>I am running a full node, bitcoin core 22. It is not in pruned mode.
But when I try to run RPC <code>getblockstats</code> call I get this.</p>
<pre><code>$ bitcoin-cli getblockstats 0                                                                   
error code: -1
error message:
Can't read undo data from disk
</code></pre>
<p>I don't have any error with block 1.
And I tested it in two different nodes in two different machines, and I get the same error.</p>
<p>Why this happens?</p>

CC BY-SA 4.0
2022-01-15T19:35:08.947Z
I am reading the pull request. Thanks.
Maximus Maximalistus
<bitcoin-core><json-rpc><block><genesis-block><getblockstats>
RPC getblockstats call using genesis block
Maximus Maximalistus
# RPC getblockstats call using genesis block

(Asked by: username_0 on 2022-01-15)

I am running a full node, bitcoin core 22. It is not in pruned mode.
But when I try to run RPC getblockstats call I get this.
$ bitcoin-cli getblockstats 0                                                                   
error code: -1
error message:
Can't read undo data from disk

I don't have any error with block 1.
And I tested it in two different nodes in two different machines, and I get the same error.
Why this happens?

**Tags:** bitcoin-core, json-rpc, block, genesis-block, getblockstats

> **Comments:**
> **username_0**: I am reading the pull request. Thanks.  

---

## 1 answers

### Answer by username_1 on 2022-01-15. Score: 6

This occurs because the genesis block is a special block. It is not written to disk like all other blocks are. It cannot be undone so there is no undo data for it. `getblockstats` uses the undo data (essentially a compact representation of the UTXOs spent by the transactions in a block) to calculate many of the block stats, but because the genesis block does not have undo data, you see this error.

The error could be improved, or a special case added for the genesis block. Regardless, this error is because of how the RPC is implemented, not with your nodes.


---

