Assistance on a issue I am having compiling


#1

Hello,
I have been playing around with litecoin I was working on changing the current litecoin build to run a new blockchain
I used the genesis python script to generate a new genesis block and changed the parameters in chainparams.cpp to meet the new generated genesis coin. The coin compiles fine but when i attempt to run litecoind it says

litecoind: chainparams.cpp:129: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S(“000000007fc0b030eca0cefdabceaf4179bd8537a044c07e1951cd9fa1897a43”)’ failed.

Litecoin is amazing and I would love to learn more about it.

Thanks! keep up the good work!


#2

you need to hash random information for the genesis block…
bitcoins genesis block was the title of a times magazine article hashed as the first hash to be solved by a miner…you cant use the original litecoin hash because litecoin is using it and is confirmed daily that that hash belongs to the blockchain Litecoin as a genesis block…just throw some random info together and hash it and then submit as your genesis block hash…

https://en.bitcoin.it/wiki/Genesis_block


#3

Thanks for the reply!, Unfortunately I have already done that and replaced the lines in the chainparams.cpp

Thats when i was getting the assertion error, I noticed that there are multiple lines to put the genesisblock hash which i did replace. Could one of those be an issue?


#4

Yoou probably just have something like syntax…maybe too many characters making the hash too long?..pretty sure the ending hash has to be 128 characters…dont quote me on that though…or the format of the resulting hash maybe could be an issue…?


#5

I still am unable to get this to create the debug file with the new genesis block information, when i try to run it now it says

litecoind
litecoind: chainparams.cpp:123: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S(“0x”)’ failed.
Aborted (core dumped)

the folder for litecoin gets created but nothing is inside of it. Im really stuck on this right now.
Thanks for your help


#6

figured out a way around it here is how i fixed it.

add these 2 lines in chainparams.cpp
printf("%s\n", consensus.hashGenesisBlock.ToString().c_str());
printf("%s\n", genesis.hashMerkleRoot.ToString().c_str());

    genesis = CreateGenesisBlock(1504653953, 0, 0x1d00ffff, 1, 50 * COIN);
    consensus.hashGenesisBlock = genesis.GetHash();
	printf("%s\n", consensus.hashGenesisBlock.ToString().c_str());
	printf("%s\n", genesis.hashMerkleRoot.ToString().c_str());
    assert(consensus.hashGenesisBlock == uint256S("0x"));
    assert(genesis.hashMerkleRoot == uint256S("0x"));

#7

Hmm now I am needed some help on this part, I was reading a guide and they said some script needed to be added but the link doesnt work anymore

2017-09-11 20:12:30 ERROR: CheckProofOfWork() : hash doesn’t match nBits
2017-09-11 20:12:30 ERROR: ReadBlockFromDisk : Errors in block header
2017-09-11 20:12:30 *** Failed to read block
2017-09-11 20:12:30 Error: Failed to read block

Guide says this

Put that to this line:
Quote
https://github.com/litecoin-project/litecoin/blob/master-0.8/src/main.cpp#L2786

After if you get somethink like this:
Quote
CheckProofOfWork() : hash doesn’t match nBits

This genesis block is not good, because doest fit for start difficulty.
need a new one. Put this source code before this line (block.print()):
Quote
https://github.com/litecoin-project/litecoin/blob/master-0.8/src/main.cpp#L2787

run the app, this will “mine” a new genesis block (need lot of time!!) for you.
if it’s founded, modify your source: nNonce, nTime and the new hash (GetHash = XX) for genesis block hash.

What is the code he is talking about that would of been at this link?
https://github.com/litecoin-project/litecoin/blob/master-0.8/src/main.cpp#L2787


#8

those links don’t work but it seems like your difficulty is off as in your block height setting…it would not be very difficult to mine a hash that has only a few characters…pretty sure you need 128 bits (or more) of arbitrary information to mine a genesis block


#9

How do i go about mining it if the litecoind wont run?


#10

Join a pool other than p2pool


#11

I am trying to create a new chain for an experiment not mine or run the original chain…


#12

Oh yea…i forgot…litecoind and deamon doesn’t work anymore…start litecoin-qt from command prompt with -disablewallet and -server flags and I should work


#13

