This question already has an answer here:

Are the transactions added to the genesis block spendable, just like any other transactions from other blocks, or is that an unspendable coinbase transaction.

In other words..

Is the transaction within the Genesis block spendable, provided the corresponding private key of the bitcoin recipient is found?

and If I fork the Bitcoin code, and generate my own genesis block. Can I use the private key/public key I used as bitcoin recipient of the transactions hard-coded with the genesis block?

marked as duplicate by Nate Eldredge, Raghav Sood, JBaczuk, 0xb10c, chytrik Aug 11 at 10:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Are the transactions added to the genesis block spendable, just like any other transactions from other blocks, or is that an unspendable coinbase transaction.

Transactions aren't spendable; transaction outputs are.

Is the transaction within the Genesis block spendable, provided the corresponding private key of the bitcoin recipient is found?

The single transaction output in Bitcoin's genesis block is not spendable. It is not known whether this was an intentional choice by the system's creator, or an accident. Regardless, the reasons why currently don't matter, as no Bitcoin full node software would accept such a spend.

If I fork the Bitcoin code, and generate my own genesis block. Can I use the private key/public key I used as bitcoin recipient of the transactions hard-coded with the genesis block?

In your own software you can enforce whatever rules you like.

Are the transactions added to the genesis block spendable, just like any other transactions from other blocks, or is that an unspendable coinbase transaction.

The coinbase transaction of the genesis block is not spendable.

If I fork the Bitcoin code, and generate my own genesis block. Can I use the private key/public key I used as bitcoin recipient of the transactions hard-coded with the genesis block?

Yes, but you have to make some modifications to the source code, because it's "unspendability" has been hard coded to avoid a hard fork.

How to make it spendable

chainparams.cpp

  1. Mine your own genesis block by providing all the necessary information in chainparams.cpp, mainly CreateGenesisBlock and Line #123 (for mainnet, similar for testnet and regtest in same file).

validation.cpp

You need to make it so the transaction is added to the index, and bypass some checks that make it unspendable. In v0.16:

  1. You can find where it is not added to the index in validation.cpp Line #1812. Comment out Line 1817 return true to avoid skipping this.

You might also need to skip validation tests (for example if your genesis block difficulty is lower, if you have a premine) in places such as:

  1. Skip nLockTimeFlags |= LOCKTIME_VERIFY_SEQUENCE; on Line #1891 by adding a check around it:

    if (block.GetHash() != chainparams.GetConsensus().hashGenesisBlock) { if (VersionBitsState(pindex->pprev, chainparams.GetConsensus(), Consensus::DEPLOYMENT_CSV, versionbitscache) == THRESHOLD_ACTIVE) { nLockTimeFlags |= LOCKTIME_VERIFY_SEQUENCE; } }

  2. Also similar exceptions (check that != genesis block) for if (!WriteUndoDataForBlock(blockundo, state, pindex, chainparams)) return false; on Line #1988

  3. Similar exception for Line #1805, Lines #1873-1876

Basically, you need to run it and try and see where it fails in the logs, because you're breaking a bunch of rules.

Not the answer you're looking for? Browse other questions tagged or ask your own question.