Conflux

How it works

ConfluxLightClient is a light client smart contract implemented in solidity on Mapo Relaychain

In the Hydra hard fork (v2.0) of Conflux, the introduction of CIP-43 has incorporated a POS (Proof of Stake) system to enhance the overall network's finality, resulting in Conflux network now operating on a hybrid consensus of POW (Proof of Work) and POS.

The light client will determine the storage of the final block header number and hash value after verifying the committee's voting weight and passing the aggregation BLS signatures. Subsequently, it will update the ledger data, structured as follows:

    struct LedgerInfoWithSignatures {
        uint64 epoch;
        uint64 round;
        bytes32 id;                 // block hash
        bytes32 executedStateId;
        uint64 version;
        uint64 timestampUsecs;
        EpochState nextEpochState;  // only available for the last block of epoch
        Decision pivot;             // may be empty for epoch genesis block
        bytes32 consensusDataHash;
        bytes32[] accounts;
        bytes aggregatedSignature;
    }

How to verify

updateBlockHeader

After storing the final block header number and hash value, we can easily verify the validity of previous block header numbers and hash values. To comprehensively consider proof verification, we can conveniently submit a series of block headers and hash values at intervals to facilitate swift verification.

verify receipt

The light client follows these steps to verify the proof data:

  1. Check that the <block number, block hash> pair of the block header in the proof data is recorded in the light client. If not, and error is returned.

  2. Compute the hash of the block header in the proof data, and verify that it equals to the hash stored. This proves the validity of the block header.If not, an error is returned.

  3. In Conflux, all receipt hash values form a Merkle Patricia Tree, and the root of this tree is recorded in the block header. The light client retrieves tree leaves from the block header, key index, and proof data through the root using the proof. It then verifies whether the tree leaves match the hash values of the receipts included in the proof data. If they do not match, an error is returned.

If all above verifications pass, the proof data is proved to be valid.

Proof

Last updated