Also just start litecoin-qt from command prompt with --help flag and you’ll see the generate option…youll need to set this to generate blocks by relaying transactions…and your genesis “nblock” is 000001 pretty sure…replace nblock with the block height


#14

I am running it in unbuntu I would love to run it on windows but i cant make the dependencies. Where do i get the block height?


#15

the block height for a genesis block should be 00001 I think but usually in console you’d type getblockheight
you can type help and see the list of options and use the one you think would work best for what your doing…every option has a description of what it does next to it
ok…Ubuntu is not much different…open terminal
./litecoin-qt --help
./litecoin-qt -server -disablewallet
./litecoin-qt -generate 000001 ( address mining to)


#16

Ok this is how far i have gotten and i cannot seem to get past this.

2017-09-14 01:24:18 setKeyPool.size() = 100
2017-09-14 01:24:18 mapWallet.size() = 0
2017-09-14 01:24:18 mapAddressBook.size() = 1
2017-09-14 01:24:18 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2017-09-14 01:24:18 *** Failed to read block
2017-09-14 01:24:18 Error: Error: A fatal internal error occurred, see debug.log for details
2017-09-14 01:24:18 Failed to connect best blockFailed to open mempool file from disk. Continuing anyway.


#17

so check your debug file and at the bottom it will tell you why it couldn’t read the block…might be drive space issue or a memory issue…maybe an indexing issue as well…


#18

Is chainparams.cpp the only file you need to edit to get the new blockchain to work? or is there something else hidden somewhere like checkpoints?

That is the debug file output
ive tired running reindex also here is the entire logfile

2017-09-14 01:24:17 Litecoin version v0.14.99.0-3c0fef0-dirty
2017-09-14 01:24:17 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2017-09-14 01:24:17 Validating signatures for all blocks.
2017-09-14 01:24:17 Default data directory /root/.litecoin
2017-09-14 01:24:17 Using data directory /root/.litecoin
2017-09-14 01:24:17 Using config file /root/.litecoin/litecoin.conf
2017-09-14 01:24:17 Using at most 125 automatic connections (1024 file descriptors available)
2017-09-14 01:24:17 Using 32 MiB out of 32 requested for signature cache, able to store 1048576 elements
2017-09-14 01:24:17 Using 16 threads for script verification
2017-09-14 01:24:17 scheduler thread start
2017-09-14 01:24:17 HTTP: creating work queue of depth 16
2017-09-14 01:24:17 No rpcpassword set - using random cookie authentication
2017-09-14 01:24:17 Generated RPC authentication cookie /root/.litecoin/.cookie
2017-09-14 01:24:17 HTTP: starting 4 worker threads
2017-09-14 01:24:17 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2017-09-14 01:24:17 Using wallet wallet.dat
2017-09-14 01:24:17 init message: Verifying wallet…
2017-09-14 01:24:17 CDBEnv::Open: LogDir=/root/.litecoin/database ErrorFile=/root/.litecoin/db.log
2017-09-14 01:24:18 Bound to [::]:9333
2017-09-14 01:24:18 Bound to 0.0.0.0:9333
2017-09-14 01:24:18 Cache configuration:
2017-09-14 01:24:18 * Using 2.0MiB for block index database
2017-09-14 01:24:18 * Using 8.0MiB for chain state database
2017-09-14 01:24:18 * Using 440.0MiB for in-memory UTXO set (plus up to 4.8MiB of unused mempool space)
2017-09-14 01:24:18 init message: Loading block index…
2017-09-14 01:24:18 Opening LevelDB in /root/.litecoin/blocks/index
2017-09-14 01:24:18 Opened LevelDB successfully
2017-09-14 01:24:18 Using obfuscation key for /root/.litecoin/blocks/index: 0000000000000000
2017-09-14 01:24:18 Opening LevelDB in /root/.litecoin/chainstate
2017-09-14 01:24:18 Opened LevelDB successfully
2017-09-14 01:24:18 Wrote new obfuscate key for /root/.litecoin/chainstate: 02591e337c009309
2017-09-14 01:24:18 Using obfuscation key for /root/.litecoin/chainstate: 02591e337c009309
2017-09-14 01:24:18 LoadBlockIndexDB: last block file = 0
2017-09-14 01:24:18 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0…0, time=1970-01-01…1970-01-01)
2017-09-14 01:24:18 Checking all blk files are present…
2017-09-14 01:24:18 LoadBlockIndexDB: transaction index disabled
2017-09-14 01:24:18 Initializing databases…
2017-09-14 01:24:18 Pre-allocating up to position 0x1000000 in blk00000.dat
2017-09-14 01:24:18 init message: Verifying blocks…
2017-09-14 01:24:18 block index 11ms
2017-09-14 01:24:18 init message: Loading wallet…
2017-09-14 01:24:18 nFileVersion = 149900
2017-09-14 01:24:18 Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total
2017-09-14 01:24:18 Performing wallet upgrade to 60000
2017-09-14 01:24:18 keypool added key 1, size=1
2017-09-14 01:24:18 keypool added key 2, size=2
2017-09-14 01:24:18 keypool added key 3, size=3
2017-09-14 01:24:18 keypool added key 4, size=4
2017-09-14 01:24:18 keypool added key 5, size=5
2017-09-14 01:24:18 keypool added key 6, size=6
2017-09-14 01:24:18 keypool added key 7, size=7
2017-09-14 01:24:18 keypool added key 8, size=8
2017-09-14 01:24:18 keypool added key 9, size=9
2017-09-14 01:24:18 keypool added key 10, size=10
2017-09-14 01:24:18 keypool added key 11, size=11
2017-09-14 01:24:18 keypool added key 12, size=12
2017-09-14 01:24:18 keypool added key 13, size=13
2017-09-14 01:24:18 keypool added key 14, size=14
2017-09-14 01:24:18 keypool added key 15, size=15
2017-09-14 01:24:18 keypool added key 16, size=16
2017-09-14 01:24:18 keypool added key 17, size=17
2017-09-14 01:24:18 keypool added key 18, size=18
2017-09-14 01:24:18 keypool added key 19, size=19
2017-09-14 01:24:18 keypool added key 20, size=20
2017-09-14 01:24:18 keypool added key 21, size=21
2017-09-14 01:24:18 keypool added key 22, size=22
2017-09-14 01:24:18 keypool added key 23, size=23
2017-09-14 01:24:18 keypool added key 24, size=24
2017-09-14 01:24:18 keypool added key 25, size=25
2017-09-14 01:24:18 keypool added key 26, size=26
2017-09-14 01:24:18 keypool added key 27, size=27
2017-09-14 01:24:18 keypool added key 28, size=28
2017-09-14 01:24:18 keypool added key 29, size=29
2017-09-14 01:24:18 keypool added key 30, size=30
2017-09-14 01:24:18 keypool added key 31, size=31
2017-09-14 01:24:18 keypool added key 32, size=32
2017-09-14 01:24:18 keypool added key 33, size=33
2017-09-14 01:24:18 keypool added key 34, size=34
2017-09-14 01:24:18 keypool added key 35, size=35
2017-09-14 01:24:18 keypool added key 36, size=36
2017-09-14 01:24:18 keypool added key 37, size=37
2017-09-14 01:24:18 keypool added key 38, size=38
2017-09-14 01:24:18 keypool added key 39, size=39
2017-09-14 01:24:18 keypool added key 40, size=40
2017-09-14 01:24:18 keypool added key 41, size=41
2017-09-14 01:24:18 keypool added key 42, size=42
2017-09-14 01:24:18 keypool added key 43, size=43
2017-09-14 01:24:18 keypool added key 44, size=44
2017-09-14 01:24:18 keypool added key 45, size=45
2017-09-14 01:24:18 keypool added key 46, size=46
2017-09-14 01:24:18 keypool added key 47, size=47
2017-09-14 01:24:18 keypool added key 48, size=48
2017-09-14 01:24:18 keypool added key 49, size=49
2017-09-14 01:24:18 keypool added key 50, size=50
2017-09-14 01:24:18 keypool added key 51, size=51
2017-09-14 01:24:18 keypool added key 52, size=52
2017-09-14 01:24:18 keypool added key 53, size=53
2017-09-14 01:24:18 keypool added key 54, size=54
2017-09-14 01:24:18 keypool added key 55, size=55
2017-09-14 01:24:18 keypool added key 56, size=56
2017-09-14 01:24:18 keypool added key 57, size=57
2017-09-14 01:24:18 keypool added key 58, size=58
2017-09-14 01:24:18 keypool added key 59, size=59
2017-09-14 01:24:18 keypool added key 60, size=60
2017-09-14 01:24:18 keypool added key 61, size=61
2017-09-14 01:24:18 keypool added key 62, size=62
2017-09-14 01:24:18 keypool added key 63, size=63
2017-09-14 01:24:18 keypool added key 64, size=64
2017-09-14 01:24:18 keypool added key 65, size=65
2017-09-14 01:24:18 keypool added key 66, size=66
2017-09-14 01:24:18 keypool added key 67, size=67
2017-09-14 01:24:18 keypool added key 68, size=68
2017-09-14 01:24:18 keypool added key 69, size=69
2017-09-14 01:24:18 keypool added key 70, size=70
2017-09-14 01:24:18 keypool added key 71, size=71
2017-09-14 01:24:18 keypool added key 72, size=72
2017-09-14 01:24:18 keypool added key 73, size=73
2017-09-14 01:24:18 keypool added key 74, size=74
2017-09-14 01:24:18 keypool added key 75, size=75
2017-09-14 01:24:18 keypool added key 76, size=76
2017-09-14 01:24:18 keypool added key 77, size=77
2017-09-14 01:24:18 keypool added key 78, size=78
2017-09-14 01:24:18 keypool added key 79, size=79
2017-09-14 01:24:18 keypool added key 80, size=80
2017-09-14 01:24:18 keypool added key 81, size=81
2017-09-14 01:24:18 keypool added key 82, size=82
2017-09-14 01:24:18 keypool added key 83, size=83
2017-09-14 01:24:18 keypool added key 84, size=84
2017-09-14 01:24:18 keypool added key 85, size=85
2017-09-14 01:24:18 keypool added key 86, size=86
2017-09-14 01:24:18 keypool added key 87, size=87
2017-09-14 01:24:18 keypool added key 88, size=88
2017-09-14 01:24:18 keypool added key 89, size=89
2017-09-14 01:24:18 keypool added key 90, size=90
2017-09-14 01:24:18 keypool added key 91, size=91
2017-09-14 01:24:18 keypool added key 92, size=92
2017-09-14 01:24:18 keypool added key 93, size=93
2017-09-14 01:24:18 keypool added key 94, size=94
2017-09-14 01:24:18 keypool added key 95, size=95
2017-09-14 01:24:18 keypool added key 96, size=96
2017-09-14 01:24:18 keypool added key 97, size=97
2017-09-14 01:24:18 keypool added key 98, size=98
2017-09-14 01:24:18 keypool added key 99, size=99
2017-09-14 01:24:18 keypool added key 100, size=100
2017-09-14 01:24:18 keypool added key 101, size=101
2017-09-14 01:24:18 keypool reserve 1
2017-09-14 01:24:18 keypool keep 1
2017-09-14 01:24:18 wallet 277ms
2017-09-14 01:24:18 setKeyPool.size() = 100
2017-09-14 01:24:18 mapWallet.size() = 0
2017-09-14 01:24:18 mapAddressBook.size() = 1
2017-09-14 01:24:18 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2017-09-14 01:24:18 *** Failed to read block
2017-09-14 01:24:18 Error: Error: A fatal internal error occurred, see debug.log for details
2017-09-14 01:24:18 Failed to connect best blockFailed to open mempool file from disk. Continuing anyway.


#19

honestly I’m kinda shooting in the dark on this one but there is a command… getbestblockchain you could try…
or getrawmempool
however you have your key pool size set to 100 but you added key 101…try increasing your key pool size or block size might help

may also try the command keypoolrefill (newsize) …try that like this: keypoolrefill 100 or if its is still trying to add key 101 change it to keypoolrefill 150 or 200

I’ll do some searching and see what I can find about this…seems to be mapping fine but id try the keypoolrefill first


#20

Im not sure if that is what is wrong, Im not sure how to calculate the correct pow. I didnt change any of the coin settings from original litecoin. other than the genesis hash,merkle root, checkpoints are set to 0 with the genesis hash

    genesis = CreateGenesisBlock(1505154554, 2084524493, 0x1e0ffff0, 1,p[ 50 * COIN);

That error signals that the proof of work on the loaded block is incorrect.
if (!CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
return error(“ReadBlockFromDisk: Errors in block header at %s”, pos.ToString());