Genesis-Block

如何創建新的創世塊?

  • March 29, 2018

我正在嘗試創建一種新的加密貨幣,並且正在努力使用比特幣程式碼創建創世塊。我正在關注本教程<https://bitcointalk.org/index.php?topic=225690.0>並且我相信程式碼已經很老了。

我已經更改了參數和

genesis = CreateGenesisBlock(1515428732, 2018236893, 0x1d00ffff, 1, 50 * COIN);
  consensus.hashGenesisBlock = genesis.GetHash("");
  assert(consensus.hashGenesisBlock == uint256S(""));
  assert(genesis.hashMerkleRoot == uint256S(""));

但它沒有編譯

chainparams.cpp:240:54: error: too many arguments to function call, expected 0, have 1
       consensus.hashGenesisBlock = genesis.GetHash("");
                                    ~~~~~~~~~~~~~~~ ^~
./primitives/block.h:63:5: note: 'GetHash' declared here
   uint256 GetHash() const;
   ^
chainparams.cpp:333:54: error: too many arguments to function call, expected 0, have 1
       consensus.hashGenesisBlock = genesis.GetHash("");
                                    ~~~~~~~~~~~~~~~ ^~
./primitives/block.h:63:5: note: 'GetHash' declared here
   uint256 GetHash() const;

我檢查了 debug.log 但我沒有看到 hashGenesis 和 Merkel root 的新值。

229tx)
2017-09-07 13:40:39 UpdateTip: new best=00000000000008838dc29dd8f585e69dc53731d6de106179c6a76b1b20c31396 height=177243 version=0x00000001 log2_work=68.044269 tx=2915938 date='2012-04-26 03:22:53' progress=0.011538 cache=210.7MiB(789124tx)
2017-09-07 13:40:39 UpdateTip: new best=0000000000000729fce8abd24f2abb7f1080f603a7d5f75794c79afec3efbadd height=177244 version=0x00000001 log2_work=68.044301 tx=2915981 date='2012-04-26 03:11:31' progress=0.011539 cache=210.7MiB(789104tx)
2017-09-07 13:40:39 UpdateTip: new best=000000000000016217c799e6d414cbd420da4a134a3b1a9b30f728b7da81d6d9 height=177245 version=0x00000001 log2_work=68.044333 tx=2916006 date='2012-04-26 03:09:07' progress=0.011539 cache=210.7MiB(789117tx)
genesis.GetHash("");

這是不正確的。GetHash不帶參數,如編譯器錯誤中所述。這應該只是genesis.GetHash();

我檢查了 debug.log 但我沒有看到 hashGenesis 和 Merkel root 的新值。

debug.log 文件僅在您執行程序時被修改,並且因為它甚至沒有編譯,所以當您執行它時,您並沒有在執行它時進行任何更改。

引用自:https://bitcoin.stackexchange.com/questions/68140