Hello there,
I’m experimenting around with the creation of my own genesis block / own chain of peercoin. Unfortunately the only tutorial for this is for PeerShares, which is not maintained anymore.
From what I’ve read on forums and combined with the peershares tutorial, this is what I did, which unfortunately does not succeeed:
main.cpp commented out line 3222:
//hashGenesisBlock = uint256("00008d0d88095d31f6dbdbcf80f6e51f71adf2be15740301f5e05cc0f3b2d2c0");
main.cpp changed pszTimestamp on line 3271:
const char* pszTimestamp = "NYT 9-4-18 Facebooks Other Critics: Its Viral Stars";
Compiling goes OK, I get this since the hashMerkleRoot is the old one from peercoin chain
/peercoin/src$ ./peercoind
peercoind: main.cpp:3310: bool InitBlockIndex(): Assertion `block.hashMerkleRoot == uint256(“0x3c2d8f85fab4d17aac558cc648a1a58acff0de6deb890c29985690052c5993c2”)’ failed.
Aborted (core dumped)
And the content of my debug.log:
2018-04-09 11:57:45 Opened LevelDB successfully
2018-04-09 11:57:45 Peercoin Network: genesis=0x0000000032fe677166d5 nBitsLimit=0x1d00ffff nBitsInitial=0x1c00ffff nStakeMinAge=2592000 nCoinbaseMaturity=500 nModifierInterval=21600
2018-04-09 11:57:45 LoadBlockIndexDB(): last block file = 0
2018-04-09 11:57:45 LoadBlockIndexDB(): synchronized checkpoint not read
2018-04-09 11:57:45 LoadBlockIndexDB(): synchronized checkpoint 0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3
2018-04-09 11:57:45 LoadBlockIndexDB(): transaction index disabled
2018-04-09 11:57:45 Initializing databases…
2018-04-09 11:57:45 ba2c38d635163680e895cf4edf86153ccd73fab8fbcd73b00f3b4daefe21f3a4
2018-04-09 11:57:45 0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3
2018-04-09 11:57:45 e947fc6a60eadcf5b9a891fd23633f44e42e5d70d2fd5390e7f0a016f45e60dc
from debug.log i get the hashMerkleRoot which should be the last value (last line) and add it to line 3310 in main.cpp:
assert(block.hashMerkleRoot == uint256("0x72617357890cf4285cbfd9eaeebf6f25db7057b2b678cd8f5bfaa3080193e74f"));
Now I recompile again, get the genesisBlockHash from the debug file: in this case it should be (?): 2018-04-09 12:31:09 0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3 and add it to main.cpp line 3222:
hashGenesisBlock = uint256("0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3");
After last compile, this is my error:
bibz@bibz-u:~/peercoin/src$ ./peercoind
peercoind: main.cpp:3312: bool InitBlockIndex(): Assertion `hash == hashGenesisBlock’ failed.
Aborted (core dumped)
and debug.log:
2018-04-09 12:31:09 Peercoin version v0.6.2ppc-dirty (2018-03-10 20:21:14 +0300)
2018-04-09 12:31:09 Using OpenSSL version OpenSSL 1.0.2g 1 Mar 2016
2018-04-09 12:31:09 Default data directory /home/bibz/.peercoin
2018-04-09 12:31:09 Using data directory /home/bibz/.peercoin
2018-04-09 12:31:09 Using at most 125 connections (1024 file descriptors available)
2018-04-09 12:31:09 Using 12 threads for script verification
2018-04-09 12:31:09 init message: Verifying wallet…
2018-04-09 12:31:09 dbenv.open LogDir=/home/bibz/.peercoin/database ErrorFile=/home/bibz/.peercoin/db.log
2018-04-09 12:31:09 Bound to [::]:9901
2018-04-09 12:31:09 Bound to 0.0.0.0:9901
2018-04-09 12:31:09 init message: Loading block index…
2018-04-09 12:31:09 Opening LevelDB in /home/bibz/.peercoin/blocks/index
2018-04-09 12:31:09 Opened LevelDB successfully
2018-04-09 12:31:09 Opening LevelDB in /home/bibz/.peercoin/chainstate
2018-04-09 12:31:09 Opened LevelDB successfully
2018-04-09 12:31:09 Peercoin Network: genesis=0x0000000032fe677166d5 nBitsLimit=0x1d00ffff nBitsInitial=0x1c00ffff nStakeMinAge=2592000 nCoinbaseMaturity=500 nModifierInterval=21600
2018-04-09 12:31:09 LoadBlockIndexDB(): last block file = 0
2018-04-09 12:31:09 LoadBlockIndexDB(): synchronized checkpoint not read
2018-04-09 12:31:09 LoadBlockIndexDB(): synchronized checkpoint 0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3
2018-04-09 12:31:09 LoadBlockIndexDB(): transaction index enabled
2018-04-09 12:31:09 Initializing databases…
2018-04-09 12:31:09 dc4cee563966e3aae37f8cab2cbc716204f81d21ca5298bbc718a2089e76f095
2018-04-09 12:31:09 0000000032fe677166d54963b62a4677d8957e87c508eaa4fd7eb1c880cd27e3
2018-04-09 12:31:09 72617357890cf4285cbfd9eaeebf6f25db7057b2b678cd8f5bfaa3080193e74f
2018-04-09 12:31:09 CBlock(hash=dc4cee563966e3aae37f8cab2cbc716204f81d21ca5298bbc718a2089e76f095, ver=1, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=72617357890cf4285cbfd9eaeebf6f25db7057b2b678cd8f5bfaa3080193e74f, nTime=1523275630, nBits=1d00ffff, nNonce=2179302059, vtx=1, vchBlockSig=)
2018-04-09 12:31:09 Coinbase(hash=72617357890cf4285cbfd9eaeebf6f25db7057b2b678cd8f5bfaa3080193e74f, nTime=1523275630, ver=1, vin.size=1, vout.size=1, nLockTime=0)
CTxIn(COutPoint(0000000000000000000000000000000000000000000000000000000000000000, 4294967295), coinbase 04ffff001d020f27334e595420392d342d31382046616365626f6f6b73204f7468657220437269746963733a2049747320566972616c205374617273)
CTxOut(empty)
vMerkleTree: 72617357890cf4285cbfd9eaeebf6f25db7057b2b678cd8f5bfaa3080193e74f
What am I doing wrong? Did I pick up the wrong genesisHash? And what is the difference between
printf("%s\n", hash.ToString().c_str());
and
printf("%s\n", hashGenesisBlock.ToString().c_str());
The latter should be the hash of the genesis block which I need in line 3222, right?
Thanks in advance for the help. I’d be glad to setup a small tutorial / guide after I figure out what the problem is.