The problem is halfway solved. I should've changed powLimit field of consensus too. In chainparams.cpp in mainnet consensus.powLimit is set to :
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
by changing it to
consensus.powLimit = uint256S("00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
I could startup the server successfully. For genesis block i found out that GenesisH0 for sure didn't work properly and I changed
https://github.com/JonPullinger/Genesis-Block-Generator-Crypto-Bitcoin.git manually. Just by changing line 312
unsigned int check = *((uint32_t *)(block_hash2 + 28)); // The hash is in little-endian, so we check the last 4 bytes.
if(check == 0) // \x00\x00\x00\x00
{....
to
if(check <=1048575) // \x00\x0f\xff\xff (for example)
generated genesis block quickly. All similar C codes on github will run the same.
My problem is I can't add one node to the other. I ran the first node like :
bitcoind -dns=0 -dnsseed=0 -port=15333 -rpcport=15332 -datadir=/home/user/.bitcoin2 -maxtipage=$((24*60*60*5000))
and it seemed to work fine. Then the second node :
bitcoind -dns=0 -dnsseed=0 -port=6333 -rpcport=6332 -addnode=127.0.0.1:15332 -debug=rpc -maxtipage=$((24*60*60*50000))
The server will start up but when I type
bitcoin-cli getblocktemplate
in another terminal,I get :
error code: -10
error message:
Bitcoin is downloading blocks...
When I add port instead of rpcport:
bitcoind -dns=0 -dnsseed=0 -port=6333 -rpcport=6332 -addnode=127.0.0.1:15333 -debug=rpc -maxtipage=$((24*60*60*500000000))
It shows something
New outbound peer connected: version: 70015, blocks=0, peer=0
but still bitcoin-cli getblocktemplate didn't work
Where does it come from exactly?Why changing difficulty will result in this ?