Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Resetting chainparams.cpp and create a new unique genesis block

Discussion in 'Development Tech Discussion' started by BigBrother, Dec 28, 2017.

  1. BigBrother

    BigBrother New Member

    Joined:
    Dec 28, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. Milan

    Milan New Member

    Joined:
    Dec 29, 2017
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    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.
     
    • Informative Informative x 1
  3. jack catesby

    jack catesby New Member

    Joined:
    Jan 5, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    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?
     
    • Like Like x 1
  4. Milan

    Milan New Member

    Joined:
    Dec 29, 2017
    Messages:
    5
    Likes Received:
    2
    Trophy Points:
    3
    • Like Like x 2
  5. Walteeer

    Walteeer New Member

    Joined:
    Feb 6, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  6. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    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
     
    #6 charlierocket, Feb 7, 2018
    Last edited: Feb 7, 2018
  7. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    i guess this is from the time Satoshi created first genesis block
     
  8. BigBrother

    BigBrother New Member

    Joined:
    Dec 28, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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..
     
  9. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    no, you need to mine with the wallet to keep orig tx. got it working without masternodes, what part of the code you mentioning?
     
  10. BigBrother

    BigBrother New Member

    Joined:
    Dec 28, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Its not mining with the wallet.
     
  11. jack catesby

    jack catesby New Member

    Joined:
    Jan 5, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    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?
     
    • Like Like x 1
  12. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    @Milan guide with genesish0 is outdated
     
  13. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    @jack catesby yes, you need to allow solo mining. network can be started with mn confirmations on 15
     
  14. jack catesby

    jack catesby New Member

    Joined:
    Jan 5, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    How do you allow solo mining? is it by toggling:

    fMiningRequiresPeers = true/false; ??
     
  15. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    @jack catesby yes
    don't forget to check two other networks, if you booting test and reg
     
  16. jack catesby

    jack catesby New Member

    Joined:
    Jan 5, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    what did you put in your .conf files for the server and other machines?
     
  17. charlierocket

    charlierocket New Member

    Joined:
    Feb 7, 2018
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  18. Matthew Chin

    Matthew Chin New Member

    Joined:
    Mar 7, 2018
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  19. Matthew Chin

    Matthew Chin New Member

    Joined:
    Mar 7, 2018
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  20. DevFlames

    DevFlames New Member

    Joined:
    Apr 10, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    this dependencies gives error
    sudo pip install scrypt construct==2.5.2
     
  21. jack catesby

    jack catesby New Member

    Joined:
    Jan 5, 2018
    Messages:
    13
    Likes Received:
    2
    Trophy Points:
    3
    ??
     
  22. Mike_Crypto

    Mike_Crypto New Member

    Joined:
    Jun 4, 2018
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello.. i have a college project for cloning dash based crypto and i want to know how can i proceed? I cloned the mn code and not sure how to compile?
     
  23. thephez

    thephez Member
    Dash Core Team

    Joined:
    Jan 23, 2016
    Messages:
    99
    Likes Received:
    42
    Trophy Points:
    68
    There are instructions in the `doc/` folder. Linux for instance - build-unix.md.
     
  24. Mike_Crypto

    Mike_Crypto New Member

    Joined:
    Jun 4, 2018
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    How can open the wallet ? I need to build the wallet for windows as well.. also publish this to git and public
     
  25. Mike_Crypto

    Mike_Crypto New Member

    Joined:
    Jun 4, 2018
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Also i am stuck in generating genesis block and merkle hash. Anyone can help me pls?
     
  26. OneCrypto

    OneCrypto New Member

    Joined:
    Jul 10, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have the same problem. Does anyone know how to solve it?
     
  27. bandaabandaa

    bandaabandaa New Member

    Joined:
    Apr 29, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    #27 bandaabandaa, Apr 29, 2019
    Last edited: Apr 29, 2019

Share This Page