Skip to content

Canonical Hash Trie

Felföldi Zsolt edited this page Oct 16, 2017 · 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 every 32768 blocks, CHT[i] containing data for blocks 0..i * 32768-1. If a client knows the root hash of CHT[i] and wants to fetch header number N (where N < i * 32768), it can obtain the header and the corresponding Merkle proof of the CHT with a GetHelperTrieProofs 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 current version of the light client there is a hardcoded [chtNumber, chtRoot] pair associated with the genesis block hash of both the mainnet and the testnet. For later versions a trustless validation algorithm is planned.

Clone this wiki locally