Different hash while creating genesis block


I've created a genesis block following this instructions:


Using this data:

./genesis 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f "The Times 2018/03/16 Detectives de bots: como desenmascarar a las cuentas falsas" 486604799

I've got:

Coinbase: 04ffff001d0104505468652054696d657320323031382f30332f3136204465746563746976657320646520626f74733a20636f6d6f20646573656e6d617363617261722061206c6173206375656e7461732066616c736173

PubkeyScript:     4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

Merkle Hash: c029ee7dc05c55da997e0e1a0a926470d163ea1a795222e05e3f39a14f990499
Byteswapped:         9904994fa1393f5ee02252791aea63d17064920a1a0e7e99da555cc07dee29c0
Generating block...
1479761 Hashes/s, Nonce 94652275
Block found!
Hash: 000000006263afe74f41e4260a88bc16493f775ea5c3401c41b05b5d21db45d2
Nonce: 95416095
Unix time: 1521311547

But when I run it in Bitcoin code I get a different hash. I did changes here:

static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
    const char* pszTimestamp = "The Times 2018/03/16 Detectives de bots: como desenmascarar a las cuentas falsas";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);

And here:

// Creating genesis block with Unix time, nonce, nBits, version, and coin reward
genesis = CreateGenesisBlock(1521311547, 95416095, 0x1d00ffff, 1, 100 * COIN);

Hash I get from Bitcoin source:


Hash I should get:


I guess I'm forgetting to set something, or maybe the genesis code is outdated.


Posted 2018-03-17T20:09:20.613

Reputation: 141



Maybe this is useful for someone: I didn't find why the hash was different, it's possible that the code I used for generating the genesis block is outdated.

Finally I used https://github.com/lhartikk/GenesisH0 and it worked, the only caveat was that I only was able to change the timestamp, when I tried to change other stuff (e.g. nBits) it failed.


Posted 2018-03-17T20:09:20.613

Reputation: 141