Skip to content

Canonical Hash Trie

Felföldi Zsolt edited this page Jul 9, 2016 · 5 revisions

Canonical Hash Trie (CHT) structures are used by the Light Ethereum Subprotocol (LES) for quick initial syncing and secure on-demand retrieval of canonical hash mappings, block headers and total difficulty (TD) values. A CHT is a trie that contains blockNumber -> [blockHash, TD] mappings where keys are binary big endian encoded 64 bit integers and values are RLP-encoded [hash, number] pairs. CHTs are generated by LES servers for each 4096 blocks, CHT[i] containing blocks 0..i4096-1. If a client knows the root hash of CHT[i] and wants to fetch header number N (where N < i4096), it can obtain the header and the corresponding Merkle proof of the CHT with a GetHeaderProofs request.

CHTs are only generated after 2048 confirmations, making it sure that they will not be changed by a chain reorg.

Obtaining CHT root hashes

In the test version of the light client there is a hardcoded [chtNumber, chtRoot] pair associated for the genesis block hash of both the mainnet and the testnet.

Clone this wiki locally