how to update checkpoint block chain of altcoins

Posted By : Chandan Kumar Singh | 19-Nov-2017

In this blog we will update check points for altcoins, I have develped function and will update its check points. Checkpoints prevent various DoS attacks from nodes flooding unusable chains and attacks involving isolating nodes and giving them fake chains, but it is primarily an optimization for the initial blockchain download.

Run daemon process of greenshilling, then run the command getblockhash with block number for which you want to put checkpoint. Here I am doing for block number 500.

./funcoind getblockhash 500
000000000578ade629e30cd8f8444b3edcec8212ad4643731be3527199010b73

this is block hash.

In checkpoint.CPP file

static MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        ( 0, hashGenesisBlockOfficial )
          ( 500, uint256("0x000000000578ade629e30cd8f8444b3edcec8212ad4643731be3527199010b73"))

we have added on 500 number block the hash with generated block hash.

If you have developed altcoin on based on peercoin which is (PoW+PoS) then you need to also update modifierchecksum in kernel.cpp file. Lets get the modifierchecksum of block number 500. We have block hash of block number 500, now run command getblock and get modifierchecksum.

./funcoind getblock 000000000578ade629e30cd8f8444b3edcec8212ad4643731be3527199010b73

its output will be like below.

{
    "hash" : "c9a7ae625d9b837fb7594241d0e6d800ff3e42b44f1ea8d08b2c3fdcfdcd8023",
    "size" : 456,
    "height" : 500,
    "version" : 1,
    "merkleroot" : "6bd8085d22b1840b085d7b969e4aacc1b2ae5f7f3e6438a249d66deace37112b",
    "time" : "2017-11-19 09:54:37 UTC",
    "nonce" : 0,
    "bits" : "1c048f19",
    "difficulty" : 56.15211345,
    "mint" : 3.84000000,
    "previousblockhash" : "d68bf7e8051c9fb5b9737a4b015a613537e18a76a543f7231a1ebb3c6d6c04c5",
    "nextblockhash" : "6c7df2fc020f56be8fc52634f70a90544da66bdc3543076c29286cabd955b9f3",
    "flags" : "proof-of-stake",
    "proofhash" : "0000029e298dc892b8d7c8476b672788ecc7b16c06ff64c431c14577acec780f",
    "entropybit" : 0,
    "modifier" : "ac2a930a06eaf013",
    "modifierchecksum" : "64365c5e",
    "tx" : [
        "4367af8c9fb557a1350cf7358a1d8fd82b31b13fbf1fec8477ccd1d73f7b6452",
        "555c3955a9dcad14c492f7938a119d6123fac6ff4b2aa90fc085dee23bfede7d"
    ]
}

we have modifierchecksum 

"modifierchecksum" : "64365c5e"

in kernel.cpp file

static std::map<int, unsigned int> mapStakeModifierCheckpoints =
    boost::assign::map_list_of
    ( 0, 0x0e00670bu )
    ( 500, 0x64365c5eu);

Thanks.

About Author

Author Image
Chandan Kumar Singh

Chandan is a bright Web Developer with expertise in Java and Spring framework and ORM tools Hibernate. He loves technologies like Blockchain and IoT.

Request for Proposal

Name is required

Comment is required

Sending message..