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

7 years ago
7 years ago
7 years ago
  1. # Application Blockchain Interface (ABCI)
  2. ABCI is the interface between Tendermint (a state-machine replication engine)
  3. and an application (the actual state machine).
  4. The ABCI message types are defined in a [protobuf
  5. file](https://github.com/tendermint/abci/blob/master/types/types.proto).
  6. For full details on the ABCI message types and protocol, see the [ABCI
  7. specificaiton](https://github.com/tendermint/abci/blob/master/specification.rst).
  8. For additional details on server implementation, see the [ABCI
  9. readme](https://github.com/tendermint/abci#implementation).
  10. Here we provide some more details around the use of ABCI by Tendermint and
  11. clarify common "gotchas".
  12. ## Validator Updates
  13. Updates to the Tendermint validator set can be made by returning `Validator`
  14. objects in the `ResponseBeginBlock`:
  15. ```
  16. message Validator {
  17. bytes pub_key = 1;
  18. int64 power = 2;
  19. }
  20. ```
  21. The `pub_key` is the Amino encoded public key for the validator. For details on
  22. Amino encoded public keys, see the [section of the encoding spec](./encoding.md#public-key-cryptography).
  23. For Ed25519 pubkeys, the Amino prefix is always "1624DE6220". For example, the 32-byte Ed25519 pubkey
  24. `76852933A4686A721442E931A8415F62F5F1AEDF4910F1F252FB393F74C40C85` would be
  25. Amino encoded as
  26. `1624DE622076852933A4686A721442E931A8415F62F5F1AEDF4910F1F252FB393F74C40C85`
  27. (Note: in old versions of Tendermint (pre-v0.19.0), the pubkey is just prefixed with a
  28. single type byte, so for ED25519 we'd have `pub_key = 0x1 | pub`)
  29. The `power` is the new voting power for the validator, with the
  30. following rules:
  31. - power must be non-negative
  32. - if power is 0, the validator must already exist, and will be removed from the
  33. validator set
  34. - if power is non-0:
  35. - if the validator does not already exist, it will be added to the validator
  36. set with the given power
  37. - if the validator does already exist, its power will be adjusted to the given power
  38. ## Query
  39. Query is a generic message type with lots of flexibility to enable diverse sets
  40. of queries from applications. Tendermint has no requirements from the Query
  41. message for normal operation - that is, the ABCI app developer need not implement Query functionality if they do not wish too.
  42. That said, Tendermint makes a number of queries to support some optional
  43. features. These are:
  44. ### Peer Filtering
  45. When Tendermint connects to a peer, it sends two queries to the ABCI application
  46. using the following paths, with no additional data:
  47. - `/p2p/filter/addr/<IP:PORT>`, where `<IP:PORT>` denote the IP address and
  48. the port of the connection
  49. - `p2p/filter/pubkey/<ID>`, where `<ID>` is the peer node ID (ie. the
  50. pubkey.Address() for the peer's PubKey)
  51. If either of these queries return a non-zero ABCI code, Tendermint will refuse
  52. to connect to the peer.