• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Resetting chainparams.cpp and create a new unique genesis block

BigBrother

New member
Hello

I am currently studying computer science at university.

I have chosen a project relating to cryptocurrency for my University dissertation project and to accomplish my goal, I have been trying to make a clean clone of DASH to use for project.

I am stumbling when it comes to resetting / creating a new unique genesis block and resetting the other variables within the chainparams.cpp

Is there anyone that may be able to help? I have searched the internet and am unable to find anything that is up to date.

Any assistance would be greatly appreciated.
 
I'm also learning coursera's Cryptocurrency Technologies course and started to use Dash as more advance technology(compare to bitcoin).

You need to change the PORT and change the genesis block which you can use lhartikk/GenesisH0 from github (couldn't put the full link because of spam protection)

I learned from @codablock that in develop branch of dash you can run Dash on devnet mode which runs Dash with new genesis block in your dev.

I guess it's better if you start from that.
 
Hi. Did you manage to reset the chainparams ?

i have a question.

inside chainparams.cpp at the very top, there is a function.

static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
CMutableTransaction txNew;
txNew.nVersion = 1;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = genesisReward;
txNew.vout[0].scriptPubKey = genesisOutputScript;
CBlock genesis;
genesis.nTime = nTime;
genesis.nBits = nBits;
genesis.nNonce = nNonce;
genesis.nVersion = nVersion;
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock.SetNull();
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
return genesis;
}

where does the 486604799 value come from?
 
Hi Milan,

what a perfect example - thank you! Nevertheless I have some questions and it would be great if you could help:

Based on your gist:

Line 89 (genesisOutputScript): Where do I get the new hex from ?

Line 123 (CreateGenesisBlock): 1514547457 (is the actual timestamp) but what is 29910985 and where do I get this from ?

Line 127 + 128: It´s the output of GenesisH0, just with 0x at the beginning - correct ?

Line 167: MainNet and TestNet can have the same Genesis Block ?

Line 189: Why does this not fit to MainNet and TestNet ?

How does your GenesisH0 call look like at the end, based on your gist - like this:

python genesis.py -a X11 -z "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins" -t 1514547457 -p "043384710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -n 29910985 -t 1514547457 -v 5000000000

Thank you again for your gist and support !

Walteeer
 
thank you for the script @Milan ! i tried this with my test project and still getting Assertion failed. should the block time be in exact small window?

Code:
consensus.hashGenesisBlock = 4e7032746b22b7fbdb09c320cbdc80bc5d2718c85fad76021f178a8ced490535
genesis.hashMerkleRoot = 987a08c31d7f04f47f1aeccdffc73ca4336e32a6615f619b94cc7109e7c2a7ac
Assertion failed: (consensus.hashGenesisBlock == uint256S("0x000004d869d579dc372b855d3d9c3e68193eb10d427119a9f2d3b4401645c7e4")), function CMainParams, file chainparams.cpp, line 144.
Abort trap: 6
 
Last edited:
Hi. Did you manage to reset the chainparams ?

i have a question.

inside chainparams.cpp at the very top, there is a function.

static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
CMutableTransaction txNew;
txNew.nVersion = 1;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = genesisReward;
txNew.vout[0].scriptPubKey = genesisOutputScript;
CBlock genesis;
genesis.nTime = nTime;
genesis.nBits = nBits;
genesis.nNonce = nNonce;
genesis.nVersion = nVersion;
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock.SetNull();
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
return genesis;
}

where does the 486604799 value come from?

i guess this is from the time Satoshi created first genesis block
 
Geneisish0 doesnt seem to work for this. There is some other code that will do it. Pm me and i will help...

Although once you have successfully created the genesis code for the 3 nets and the core software passes the assertion there is another issue to solve. For me anyway..

The current dash code requires 15 masternodes for confirmations. With no blocks and no coins its not possible to even have 1 masternode.

If the masternode confirmations are set to 0, will it still mine..?

I have my core installed on a vps server and a pc with setgenerate true and no coins are being mined.. it is frustrating..
 
no, you need to mine with the wallet to keep orig tx. got it working without masternodes, what part of the code you mentioning?
 
no, you need to mine with the wallet to keep orig tx. got it working without masternodes, what part of the code you mentioning?

i am referring to :

consensus.nMasternodeMinimumConfirmations = 15;

is it ok to set this to 0 at the beginning of the coin creation? and also

fMiningRequiresPeers = true; can this be set to false after creating the gen block?

will it affect valid signatures in the future if these settings are changed?
 
rpc pair, server=1 and listen=1. you could try to use -connect=192.168.x.x but its tricky, works better with node on vps and two local wallets. just hardcode the vps node
Can i do the wallet sync within two pc only?Currently i fork the dash and create a genesis block. All is working but when syncing header and cannot getblock from peer. Can help me?
 
PC1: Server PC2: Mining
I had tried set the fMiningRequiresPeers = false on PC2 and setgenerate true. It is building block but only within itself. The PC1 cannot sync it and still stopping at connecting to peer. I check the peer info, it shows the IP of PC2 but with random port number. I had check the debug log as well and it stated the PC2 got new block. Anyone can advise me? Rewards will be given if it really works. Please.
 
Back
Top