Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: victorkimba17 on May 24, 2018, 05:36:06 AM



Title: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 05:36:06 AM
To start a customised private bitcoin core blockchain, all i need to do is:

1) change the genesis block
2) change the timestamp of genesis block

is there anything else?


Title: Re: start bitcoin core private blockchain
Post by: QRC on May 24, 2018, 05:52:53 AM
To start a customised private bitcoin core blockchain, all i need to do is:

1) change the genesis block
2) change the timestamp of genesis block

is there anything else?

what do you mean by private bitcoin core chain?
1) bitcoin core it's just a client, so use bitcoin blockchain term.
2) do you want to fork bitcoin codebase? In this case you have to change more parameters than genesis block: port number, magic message number ect.
3) But if you just want to run private bitcoin blockchain for your own testing or something similar, you don't have to change anything :) just start daemon with -regtest option.


Title: Re: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 06:07:14 AM
what do you mean by private bitcoin core chain?
1) bitcoin core it's just a client, so use bitcoin blockchain term.
2) do you want to fork bitcoin codebase? In this case you have to change more parameters than genesis block: port number, magic message number ect.
3) But if you just want to run private bitcoin blockchain for your own testing or something similar, you don't have to change anything :) just start daemon with -regtest option.

Thank you. I would like to fork bitcoin code base.

In src/chainparams.cpp
Quote
    const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;

Can i just change the timestamp and genesis output script, to create a customised bitcoin ?


Title: Re: start bitcoin core private blockchain
Post by: QRC on May 24, 2018, 06:34:21 AM
what do you mean by private bitcoin core chain?
1) bitcoin core it's just a client, so use bitcoin blockchain term.
2) do you want to fork bitcoin codebase? In this case you have to change more parameters than genesis block: port number, magic message number ect.
3) But if you just want to run private bitcoin blockchain for your own testing or something similar, you don't have to change anything :) just start daemon with -regtest option.

Thank you. I would like to fork bitcoin code base.

In src/chainparams.cpp
Quote
    const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;

Can i just change the timestamp and genesis output script, to create a customised bitcoin ?
No it's not enough.
Read some guide, for example this one:
Complete Guide on How to Create a New Alt Coin (https://bitcointalk.org/index.php?topic=225690.0)


Title: Re: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 07:28:42 AM
i found a good link
https://bitcoin.stackexchange.com/questions/13122/scriptsig-coinbase-structure-of-the-genesis-block

i tried to print out the value in chainparams.cpp before assert in line 125. But value is printed out as 0x0,  and 0x103?

Quote
fprintf(stdout,"0x%x\n",consensus.hashGenesisBlock);
fprintf(stdout,"0x%x\n",genesis.hashMerkleRoot);

the warning is : format specifies type 'unsigned int' but the argument has type 'uint256'

Update: use this to print uint256. They are string.
Quote
fprintf(stdout,"%s\n", consensus.hashGenesisBlock.ToString().c_str());
fprintf(stdout,"%s\n",genesis.hashMerkleRoot.ToString().c_str());


Title: Re: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 07:40:27 AM

Quote
No it's not enough.
Read some guide, for example this one:
Complete Guide on How to Create a New Alt Coin (https://bitcointalk.org/index.php?topic=225690.0)

I read it.


Title: Re: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 07:53:29 AM
i only changed the timestamp, when starting bitcoind, i got the error in debug.log

2018-05-24 07:50:44 mapAddressBook.size() = 1
2018-05-24 07:50:44 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2018-05-24 07:50:44 *** Failed to read block
2018-05-24 07:50:44 Error: Error: A fatal internal error occurred, see debug.log for details

It is solved by running bitcoind with -reindex


Title: Re: start bitcoin core private blockchain
Post by: victorkimba17 on May 24, 2018, 08:58:46 AM
when i run the bitcoin-cli, i got the error

error code: -28
error message:
Loading wallet...

In the protocol.h, the error meaning is:

RPC_IN_WARMUP                   = -28, //!< Client still warming up