Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Many Coins on February 16, 2018, 06:36:09 PM



Title: By what formula is the genesis-hash calculated?
Post by: Many Coins on February 16, 2018, 06:36:09 PM
Hello!

Tell me please: by what formula is the genesis-hash calculated?

Code:
uint256 hashGenesisBlock("0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2");

That is:

Code:
0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2

what? :)

(A+B)*C = 0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2?  8)

I understand that this is a hash from something :) But from what?

Thank you.


Title: Re: By what formula is the genesis-hash calculated?
Post by: achow101 on February 16, 2018, 09:07:51 PM
It's the hash of the genesis block. The genesis blocks parameters can be found in chainparams.cpp. It is then serialized and hashed.


Title: Re: By what formula is the genesis-hash calculated?
Post by: ir.hn on February 17, 2018, 04:44:58 AM
This:

printf("calc new genesis block\n");
            printf("hashMerkleRoot %s\n", genesis.hashMerkleRoot.ToString().c_str());
            printf("bnProofOfWorkLimit 0x%x\n", bnProofOfWorkLimit.GetCompact());
            printf("genesis.nBits 0x%x\n", genesis.nBits);

            for (genesis.nNonce = 0; ; genesis.nNonce++) {
                hashGenesisBlock = genesis.GetHash();
                if (hashGenesisBlock <= bnProofOfWorkLimit.getuint256()) break;
            }

            printf("hashGenesisBlock %s\n", hashGenesisBlock.ToString().c_str());
            printf("genesis.nNonce %d\n", genesis.nNonce);


Title: Re: By what formula is the genesis-hash calculated?
Post by: Many Coins on February 17, 2018, 08:41:07 AM
Thank you. I'll try to figure it out :)