MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CreateGenesisBlock

Function CreateGenesisBlock

src/chainparams.cpp:35–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#include <chainparamsseeds.h>
34
35static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
36{
37 CMutableTransaction txNew;
38 txNew.nVersion = 1;
39 txNew.vin.resize(1);
40 txNew.vout.resize(1);
41 txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
42 txNew.vout[0].nValue = genesisReward;
43 txNew.vout[0].scriptPubKey = genesisOutputScript;
44
45 CBlock genesis;
46 genesis.nTime = nTime;
47 genesis.nBits = nBits;
48 genesis.nNonce = ArithToUint256(arith_uint256(nNonce));
49 genesis.nVersion = nVersion;
50 genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
51 genesis.hashPrevBlock.SetNull();
52 genesis.nHeight = 0;
53 genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
54
55 return genesis;
56}
57
58/**
59 * Build the genesis block. Note that the output of its generation

Callers 3

CMainParamsMethod · 0.85
CTestNetParamsMethod · 0.85
CRegTestParamsMethod · 0.85

Calls 10

ArithToUint256Function · 0.85
arith_uint256Class · 0.85
MakeTransactionRefFunction · 0.85
BlockMerkleRootFunction · 0.85
ParseHexFunction · 0.85
CScriptClass · 0.70
CScriptNumClass · 0.50
resizeMethod · 0.45
push_backMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected