<p>It's a result of a quirk from the original Bitcoin client which has been carried forward to today. Originally, the UTXO database held entire transactions; it was similar to/basically the same as the transaction index that exists now today. However the original Bitcoin client had a bug where it did not include the transaction data of the genesis block. This is because the genesis block was not processed like every new block so it's data never made it into the UTXO database. Because it was never part of the UTXO database, it affects consensus so this bug cannot be fixed without a hard fork.</p>

<p>Fast forward to today and the genesis block is still not processed like other blocks in order to keep UTXO databases consistent so there is not a hard fork. This also means that the transaction in the genesis block won't be part of any databases, including the transaction index, which is why you cannot look up that transaction. Fixing this so that the transaction were added to the transaction index would require significant changes to fix this one special case as the block cannot be processed or it may cause a hard fork.</p>

<p>Instead of trying to query the transaction, you should use <code>getblock</code> using verbosity level 2. This will decode the block even further to give you the transactions decoded instead of just their transaction ids. Since the block itself is known and in the block index, the block can be fetched and decoded so yo ucan get the transaction data that way. In fact, I would recommend that you always use <code>getblock</code> with verbosity 2 so you can get the block data and all of the transaction data decoded with one RPC instead of needing multiple to fetch each transaction in a block.</p>

CC BY-SA 4.0
2019-01-08T04:11:56.440Z
2019-01-08T04:11:56.440Z
Ava Chow
<p>I am trying to insert BTC blocks and transactions in <strong>MONGODB</strong> collection from count 0 using <strong>Python3</strong>. <code>getrawtransaction</code> is giving output for block 1 but not for block 0. Can somebody help me why this happening?</p>

<bitcoind><python>
getrawtransaction not working for 0th BTC block transaction
Varsh
# getrawtransaction not working for 0th BTC block transaction

(Asked by: username_0 on 2019-01-08)

I am trying to insert BTC blocks and transactions in **MONGODB** collection from count 0 using **Python3**. `getrawtransaction` is giving output for block 1 but not for block 0. Can somebody help me why this happening?

**Tags:** bitcoind, python


---

## 1 answers

### Answer by username_1 on 2019-01-08. Score: 2

It's a result of a quirk from the original Bitcoin client which has been carried forward to today. Originally, the UTXO database held entire transactions; it was similar to/basically the same as the transaction index that exists now today. However the original Bitcoin client had a bug where it did not include the transaction data of the genesis block. This is because the genesis block was not processed like every new block so it's data never made it into the UTXO database. Because it was never part of the UTXO database, it affects consensus so this bug cannot be fixed without a hard fork.

Fast forward to today and the genesis block is still not processed like other blocks in order to keep UTXO databases consistent so there is not a hard fork. This also means that the transaction in the genesis block won't be part of any databases, including the transaction index, which is why you cannot look up that transaction. Fixing this so that the transaction were added to the transaction index would require significant changes to fix this one special case as the block cannot be processed or it may cause a hard fork.

Instead of trying to query the transaction, you should use `getblock` using verbosity level 2. This will decode the block even further to give you the transactions decoded instead of just their transaction ids. Since the block itself is known and in the block index, the block can be fetched and decoded so yo ucan get the transaction data that way. In fact, I would recommend that you always use `getblock` with verbosity 2 so you can get the block data and all of the transaction data decoded with one RPC instead of needing multiple to fetch each transaction in a block.


---

