Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: iwantodev on September 13, 2015, 08:29:44 PM



Title: forking a coin : how to merkle root
Post by: iwantodev on September 13, 2015, 08:29:44 PM
I'm trying to fork a X13 coin I like but i'm missing something important.

I've made all the code changes I want, then I use GenesisH0 to get merkle root, genesis hash, pszTimestamp and nTime, add those to the code and compile.

But when I launch the windows-qt i get an Assertion failed ! error.
Expression: block.hashMerkleRoot == uint256("0xb8a521c89f62af3b80565dec94e5a08eafe4e15b372550f77409832a20cf4398")

Please someone help me out. What am i doing wrong ? Why is it not accepting my merkle root?


Title: Re: forking a coin : how to merkle root
Post by: rnicoll on September 15, 2015, 02:57:39 PM
I'm trying to fork a X13 coin I like but i'm missing something important.

I've made all the code changes I want, then I use GenesisH0 to get merkle root, genesis hash, pszTimestamp and nTime, add those to the code and compile.

But when I launch the windows-qt i get an Assertion failed ! error.
Expression: block.hashMerkleRoot == uint256("0xb8a521c89f62af3b80565dec94e5a08eafe4e15b372550f77409832a20cf4398")

Please someone help me out. What am i doing wrong ? Why is it not accepting my merkle root?

One thought is to check whether the transaction and merkle hashes are calculated using SHA256 (as Scrypt coins do, because it's a lot cheaper than using Scrypt) or X13. I think X11 coins often use X11 for identity hashes as well as PoW, might be the same for X13.


Title: Re: forking a coin : how to merkle root
Post by: Quantum_Mechanics on September 15, 2015, 06:26:58 PM
I'm trying to fork a X13 coin I like but i'm missing something important.

I've made all the code changes I want, then I use GenesisH0 to get merkle root, genesis hash, pszTimestamp and nTime, add those to the code and compile.

But when I launch the windows-qt i get an Assertion failed ! error.
Expression: block.hashMerkleRoot == uint256("0xb8a521c89f62af3b80565dec94e5a08eafe4e15b372550f77409832a20cf4398")

Please someone help me out. What am i doing wrong ? Why is it not accepting my merkle root?

I made a post some times ago that might help you: https://bitcointalk.org/index.php?topic=871564.msg9642571#msg9642571


Title: Re: forking a coin : how to merkle root
Post by: iwantodev on September 22, 2015, 12:18:25 AM
Thanks for the information guys.
I followed your guide Quantum_Mechanics and it helped alot. I finally was able to succefully clone a X11 coin yet I had to remove some code to get the qt to launch.

I changed the merkle root, genesis block, time and nNonce. Compiled, but was still getting an assertion error.

assertion failed: block.checkblock()

Out of desperation I removing this code from main.cpp
Code:
assert(block.CheckBlock());

Now the qt is running ok but i'm wondering if the part of code I removed will cause some kind of problem.

Can someone tell me what this code is for ? What does it do ?
Code:
assert(block.CheckBlock());

Thanks


Title: Re: forking a coin : how to merkle root
Post by: achow101 on September 22, 2015, 01:18:25 AM
Thanks for the information guys.
I followed your guide Quantum_Mechanics and it helped alot. I finally was able to succefully clone a X11 coin yet I had to remove some code to get the qt to launch.

I changed the merkle root, genesis block, time and nNonce. Compiled, but was still getting an assertion error.

assertion failed: block.checkblock()

Out of desperation I removing this code from main.cpp
Code:
assert(block.CheckBlock());

Now the qt is running ok but i'm wondering if the part of code I removed will cause some kind of problem.

Can someone tell me what this code is for ? What does it do ?
Code:
assert(block.CheckBlock());

Thanks
That is a check to make sure that the blocks are good and valid. Normally, if checkblock fails, then this line will cause the program to shutdown and warn the user that something has gone wrong. You have basically removed a security and safety feature.


Title: Re: forking a coin : how to merkle root
Post by: iwantodev on September 22, 2015, 01:23:01 AM
Oh shoot! I can't do that.


Title: Re: forking a coin : how to merkle root
Post by: iwantodev on September 22, 2015, 01:48:06 AM
This is the error I see when looking into debug.log

Code:
ERROR: CTransaction::CheckTransaction() : coinbase script size is invalid
ERROR: CheckBlock() : CheckTransaction failed

What? But I want the script size to be valid!


Title: Re: forking a coin : how to merkle root
Post by: Quantum_Mechanics on September 23, 2015, 08:15:57 PM
Maybe you should start again without removing any part of the code.
Which coin are you cloning ?

Found the guide I used when I started in crypto:
https://bitcointalk.org/index.php?topic=217636.0
It's for scrypt coin but cloning is similar though, maybe it can help


Title: Re: forking a coin : how to merkle root
Post by: YarkoL on September 25, 2015, 07:21:00 AM
This is the error I see when looking into debug.log

Code:
ERROR: CTransaction::CheckTransaction() : coinbase script size is invalid
ERROR: CheckBlock() : CheckTransaction failed

What? But I want the script size to be valid!

Can you post the actual genesis block here (from gettransaction)?

The error implies that there is something wrong with the length of the signature. Either it does not
exist, or it is too long. The latter might be the case if your choice of the human-readable timestamp
string is something huge