0

Is there a way to determine the genesis transaction (genesis_tx) hash? I know the genesis block number but how do you determine genesis_tx? I am looking for this hash for an altcoin which was forked from litecoin.

1

The genesis block's coinbase transaction hash will be the same as the blocks merkle root because the coinbase transaction should be the only transaction in the genesis block. You should be able to find it in chainparams.cpp if the codebase is still similar to bitcoin, like so: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L125

assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
  • It is forked from litecoin so it should be similar. So essentially, the genesis_tx is the merkleroot? – Nixxed Feb 13 '18 at 21:51
  • 1
    @Nixxed Yep that's what I said ;) – MeshCollider Feb 14 '18 at 4:33
0

You can also get it from command line with bitcoin-cli, litecoin-cli etc.

For litecoin in regtest mode for example, first get the hash of the genesis block (height = 0):

$ litecoin-cli getblockhash 0

which returns 530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9.

Then get the genesis block using its hash:

$ litecoin-cli getblock 530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9

which returns:

{ "hash": "530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9", "confirmations": 1, "strippedsize": 280, "size": 280, "weight": 1120, "height": 0, "version": 1, "versionHex": "00000001", "merkleroot": "97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9", "tx": [ "97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9" ], "time": 1296688602, "mediantime": 1296688602, "nonce": 0, "bits": "207fffff", "difficulty": 4.656542373906925e-10, "chainwork": "0000000000000000000000000000000000000000000000000000000000000002" }

Notice there is no nextblockhash property because I have a freshly initialized regtest chain i.e. it has no blocks other than the genesis. But even if I were to generate blocks with say generate or generatetoaddress, I'd still have all the fields remain as shown above. Only additional field would be a nextblockhash.

As @MeshCollider said in his answer, given that the genesis block has a single coinbase tx, its txid and the merkeRoot coincide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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