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.

54 lines
2.4 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. The end-user application here is the Cosmos Voyager, at the bottom left.
  10. Voyager communicates with a REST API exposed by a local Light-Client
  11. Daemon. The Light-Client Daemon is an application specific program that
  12. communicates with Tendermint nodes and verifies Tendermint light-client
  13. proofs through the Tendermint Core RPC. The Tendermint Core process
  14. communicates with a local ABCI application, where the user query or
  15. transaction is actually processed.
  16. The ABCI application must be a deterministic result of the Tendermint
  17. consensus - any external influence on the application state that didn't
  18. come through Tendermint could cause a consensus failure. Thus _nothing_
  19. should communicate with the application except Tendermint via ABCI.
  20. If the application is written in Go, it can be compiled into the
  21. Tendermint binary. Otherwise, it should use a unix socket to communicate
  22. with Tendermint. If it's necessary to use TCP, extra care must be taken
  23. to encrypt and authenticate the connection.
  24. All reads from the app happen through the Tendermint `/abci_query`
  25. endpoint. All writes to the app happen through the Tendermint
  26. `/broadcast_tx_*` endpoints.
  27. The Light-Client Daemon is what provides light clients (end users) with
  28. nearly all the security of a full node. It formats and broadcasts
  29. transactions, and verifies proofs of queries and transaction results.
  30. Note that it need not be a daemon - the Light-Client logic could instead
  31. be implemented in the same process as the end-user application.
  32. Note for those ABCI applications with weaker security requirements, the
  33. functionality of the Light-Client Daemon can be moved into the ABCI
  34. application process itself. That said, exposing the application process
  35. to anything besides Tendermint over ABCI requires extreme caution, as
  36. all transactions, and possibly all queries, should still pass through
  37. Tendermint.
  38. See the following for more extensive documentation:
  39. - [Interchain Standard for the Light-Client REST API](https://github.com/cosmos/cosmos-sdk/pull/1028)
  40. - [Tendermint RPC Docs](https://tendermint.com/rpc/)
  41. - [Tendermint in Production](../tendermint-core/running-in-production.md)
  42. - [ABCI spec](https://github.com/tendermint/spec/tree/95cf253b6df623066ff7cd4074a94e7a3f147c7a/spec/abci)