An implementation of a trustless NEAR light client (LC) in plonky2(https://github.com/0xPolygonZero/plonky2). Proves the finality of a block based on the existing final block of the previous epoch.
-
Operating Fields: The NEAR zk-light-client operates on several critical fields within the blockchain ecosystem. These fields include the validators, the
next_bp_hash
(next block producers' hash), and the block hash itself. -
Formation of
next_bp_hash
: Thenext_bp_hash
is a crucial component in this process. It is derived from the set of validators responsible for producing the next block. This hash serves as a cryptographic representation of the validators' identity and their role in the upcoming block production. -
Calculation of the block hash: The block hash is then calculated based on the data of the current block. This data includes the
next_bp_hash
. By incorporating thenext_bp_hash
into the block hash calculation, there is a direct cryptographic link between the validators of the next block and the current block's integrity. -
Core Idea: The core idea is to establish a traceable and verifiable chain of custody for block creation. By proving that the
next_bp_hash
(derived from the validators) is a part of the current block's data, which in turn is used to calculate the block's hash, a secure chain is formed. This chain ensures that each block is not only a product of its immediate data but also carries a cryptographic signature of its contextual environment, i.e., the validators for the next block.Therefore, verifying a block's authenticity involves confirming that the set of validators is valid (thus legitimizing thenext_bp_hash
) and ensuring that the block hash is correctly derived from the data, including thisnext_bp_hash
.
defined set of validators ======> defined next_bp_hash ======> defined block hash
-
Block for which the proof is generated
(epoch N)
Example -
Block of the previous epoch
(epoch N-1)
Example -
List of block producers for
epoch N
Example
- Proof of Inclusion for the NEAR Blockchain involves identifying a specific data slot in a smart contract and verifying its contents.
- Upon any data mutation, a Merkle tree is constructed using code from the NEAR core, ensuring the data's integrity.
- This process confirms the accuracy of the data in the slot and checks that the corresponding Merkle root is recorded in the blockchain.
- The result of this verification is typically formatted to display key information like the data's key, value, state root, and associated block hash.
- This ensures the data's validity and its presence in a specific blockchain state.
Tip
Read the example here NEAR_STATE_PROOFS.md
Developed by Zpoken Cryptography Team