You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.7 KiB

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