github.com/KYVENetwork/cometbft/v38@v38.0.3/docs/core/light-client.md (about)

     1  ---
     2  order: 13
     3  ---
     4  
     5  # Light Client
     6  
     7  Light clients are an important part of the complete blockchain system for most
     8  applications. CometBFT provides unique speed and security properties for
     9  light client applications.
    10  
    11  See our [light
    12  package](https://pkg.go.dev/github.com/KYVENetwork/cometbft/v38/light?tab=doc).
    13  
    14  ## Overview
    15  
    16  The objective of the light client protocol is to get a commit for a recent
    17  block hash where the commit includes a majority of signatures from the last
    18  known validator set. From there, all the application state is verifiable with
    19  [merkle proofs](https://github.com/KYVENetwork/cometbft/v38/blob/v0.38.x/spec/core/encoding.md#iavl-tree).
    20  
    21  ## Properties
    22  
    23  - You get the full collateralized security benefits of CometBFT; no
    24    need to wait for confirmations.
    25  - You get the full speed benefits of CometBFT; transactions
    26    commit instantly.
    27  - You can get the most recent version of the application state
    28    non-interactively (without committing anything to the blockchain). For
    29    example, this means that you can get the most recent value of a name from the
    30    name-registry without worrying about fork censorship attacks, without posting
    31    a commit and waiting for confirmations. It's fast, secure, and free!
    32  
    33  ## Where to obtain trusted height & hash
    34  
    35  [Trust Options](https://pkg.go.dev/github.com/KYVENetwork/cometbft/v38/light?tab=doc#TrustOptions)
    36  
    37  One way to obtain semi-trusted hash & height is to query multiple full nodes
    38  and compare their hashes:
    39  
    40  ```bash
    41  $ curl -s https://233.123.0.140:26657:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
    42  {
    43    "height": "273",
    44    "hash": "188F4F36CBCD2C91B57509BBF231C777E79B52EE3E0D90D06B1A25EB16E6E23D"
    45  }
    46  ```
    47  
    48  ## Running a light client as an HTTP proxy server
    49  
    50  CometBFT comes with a built-in `cometbft light` command, which can be used
    51  to run a light client proxy server, verifying CometBFT RPC. All calls that
    52  can be tracked back to a block header by a proof will be verified before
    53  passing them back to the caller. Other than that, it will present the same
    54  interface as a full CometBFT node.
    55  
    56  You can start the light client proxy server by running `cometbft light <chainID>`,
    57  with a variety of flags to specify the primary node,  the witness nodes (which cross-check
    58  the information provided by the primary), the hash and height of the trusted header,
    59  and more.
    60  
    61  For example:
    62  
    63  ```bash
    64  $ cometbft light supernova -p tcp://233.123.0.140:26657 \
    65    -w tcp://179.63.29.15:26657,tcp://144.165.223.135:26657 \
    66    --height=10 --hash=37E9A6DD3FA25E83B22C18835401E8E56088D0D7ABC6FD99FCDC920DD76C1C57
    67  ```
    68  
    69  For additional options, run `cometbft light --help`.