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

SHA 256 MERKLE ROOT problem. #38

Open
DIESELNY opened this issue Apr 24, 2018 · 6 comments
Open

SHA 256 MERKLE ROOT problem. #38

DIESELNY opened this issue Apr 24, 2018 · 6 comments

Comments

@DIESELNY
Copy link

DIESELNY commented Apr 24, 2018

Hello,

When i try to run my coin-qt i'l get this error.

Terminal :

Code:

./rhinoxcoin-qt
rhinoxcoin-qt: src/main.cpp:2802: bool InitBlockIndex(): Assertion `block.hashMerkleRoot == uint256("0xc3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e")' failed.
Aborted (core dumped)

Debug log :

Code:

2018-04-24 11:29:57 Rhinoxcoin version v0.8.6.0-g9d11aba4c477-beta ()
2018-04-24 11:29:57 Using OpenSSL version OpenSSL 1.0.2g  1 Mar 2016
2018-04-24 11:29:57 Default data directory /home/dave/.rhinoxcoin
2018-04-24 11:29:57 Using data directory /home/dave/.rhinoxcoin
2018-04-24 11:29:57 Using at most 125 connections (1024 file descriptors available)
2018-04-24 11:29:57 Using 4 threads for script verification
2018-04-24 11:29:57 init message: Verifying wallet...
2018-04-24 11:29:57 dbenv.open LogDir=/home/dave/.rhinoxcoin/database ErrorFile=/home/dave/.rhinoxcoin/db.log
2018-04-24 11:29:57 Bound to [::]:2333
2018-04-24 11:29:57 Bound to 0.0.0.0:2333
2018-04-24 11:29:57 init message: Loading block index...
2018-04-24 11:29:57 Opening LevelDB in /home/dave/.rhinoxcoin/blocks/index
2018-04-24 11:29:57 Opened LevelDB successfully
2018-04-24 11:29:57 Opening LevelDB in /home/dave/.rhinoxcoin/chainstate
2018-04-24 11:29:57 Opened LevelDB successfully
2018-04-24 11:29:57 LoadBlockIndexDB(): last block file = 0
2018-04-24 11:29:57 LoadBlockIndexDB(): transaction index disabled
2018-04-24 11:29:57 Initializing databases...
2018-04-24 11:29:57 a7ad3499136bfb1d2cfbfb94ad8e1d28b447ea8b29bb40076cdf82572e224d39
2018-04-24 11:29:57 00000000a92bc246551b51a7b3794903d926cd3eeac2bc235eb243da88041d95
2018-04-24 11:29:57 55fb2cea67523e56269a3ab7c6d2db681e7c920421f324068658044bf13706f1

I have created a genenis hash for the main net and test net using the script but cannot get it to work..

Using the following data :

Scriptpubkey: 041c412c1c519b891fe3c6e23a31c99c76a61a1d76740aa7e44cef513b53bf8ab07f230db005313eb6e7328b4da569eafa36c33013d54c8677cc75db7667937a56
PSZTIMESTAMP : NY TIMES 23 APRIL 2018Avengers the Most Lucrative Movie Franchise Ever Is Wrapping Up Why
ALGORITHM : SHA256 
EPOCH TIME : auto
Code:
MAIN NET :
 
GENESISHASH: 00000000a92bc246551b51a7b3794903d926cd3eeac2bc235eb243da88041d95
TIME : 1524508661
NONCE : 1189467988
MERKLE : c3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e
 

TEST NET :

GENESISHASH: 000000005794bc41eaabeaff7ae7ff99c632add8066f92d7a3c252ceb9e0c2af
TIME : 1524559326
NONCE:  1706123325
MERKLE : c3e530365aa74d32d5115aab6feb707ce72d82ee72b8693b213751b5e4ceaf7e

It seems that something is wrong with the merkle root, any solutions , or am i doing something wrong here ?

Greetings Dave.

@followtheart
Copy link

followtheart commented Apr 24, 2018

screenshot from 2018-04-25 02-10-07

merkle hash should be sth like:

0x55fb2cea67523e56269a3ab7c6d2db681e7c920421f324068658044bf13706f1

in image

@DIESELNY
Copy link
Author

DIESELNY commented Apr 24, 2018

Thanks for your reply,

It seems like im using this script wrong i guess. Im using ubuntu and edit the values in the script directly.

I use this command to output the Pubkey hex : openssl ec -in testnetalert.pem -text > genesiscoinbase.hex

This is how i search for my hash,

screenshot from 2018-04-24 20-56-26

Am i doing something wrong or ?

It seems like the script is getting the wrong merkle hash and is hashing a genesisblock, but once i change the merkle hash to the one you provided and is in my debug log, it says wrong genesishash ...

@followtheart
Copy link

May be you have some parameter diff.
If you have trouble with this scripts.
you can also add some code like below in function InitBlockIndex(Litecoin)

        //// debug print
        if(block.GetHash()!=hashGenesisBlock){
            uint256 powhash=block.GetPoWHash();
            while (powhash > bnProofOfWorkLimit.getuint256()){
                if (++block.nNonce==0) break;
                powhash = block.GetPoWHash();
            }
            printf("HASH WE NEED 0x%s\n", block.GetHash().ToString().c_str());
            printf("hashGenesisBlock 0x%s\n", hashGenesisBlock.ToString().c_str());
            printf("MerkleRoot 0x%s\n", block.hashMerkleRoot.ToString().c_str());
            printf("nNounce %d\n",block.nNonce);
        }
        assert(block.hashMerkleRoot == uint256("zaobi-genesis-merkleroot"));
        block.print();
        assert(block.GetHash() == hashGenesisBlock);

Build and running your wallet(need some time,first run),
You will get an usable genesis block in debug logs.
always works.

@DIESELNY
Copy link
Author

DIESELNY commented Apr 25, 2018 via email

@realChainLife
Copy link

Hey, what do mean UTF-8 issue? I'm getting the same assertion error you were getting after compiling

Hello, Thanks for your reply, I sorted it out , used your python code from github, had something to do with the UTF-8, now it's hashing the correct parameters. THanks. 2018-04-25 17:10 GMT+02:00

@TheRidDlerX
Copy link

TheRidDlerX commented Aug 3, 2019

Hello, Thanks for your reply, I sorted it out , used your python code from github, had something to do with the UTF-8, now it's hashing the correct parameters. THanks. 2018-04-25 17:10 GMT+02:00 followtheart notifications@github.com:

Hi there. Do you mind sharing what the issue was with UTF-8 and how you resolved it? Im having the same issue with the GenesisH0 script but for scrypt. Thank you

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

4 participants