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.

61 lines
2.9 KiB

6 years ago
6 years ago
  1. ---
  2. order: 3
  3. ---
  4. # Application Architecture Guide
  5. Here we provide a brief guide on the recommended architecture of a
  6. Tendermint blockchain application.
  7. The following diagram provides a superb example:
  8. ![](../imgs/cosmos-tendermint-stack-4k.jpg)
  9. We distinguish here between two forms of "application". The first is the
  10. end-user application, like a desktop-based wallet app that a user downloads,
  11. which is where the user actually interacts with the system. The other is the
  12. ABCI application, which is the logic that actually runs on the blockchain.
  13. Transactions sent by an end-user application are ultimately processed by the ABCI
  14. application after being committed by the Tendermint consensus.
  15. The end-user application in this diagram is the Cosmos Voyager, at the bottom
  16. left. Voyager communicates with a REST API exposed by a local Light-Client
  17. Daemon. The Light-Client Daemon is an application specific program that
  18. communicates with Tendermint nodes and verifies Tendermint light-client proofs
  19. through the Tendermint Core RPC. The Tendermint Core process communicates with
  20. a local ABCI application, where the user query or transaction is actually
  21. processed.
  22. The ABCI application must be a deterministic result of the Tendermint
  23. consensus - any external influence on the application state that didn't
  24. come through Tendermint could cause a consensus failure. Thus _nothing_
  25. should communicate with the ABCI application except Tendermint via ABCI.
  26. If the ABCI application is written in Go, it can be compiled into the
  27. Tendermint binary. Otherwise, it should use a unix socket to communicate
  28. with Tendermint. If it's necessary to use TCP, extra care must be taken
  29. to encrypt and authenticate the connection.
  30. All reads from the ABCI application happen through the Tendermint `/abci_query`
  31. endpoint. All writes to the ABCI application happen through the Tendermint
  32. `/broadcast_tx_*` endpoints.
  33. The Light-Client Daemon is what provides light clients (end users) with
  34. nearly all the security of a full node. It formats and broadcasts
  35. transactions, and verifies proofs of queries and transaction results.
  36. Note that it need not be a daemon - the Light-Client logic could instead
  37. be implemented in the same process as the end-user application.
  38. Note for those ABCI applications with weaker security requirements, the
  39. functionality of the Light-Client Daemon can be moved into the ABCI
  40. application process itself. That said, exposing the ABCI application process
  41. to anything besides Tendermint over ABCI requires extreme caution, as
  42. all transactions, and possibly all queries, should still pass through
  43. Tendermint.
  44. See the following for more extensive documentation:
  45. - [Interchain Standard for the Light-Client REST API](https://github.com/cosmos/cosmos-sdk/pull/1028)
  46. - [Tendermint RPC Docs](https://tendermint.com/rpc/)
  47. - [Tendermint in Production](../tendermint-core/running-in-production.md)
  48. - [ABCI spec](https://github.com/tendermint/spec/tree/95cf253b6df623066ff7cd4074a94e7a3f147c7a/spec/abci)