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.

50 lines
2.4 KiB

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