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.

237 lines
7.4 KiB

  1. Specification
  2. =============
  3. Message Types
  4. ~~~~~~~~~~~~~
  5. ABCI requests/responses are defined as simple Protobuf messages in `this
  6. schema
  7. file <https://github.com/tendermint/abci/blob/master/types/types.proto>`__.
  8. TendermintCore sends the requests, and the ABCI application sends the
  9. responses. Here, we describe the requests and responses as function
  10. arguments and return values, and make some notes about usage:
  11. Echo
  12. ^^^^
  13. - **Arguments**:
  14. - ``Message (string)``: A string to echo back
  15. - **Returns**:
  16. - ``Message (string)``: The input string
  17. - **Usage**:
  18. - Echo a string to test an abci client/server implementation
  19. Flush
  20. ^^^^^
  21. - **Usage**:
  22. - Signals that messages queued on the client should be flushed to
  23. the server. It is called periodically by the client implementation
  24. to ensure asynchronous requests are actually sent, and is called
  25. immediately to make a synchronous request, which returns when the
  26. Flush response comes back.
  27. Info
  28. ^^^^
  29. - **Arguments**:
  30. - ``Version (string)``: The Tendermint version
  31. - **Returns**:
  32. - ``Data (string)``: Some arbitrary information
  33. - ``Version (Version)``: Version information
  34. - ``LastBlockHeight (int64)``: Latest block for which the app has
  35. called Commit
  36. - ``LastBlockAppHash ([]byte)``: Latest result of Commit
  37. - **Usage**:
  38. - Return information about the application state.
  39. - Used to sync the app with Tendermint on crash/restart.
  40. SetOption
  41. ^^^^^^^^^
  42. - **Arguments**:
  43. - ``Key (string)``: Key to set
  44. - ``Value (string)``: Value to set for key
  45. - **Returns**:
  46. - ``Code (uint32)``: Response code
  47. - ``Log (string)``: The output of the application's logger. May be non-deterministic.
  48. - ``Info (string)``: Additional information. May be non-deterministic.
  49. - **Usage**:
  50. - Set non-consensus critical application specific options.
  51. - e.g. Key="min-fee", Value="100fermion" could set the minimum fee required for CheckTx
  52. (but not DeliverTx - that would be consensus critical).
  53. InitChain
  54. ^^^^^^^^^
  55. - **Arguments**:
  56. - ``Validators ([]Validator)``: Initial genesis validators
  57. - ``AppStateBytes ([]byte)``: Serialized initial application state
  58. - **Usage**:
  59. - Called once upon genesis
  60. Query
  61. ^^^^^
  62. - **Arguments**:
  63. - ``Data ([]byte)``: Raw query bytes. Can be used with or in lieu of
  64. Path.
  65. - ``Path (string)``: Path of request, like an HTTP GET path. Can be
  66. used with or in liue of Data.
  67. - Apps MUST interpret '/store' as a query by key on the underlying
  68. store. The key SHOULD be specified in the Data field.
  69. - Apps SHOULD allow queries over specific types like '/accounts/...'
  70. or '/votes/...'
  71. - ``Height (int64)``: The block height for which you want the query
  72. (default=0 returns data for the latest committed block). Note that
  73. this is the height of the block containing the application's
  74. Merkle root hash, which represents the state as it was after
  75. committing the block at Height-1
  76. - ``Prove (bool)``: Return Merkle proof with response if possible
  77. - **Returns**:
  78. - ``Code (uint32)``: Response code.
  79. - ``Log (string)``: The output of the application's logger. May be non-deterministic.
  80. - ``Info (string)``: Additional information. May be non-deterministic.
  81. - ``Index (int64)``: The index of the key in the tree.
  82. - ``Key ([]byte)``: The key of the matching data.
  83. - ``Value ([]byte)``: The value of the matching data.
  84. - ``Proof ([]byte)``: Proof for the data, if requested.
  85. - ``Height (int64)``: The block height from which data was derived.
  86. Note that this is the height of the block containing the
  87. application's Merkle root hash, which represents the state as it
  88. was after committing the block at Height-1
  89. - **Usage**:
  90. - Query for data from the application at current or past height.
  91. - Optionally return Merkle proof.
  92. BeginBlock
  93. ^^^^^^^^^^
  94. - **Arguments**:
  95. - ``Hash ([]byte)``: The block's hash. This can be derived from the
  96. block header.
  97. - ``Header (struct{})``: The block header
  98. - ``AbsentValidators ([]int32)``: List of indices of validators not
  99. included in the LastCommit
  100. - ``ByzantineValidators ([]Evidence)``: List of evidence of
  101. validators that acted maliciously
  102. - **Usage**:
  103. - Signals the beginning of a new block. Called prior to any DeliverTxs.
  104. - The header is expected to at least contain the Height.
  105. - The ``AbsentValidators`` and ``ByzantineValidators`` can be used to
  106. determine rewards and punishments for the validators.
  107. CheckTx
  108. ^^^^^^^
  109. - **Arguments**:
  110. - ``Tx ([]byte)``: The request transaction bytes
  111. - **Returns**:
  112. - ``Code (uint32)``: Response code
  113. - ``Data ([]byte)``: Result bytes, if any.
  114. - ``Log (string)``: The output of the application's logger. May be non-deterministic.
  115. - ``Info (string)``: Additional information. May be non-deterministic.
  116. - ``GasWanted (int64)``: Amount of gas consumed by transaction.
  117. - ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
  118. - ``Fee ([]cmn.KI64Pair)``: Fee paid for the transaction.
  119. - **Usage**: Validate a mempool transaction, prior to broadcasting or
  120. proposing. This message should not mutate the main state, but
  121. application developers may want to keep a separate CheckTx state that
  122. gets reset upon Commit.
  123. CheckTx can happen interspersed with DeliverTx, but they happen on
  124. different ABCI connections - CheckTx from the mempool connection, and
  125. DeliverTx from the consensus connection. During Commit, the mempool
  126. is locked, so you can reset the mempool state to the latest state
  127. after running all those DeliverTxs, and then the mempool will re-run
  128. whatever txs it has against that latest mempool state.
  129. Transactions are first run through CheckTx before broadcast to peers
  130. in the mempool layer. You can make CheckTx semi-stateful and clear
  131. the state upon ``Commit``, to allow for dependent sequences of transactions
  132. in the same block.
  133. DeliverTx
  134. ^^^^^^^^^
  135. - **Arguments**:
  136. - ``Tx ([]byte)``: The request transaction bytes.
  137. - **Returns**:
  138. - ``Code (uint32)``: Response code.
  139. - ``Data ([]byte)``: Result bytes, if any.
  140. - ``Log (string)``: The output of the application's logger. May be non-deterministic.
  141. - ``Info (string)``: Additional information. May be non-deterministic.
  142. - ``GasWanted (int64)``: Amount of gas predicted to be consumed by transaction.
  143. - ``GasUsed (int64)``: Amount of gas consumed by transaction.
  144. - ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
  145. - **Usage**:
  146. - Deliver a transaction to be executed in full by the application. If the transaction is valid,
  147. returns CodeType.OK.
  148. EndBlock
  149. ^^^^^^^^
  150. - **Arguments**:
  151. - ``Height (int64)``: Height of the block just executed.
  152. - **Returns**:
  153. - ``ValidatorUpdates ([]Validator)``: Changes to validator set (set
  154. voting power to 0 to remove).
  155. - ``ConsensusParamUpdates (ConsensusParams)``: Changes to
  156. consensus-critical time, size, and other parameters.
  157. - **Usage**:
  158. - Signals the end of a block.
  159. - Called prior to each Commit, after all transactions.
  160. - Validator set and consensus params are updated with the result.
  161. Commit
  162. ^^^^^^
  163. - **Returns**:
  164. - ``Data ([]byte)``: The Merkle root hash
  165. - **Usage**:
  166. - Persist the application state.
  167. - Return a Merkle root hash of the application state.