## How to make genesis block transaction spendable?

3

I read this question Why can’t the genesis block coinbase be spent? . It says because of some quirk (the genesis block coinbase transaction is not added to the global transaction database) genesis block coinbase transaction cannot be spent.

How to add this transaction to the global transaction database ? What changes are needed to make this transaction spendable ?

1

It would be trivially easy to make the change. Just a couple lines of code to add the include the genesis block tx in the utxo.

Understand however the hard part is that would create a hard fork. Unless the change became part of a majority of nodes it would violate the consensus rules. If that output was ever spent any node running older code would be split from any node running newer code as some nodes would see the new txn as valid and some as invalid. This is true for any hard fork scenario. For this reason it is unlikely that hard forks for minor or trivially reasons will ever happen.

Yes it would create a hard fork. I am trying to find where in the source code I have to do the changes. Which function do I have to modify or which function to call ? – somesh – 2015-05-26T12:28:47.307

1

The bitcoin source code has a special case in it to exclude connecting the transactions to the view. It can be found here. Presumably you would just remove this restriction to be able to spend genesis coins. It would also require wiping your datadir, and restarting your node to re-download the blockchain.

If you are working with the real bitcoin network (which I suspect you are not), you won't want to do this. Even though it seems unlikely that Satoshi would ever return and try to spend these coins, such action would lead to your node diverging from the rest of the network

I removed the piece of code(https://github.com/bitcoin/bitcoin/blob/v0.10.2/src/main.cpp#L1664-L1667) and wiped datadir. Then tried testing it in regtest mode bitcoind -regtest -daemon, but the daemon is not starting. It prints Bitcoin Server is Starting but when I use bitcoin-cli -regtest -getbalance it prints error:couldn't connect to server .

– somesh – 2015-06-03T19:48:14.767