Author

Topic: Developers: Can you help me with my altcoin blockchain error? (Read 1021 times)

hero member
Activity: 907
Merit: 1003
Thank you for your help. I tried this.

I think I am not certain what the nonce is here. Is the nonce the "0x" part at the beginning? How do I set the nonce to "0"?

I set the code to boost::assign::map_list_of (  0, uint256("0x")) like you said, recompiled, then ran it. It crashes but it outputs:

"Error: Failed to read block
: Error initializing block database.

Do you want to rebuild the block database now?"

It created the XYZcoin folder in my AppData/Roaming and it had created both a 16kb blk0000.dat file and debug.log file.

From debug.log it looks like the hash is still 81570df7c6cb16af5b46e9889f9d1f50982c6c4b7230a690d3545e6c70a843f7
and the merkle is 242fa5d7cc0bb344d707c4282ed8cbafa049153c1e2052258115e58a1a00dca1

So, I copied those strings and put a "0x" infront of them and put them back into the code. Then recompiled. Is this correct?

I put the hash in two places in main.cpp (line 34 & 2744) and the merkle in one place in main.cpp (line 2804)


Either I am not setting the nonce to zero correctly because I don't fully understand what that means, or I'm putting the wrong hash/merkle in the code, or I'm putting the hash/merkle in the wrong place.

What do you think?
legendary
Activity: 1008
Merit: 1022
static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        (  0, uint256("0x81570df7c6cb16af5b46e9889f9d1f50982c6c4b7230a690d3545e6c70a843f7"))
;

should read
static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        (  0, uint256("0x"))
;

when you compile the genesis block, so should your merkel. Make sure the Nonce is 0.
Then compile and run. Add your genesis block, merkel and nonce then and recompile.

Some coins you need to grab the merkel, recompile and add the nonce and genesis and recompile again.
hero member
Activity: 907
Merit: 1003
Here is exactly where I got my hash and merkle from (in the debug.log file), after running my "bitcoind" file the first time:

hero member
Activity: 907
Merit: 1003
That is correct.  Are you sure you have the right hashes in your code?

No, I am not sure. This is a good point. I wasn't 100% certain if I was taking the right hashes.

I took this to be the hash of the first block: 0x81570df7c6cb16af5b46e9889f9d1f50982c6c4b7230a690d3545e6c70a843f7

and this to my merkle: 0x242fa5d7cc0bb344d707c4282ed8cbafa049153c1e2052258115e58a1a00dca1

Can you tell if that's right or not from my first debug log output? Or how can I be certain I have the right ones?
member
Activity: 84
Merit: 10
Love all coins!
That is correct.  Are you sure you have the right hashes in your code?
hero member
Activity: 907
Merit: 1003
Hm, I just tried that and it compiled but it still gave me the same errors in debug.log and the same command prompt errors of "Failed to read block" and "failed to connect best block"

My debug output log looks like this now:


hero member
Activity: 907
Merit: 1003
Remove the checkpoints, replace the first one with your genesis block.  Did you update your genesis block time, news headline etc. as well before you generated it?
Yes I did update my genesis block time and headline before generating it. So that part should be good.



To do the first thing you said, would my code look like this?

Code:
static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        (  0, uint256("0x81570df7c6cb16af5b46e9889f9d1f50982c6c4b7230a690d3545e6c70a843f7"))
;

(is this correct to put "0" there because it's the first block?)
member
Activity: 84
Merit: 10
Love all coins!
Remove the checkpoints, replace the first one with your genesis block.  Did you update your genesis block time, news headline etc. as well before you generated it?
hero member
Activity: 907
Merit: 1003
Is it the following code, in checkpoints.cpp?
Code:
   static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        (  1500, uint256("0x841a2965955dd288cfa707a755d05a54e45f8bd476835ec9af4402a2b59a2967"))
        (  4032, uint256("0x9ce90e427198fc0ef05e5905ce3503725b80e26afd35a987965fd7e3d9cf0846"))
        (  8064, uint256("0xeb984353fc5190f210651f150c40b8a4bab9eeeff0b729fcb3987da694430d70"))
        ( 16128, uint256("0x602edf1859b7f9a6af809f1d9b0e6cb66fdc1d4d9dcd7a4bec03e12a1ccd153d"))
        ( 23420, uint256("0xd80fdf9ca81afd0bd2b2a90ac3a9fe547da58f2530ec874e978fce0b5101b507"))
        ( 50000, uint256("0x69dc37eb029b68f075a5012dcc0419c127672adb4f3a32882b2b3e71d07a20a6"))
        ( 80000, uint256("0x4fcb7c02f676a300503f49c764a89955a8f920b46a8cbecb4867182ecdb2e90a"))
        (120000, uint256("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131"))
        (161500, uint256("0xdbe89880474f4bb4f75c227c77ba1cdc024991123b28b8418dbbf7798471ff43"))
        (179620, uint256("0x2ad9c65c990ac00426d18e446e0fd7be2ffa69e9a7dcb28358a50b2b78b9f709"))
        (240000, uint256("0x7140d1c4b4c2157ca217ee7636f24c9c73db39c4590c4e6eab2e3ea1555088aa"))
        (383640, uint256("0x2b6809f094a9215bafc65eb3f110a35127a34be94b7d0590a096c3f126c6f364"))
        (409004, uint256("0x487518d663d9f1fa08611d9395ad74d982b667fbdc0e77e9cf39b4f1355908a3"))
        (456000, uint256("0xbf34f71cc6366cd487930d06be22f897e34ca6a40501ac7d401be32456372004"))
        ;

I believe I am supposed to disable checkpoints at the beginning when I am setting this up. I will try that and see if I get anywhere. Other advice/guidance apprecaited!
hero member
Activity: 907
Merit: 1003
On second thought, I think I know what you'r referring to. The checkpoint blocks right? I remember seeing those in the code.

Currently they are left at old litecoin blocks. Could this be causing this error? Obviously those blocks would be non-existant in my own alt coin blockchain so i could see that being a problem.

I don't have any blocks made yet to replace those ones. Can I safely remove all the checkpoints from the code until I have generated them? I didn't know if I should just delete them or what
hero member
Activity: 907
Merit: 1003
You'll have to pardon me I'm extremely new at this. How do I provide you with information on my checkpoints? (if I have any?)
legendary
Activity: 1094
Merit: 1006
Checkpoints?
hero member
Activity: 907
Merit: 1003
I compiled my coin (we'll just call it XYZCoin) and compiling was succesful. I'm using litecoin as the base code.

After compiling and running the "bitcoind" file it creates the genesis block but I can't get the code to accept it despite having added the hash and merkle to my main.cpp.

Can't figure out what I'm not doing or am doing wrong. Here are two screenshots of what i see after compiling and running my .exe:

command prompt result:



"debug.log" file in the "%appdata%\roaming\xyzcoin" folder:


Can anyone help me out? I think the problem has to do with line 28 and 29 of debug.log:

Code:
ERROR: CheckProofOfWork(): has doesn't match nBits
ERROR: CBlock::ReadFromDisk() : errors in block header
Jump to: