Recently, I read
https://bitcointalksearch.org/topic/complete-guide-on-how-to-create-a-new-alt-coin-update-2018-3345808 for forking bitcoin. Then I wanted to change the difficulty(Target Treshold) inorder to mine blocks faster, so I set regtest network difficulty(0x207fffff) to main network(which was 0x1d00ffff) and created my genesis block from scratch. when I run bitcoind command i get this error :
bitcoind
2018-09-28T04:46:14Z Bitcoin Core version v0.17.99.0-bddc7753d-dirty (release build)
2018-09-28T04:46:14Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-09-28T04:46:14Z Assuming ancestors of block 0448936a4bf373c9c203012ce041a8f41d538861676aaeb9ef4a98aa08eb9360 have valid signatures.
2018-09-28T04:46:14Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000100010001
2018-09-28T04:46:14Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2018-09-28T04:46:14Z Using RdRand as an additional entropy source
2018-09-28T04:46:14Z Default data directory /home/myuser/.bitcoin
2018-09-28T04:46:14Z Using data directory /home/myuser/.bitcoin
2018-09-28T04:46:14Z Using config file /home/myuser/.bitcoin/bitcoin.conf
2018-09-28T04:46:14Z Using at most 125 automatic connections (1024 file descriptors available)
2018-09-28T04:46:14Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-09-28T04:46:14Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-09-28T04:46:14Z Using 0 threads for script verification
2018-09-28T04:46:14Z HTTP: creating work queue of depth 16
2018-09-28T04:46:14Z No rpcpassword set - using random cookie authentication.
2018-09-28T04:46:14Z Generated RPC authentication cookie /home/myuser/.bitcoin/.cookie
2018-09-28T04:46:14Z HTTP: starting 4 worker threads
2018-09-28T04:46:14Z Using wallet directory /home/myuser/.bitcoin/wallets
2018-09-28T04:46:14Z init message: Verifying wallet(s)...
2018-09-28T04:46:14Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2018-09-28T04:46:14Z Using wallet wallet.dat
2018-09-28T04:46:14Z BerkeleyEnvironment::Open: LogDir=/home/myuser/.bitcoin/wallets/database ErrorFile=/home/myuser/.bitcoin/wallets/db.log
2018-09-28T04:46:14Z scheduler thread start
2018-09-28T04:46:14Z Cache configuration:
2018-09-28T04:46:14Z * Using 2.0MiB for block index database
2018-09-28T04:46:14Z * Using 8.0MiB for chain state database
2018-09-28T04:46:14Z * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-09-28T04:46:14Z init message: Loading block index...
2018-09-28T04:46:14Z Opening LevelDB in /home/myuser/.bitcoin/blocks/index
2018-09-28T04:46:14Z Opened LevelDB successfully
2018-09-28T04:46:14Z Using obfuscation key for /home/myuser/.bitcoin/blocks/index: 0000000000000000
2018-09-28T04:46:14Z LoadBlockIndexDB: last block file = 0
2018-09-28T04:46:14Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2018-09-28T04:46:14Z Checking all blk files are present...
2018-09-28T04:46:14Z Initializing databases...
2018-09-28T04:46:14Z Pre-allocating up to position 0x1000000 in blk00000.dat
2018-09-28T04:46:14Z Opening LevelDB in /home/myuser/.bitcoin/chainstate
2018-09-28T04:46:14Z Opened LevelDB successfully
2018-09-28T04:46:14Z Wrote new obfuscate key for /home/myuser/.bitcoin/chainstate: 486c004dfb89eb73
2018-09-28T04:46:14Z Using obfuscation key for /home/myuser/.bitcoin/chainstate: 486c004dfb89eb73
2018-09-28T04:46:14Z init message: Rewinding blocks...
2018-09-28T04:46:14Z block index 47ms
2018-09-28T04:46:14Z init message: Loading wallet...
2018-09-28T04:46:14Z [default wallet] nFileVersion = 179900
2018-09-28T04:46:14Z [default wallet] Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total. Unknown wallet records: 0
2018-09-28T04:46:14Z [default wallet] Performing wallet upgrade to 169900
2018-09-28T04:46:18Z [default wallet] keypool added 2000 keys (1000 internal), size=2000 (1000 internal)
2018-09-28T04:46:18Z [default wallet] Wallet completed loading in 3384ms
2018-09-28T04:46:18Z [default wallet] setKeyPool.size() = 2000
2018-09-28T04:46:18Z [default wallet] mapWallet.size() = 0
2018-09-28T04:46:18Z [default wallet] mapAddressBook.size() = 0
2018-09-28T04:46:18Z ERROR: ReadBlockFromDisk: Errors in block header at CDiskBlockPos(nFile=0, nPos=8)
2018-09-28T04:46:18Z *** Failed to read block
2018-09-28T04:46:18Z Error: Error: A fatal internal error occurred, see debug.log for details
Error: Error: A fatal internal error occurred, see debug.log for details
Segmentation fault (core dumped)
There is actually nothing more than what I get in debug.log. I tried to run it with -reindex (though I don't precisely know what reindex does!?) and I get :
bitcoind -reindex
2018-09-28T04:47:06Z Bitcoin Core version v0.17.99.0-bddc7753d-dirty (release build)
2018-09-28T04:47:06Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-09-28T04:47:06Z Assuming ancestors of block 0448936a4bf373c9c203012ce041a8f41d538861676aaeb9ef4a98aa08eb9360 have valid signatures.
2018-09-28T04:47:06Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000100010001
2018-09-28T04:47:06Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2018-09-28T04:47:06Z Using RdRand as an additional entropy source
2018-09-28T04:47:06Z Default data directory /home/myuser/.bitcoin
2018-09-28T04:47:06Z Using data directory /home/myuser/.bitcoin
2018-09-28T04:47:06Z Using config file /home/myuser/.bitcoin/bitcoin.conf
2018-09-28T04:47:06Z Using at most 125 automatic connections (1024 file descriptors available)
2018-09-28T04:47:06Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-09-28T04:47:06Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-09-28T04:47:06Z Using 0 threads for script verification
2018-09-28T04:47:06Z HTTP: creating work queue of depth 16
2018-09-28T04:47:06Z No rpcpassword set - using random cookie authentication.
2018-09-28T04:47:06Z Generated RPC authentication cookie /home/myuser/.bitcoin/.cookie
2018-09-28T04:47:06Z HTTP: starting 4 worker threads
2018-09-28T04:47:06Z Using wallet directory /home/myuser/.bitcoin/wallets
2018-09-28T04:47:06Z init message: Verifying wallet(s)...
2018-09-28T04:47:06Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2018-09-28T04:47:06Z Using wallet wallet.dat
2018-09-28T04:47:06Z BerkeleyEnvironment::Open: LogDir=/home/myuser/.bitcoin/wallets/database ErrorFile=/home/myuser/.bitcoin/wallets/db.log
2018-09-28T04:47:06Z scheduler thread start
2018-09-28T04:47:06Z Cache configuration:
2018-09-28T04:47:06Z * Using 2.0MiB for block index database
2018-09-28T04:47:06Z * Using 8.0MiB for chain state database
2018-09-28T04:47:06Z * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-09-28T04:47:06Z init message: Loading block index...
2018-09-28T04:47:06Z Wiping LevelDB in /home/myuser/.bitcoin/blocks/index
2018-09-28T04:47:06Z Opening LevelDB in /home/myuser/.bitcoin/blocks/index
2018-09-28T04:47:06Z Opened LevelDB successfully
2018-09-28T04:47:06Z Using obfuscation key for /home/myuser/.bitcoin/blocks/index: 0000000000000000
2018-09-28T04:47:06Z Initializing databases...
2018-09-28T04:47:06Z Wiping LevelDB in /home/myuser/.bitcoin/chainstate
2018-09-28T04:47:06Z Opening LevelDB in /home/myuser/.bitcoin/chainstate
2018-09-28T04:47:06Z Opened LevelDB successfully
2018-09-28T04:47:06Z Wrote new obfuscate key for /home/myuser/.bitcoin/chainstate: 329d28cbdd513256
2018-09-28T04:47:06Z Using obfuscation key for /home/myuser/.bitcoin/chainstate: 329d28cbdd513256
2018-09-28T04:47:06Z block index 20ms
2018-09-28T04:47:06Z init message: Loading wallet...
2018-09-28T04:47:06Z [default wallet] nFileVersion = 179900
2018-09-28T04:47:06Z [default wallet] Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total. Unknown wallet records: 0
2018-09-28T04:47:06Z [default wallet] Wallet completed loading in 112ms
2018-09-28T04:47:06Z [default wallet] setKeyPool.size() = 2000
2018-09-28T04:47:06Z [default wallet] mapWallet.size() = 0
2018-09-28T04:47:06Z [default wallet] mapAddressBook.size() = 0
2018-09-28T04:47:06Z Reindexing block file blk00000.dat...
2018-09-28T04:47:06Z ERROR: AcceptBlock: high-hash, proof of work failed (code 16)
2018-09-28T04:47:07Z Reindexing finished
2018-09-28T04:47:07Z Failed to open mempool file from disk. Continuing anyway.
It seems to have problem with PoW. I guessed there is something with this line in "chainparams.cpp":
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
At first I set 486604799 (decimal of bitcoin core's initial difficulty 0x1d00ffff) to the new difficulty 545259519 (decimal of 0x207fffff) but I get core dumped instantly.Maybe this
if (UintToArith256(hash) > bnTarget)
return false;
from pow.cpp always returns false. Anyone has any idea what should I do ? I will be very grateful.