Upgrading from 0.14 to 0.25. Issue with pszTimestamp and consensus assertion

3 replies 248 views
Posts: 3 · Reputation: 110
#1Mar 2, 2025, 01:07 AM
I've got a slightly tweaked version of bitcoin-0.14. Just a name change and a different key. Managed to get it upgraded to bitcoin-25, but I'm stuck on this error. CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0x00001ef7e03e773817a36c267d6f431412a3678dec49b4171f86ce419abcddea")' failed. I think the issue lies with: 0x00001ef7e03e773817a36c267d6f431412a3678dec49b4171f86ce419abcddea and pszTimestamp = "New York Times 8/Sep/2017 Equifax Says Cyberattack May Have Affected 143 Million Customers"; const CScript scriptPubKey = CScript() << ParseHex("03facfdfc22816528518884608350d828e1403dd142d2276303b5b6da7a From the old src/chainparams.cpp: #define GENESIS_TIME 1510225282 #define GENESIS_DIFFICULTY 0x1e7fffff void MineGenesisBlock(CBlock &genesis); static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& scriptPubKey, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { CMutableTransaction txNew; txNew.nVersion = 2; txNew.vin.resize(1); txNew.vout.resize(1); unsigned int height = 0; txNew.vin[0].scriptSig = CScript() << height << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); txNew.vout[0].nValue = genesisReward; txNew.vout[0].scriptPubKey = scriptPubKey; CBlock genesis; genesis.nTime = nTime; genesis.nBits = nBits; genesis.nNonce = nNonce; genesis.nVersion = nVersion; genesis.vtx.push_back(MakeTransaction
6 Reply Quote Share
Posts: 3 · Reputation: 110
#2Mar 2, 2025, 05:15 AM
Thanks for the response. Yes, you are correct. There were only a few changes (the keys/hash) in chainparams.cpp to upgrade. Moving them over to 0.25, regardless of anything I  do,  blows up with a genesis hash key failure against the one ending in *dea. It would be simple if starting a genesis hash from the get go, but I'm stuck with the original keys/hash, pszTimestamp... Ho hum Plus1 github isn't going to respond, lol. It's interesting to me. I've spent two days and $50 beating up ChatGPT and claude.ai to no avail. I think it must be something to do with timing or an upgrade in byte code. I've tried setting txNew.nVersion to match, and copying a lot of the old code into the new kernel/src/chainparams.cpp (it changed from src/chainparams.cpp), which throws the same assert failure. I thought I'd ask and hope for the best. I learned a lot from going through the code, but I'm your average or below average novice programmer. This one is beyond my skill level. Any suggestions are welcome and appreciated.
3 Reply Quote Share
Posts: 3 · Reputation: 110
#3Mar 4, 2025, 10:19 AM
It was able to help me with some things, while other times it said "As an AI ... I can't modify or write code for you, but I can give you this example..." If I phrase it differently, my luck improved and I was able to get partial, or full code returns, and it even created some patches to help me update or get some broken code to work. But, as you said, it is in its infancy and is often incorrect and failed. So, it is kind of hit or miss. Then, you hit a token limit and have to wait 48 hours to ask it again.
4 Reply Quote Share
LuckyCoinLegendary
Posts: 832 · Reputation: 4795
#4Mar 4, 2025, 08:23 PM
You need to search for the lines of code that have the old genesis block hash in it so you can find the line that contains the assertion, since G++ is not printing the line number for it I don't think. Open a Unix shell at the root source folder and run this command (MinGW or Git for Windows shell also works): (I'm pretty sure there's a shorter way to write this but I keep forgetting it. Maybe try ripgrep.)
8 Reply Quote Share

Related topics