Go-ethereum: How to calculate trusted checkpoint for a network

Created on 31 May 2019  路  4Comments  路  Source: ethereum/go-ethereum

I found that in the ethereum config, there're some trusted checkpoint for light client and peer validation.

It's very helpful if we have a detail document guide to calculate it then community can know how to calculate the trusted checkpoint for their private network. Thank you so much!

I mean how to calculate those below item for a chain

        SectionIndex: 216,
        SectionHead:  common.HexToHash("0xae3e551c8d60d06fd411a8e6008e90625d3bb0cbbf664b65d5ed90b318553541"),
        CHTRoot:      common.HexToHash("0xeea7d2ab3545a37deecc66fc43c9556ae337c3ea1c6893e401428207bdb8e434"),
        BloomRoot:    common.HexToHash("0xb0d4176d160d67b99a9f963281e52bce0583a566b74b4497fe3ed24ae04004ff"),

Most helpful comment

Btw If you want to deploy the checkpoint oracle for your own private network, you can use tool checkpoint-admin https://github.com/ethereum/go-ethereum/tree/master/cmd/checkpoint-admin.

Step:

  • Deploy a checkpoint oracle via checkpoint-admin
  • Add the oracle information(e.g. address, signers, threshold) to config file
  • Use checkpoint-admin to sign and publish some latest checkpoint

All 4 comments

@rjl493456442 @zsfelfoldi I know how to setup SectionIndex and SectionHead. Do you have any document guide to calculate CHTRoot and BloomRoot? Thank you!

You don't need to calculate the trusted checkpoint by yourself. You can retrieve them from a full node(as well as a synced light client).

Steps

  • Setup a full node with les server enabled(e.g. --lightserv 100)
  • Retrieve checkpoint from console
    geth attach <path-to-ipc>
    admin.nodeInfo
    You can see cht like
    cht: { bloomRoot: "0xc1ac19553473ebb07325b5092a09277d62e9ffe159166a1c6fbec614c4dfd885", chtRoot: "0xce7235999aa8d73c4493b8f397474dafc627652a790dec60c4a968e2dfa5d7be", sectionHead: "0xd0c206e064c8efea930d97e56786af95354ea481b35294a20e5a340937e4c2c9", sectionIndex: 26 },

Or you can retrieve checkpoint from RPC

  • Setup a full node with les server enabled(e.g. --lightserv 100) and les RPC exposed (--rpcapi "eth,les")
  • Send RPC call
    curl -X POST -H "Content-Type: application/json" localhost:8545 --data '{"jsonrpc":"2.0","method":"les_latestCheckpoint","params":[],"id":1}'
    curl -X POST -H "Content-Type: application/json" localhost:8545 --data '{"jsonrpc":"2.0","method":"les_getCheckpoint","params":[26],"id":1}'

Btw If you want to deploy the checkpoint oracle for your own private network, you can use tool checkpoint-admin https://github.com/ethereum/go-ethereum/tree/master/cmd/checkpoint-admin.

Step:

  • Deploy a checkpoint oracle via checkpoint-admin
  • Add the oracle information(e.g. address, signers, threshold) to config file
  • Use checkpoint-admin to sign and publish some latest checkpoint

@rjl493456442 magnificent! appreciate it! 馃檱

Was this page helpful?
0 / 5 - 0 ratings