Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after mining genesis block its shown #349

Closed
potadibyo opened this issue Aug 27, 2018 · 1 comment
Closed

after mining genesis block its shown #349

potadibyo opened this issue Aug 27, 2018 · 1 comment

Comments

@potadibyo
Copy link

potadibyo commented Aug 27, 2018

I Mined The genesis block through this code
consensus.hashGenesisBlock = uint256S("0x");
std::cout << std::string("Begin calculating Mainnet Genesis Block:\n");
if (true && (genesis.GetHash(consensus) != consensus.hashGenesisBlock))
{
printf("Calculating Mainnet Genesis Block:\n");
LogPrintf("Calculating Mainnet Genesis Block:\n");
arith_uint256 hashTarget = arith_uint256().SetCompact(genesis.nBits);
uint256 hash;
genesis.nNonce = ArithToUint256(0);
while ((UintToArith256(genesis.GetHash(consensus)) > hashTarget)
{
genesis.nNonce = ArithToUint256(UintToArith256(genesis.nNonce) + 1);
if (genesis.nNonce == ArithToUint256(arith_uint256(0)))
{
LogPrintf("NONCE WRAPPED, incrementing time");
std::cout << std::string("NONCE WRAPPED, incrementing time:\n");
++genesis.nTime;
}

                     if ((int)genesis.nNonce.GetUint64(0) % 10000 == 0)
                     {
                          std::cout << strNetworkID << " hashTarget: " << hashTarget.ToString() << " nonce: " << genesis.nNonce.ToString() << " time: " << genesis.nTime << " hash: " << genesis.GetHash(consensus).ToString().c_str() << "\r";
                     }

        }
                 std::cout << "Mainnet ---\n";
                 std::cout << "  nonce: " << genesis.nNonce.ToString() <<  "\n";
                 std::cout << "   time: " << genesis.nTime << "\n";
                 std::cout << "   hash: " << genesis.GetHash(consensus).ToString().c_str() << "\n";
                 std::cout << "   merklehash: "  << genesis.hashMerkleRoot.ToString().c_str() << "\n";
    }
    std::cout << std::string("Finished calculating Mainnet Genesis Block:\n");

////nonce : 000000000000000000000000000000000000000000000000000000000000000000000003d04c923
///////////genesishash : 000000001b09e6b2c626694c17c0ce45148897ba738103e5bd65e7c99f6a738b
///////Merkle Root : 64166c8fd000b931395a6616ac26cceaf6f4a2ea11e292575ab84cee5b90977b
it gives nonce like this : 000000000000000000000000000000000000000000000000000000000000000000000003d04c923
but time to genesis function wriiten on like genesis = CreateGenesisBlock(1534773936, 2083236893, 0x1d00ffff, 1, 50 * COIN);
000000000000000000000000000000000000000000000000000000000000000000000003d04c923 is not like (2083236893) format How can i turned into this formating like nonce writtrn in CreateGenesisBlock(),
I know just beacause of i didnot give proper nonce format ,
How I can convert this nonce to crategenesisblock nonce type.
chainparams.cpp:219: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0x000000001b09e6b2c626694c17c0ce45148897ba7c99f6a738b")' failed.
please help me need your advice members,
Thank You,
Dibyajit

@h4x3rotab
Copy link
Member

You can convert a uint32 into a uint256 by ArithToUint256(arith_uint256(u32))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants