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.

681 lines
30 KiB

  1. # Methods and Types
  2. ## Overview
  3. The ABCI message types are defined in a [protobuf
  4. file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
  5. ABCI methods are split across four separate ABCI _connections_:
  6. - Consensus connection: `InitChain`, `BeginBlock`, `DeliverTx`, `EndBlock`, `Commit`
  7. - Mempool connection: `CheckTx`
  8. - Info connection: `Info`, `Query`
  9. - Snapshot connection: `ListSnapshots`, `LoadSnapshotChunk`, `OfferSnapshot`, `ApplySnapshotChunk`
  10. The consensus connection is driven by a consensus protocol and is responsible
  11. for block execution.
  12. The mempool connection is for validating new transactions, before they're
  13. shared or included in a block.
  14. The info connection is for initialization and for queries from the user.
  15. The snapshot connection is for serving and restoring [state sync snapshots](apps.md#state-sync).
  16. Additionally, there is a `Flush` method that is called on every connection,
  17. and an `Echo` method that is just for debugging.
  18. More details on managing state across connections can be found in the section on
  19. [ABCI Applications](apps.md).
  20. ## Errors
  21. Some methods (`Echo, Info, InitChain, BeginBlock, EndBlock, Commit`),
  22. don't return errors because an error would indicate a critical failure
  23. in the application and there's nothing Tendermint can do. The problem
  24. should be addressed and both Tendermint and the application restarted.
  25. All other methods (`Query, CheckTx, DeliverTx`) return an
  26. application-specific response `Code uint32`, where only `0` is reserved
  27. for `OK`.
  28. Finally, `Query`, `CheckTx`, and `DeliverTx` include a `Codespace string`, whose
  29. intended use is to disambiguate `Code` values returned by different domains of the
  30. application. The `Codespace` is a namespace for the `Code`.
  31. ## Events
  32. Some methods (`CheckTx, BeginBlock, DeliverTx, EndBlock`)
  33. include an `Events` field in their `Response*`. Each event contains a type and a
  34. list of attributes, which are key-value pairs denoting something about what happened
  35. during the method's execution.
  36. Events can be used to index transactions and blocks according to what happened
  37. during their execution. Note that the set of events returned for a block from
  38. `BeginBlock` and `EndBlock` are merged. In case both methods return the same
  39. tag, only the value defined in `EndBlock` is used.
  40. Each event has a `type` which is meant to categorize the event for a particular
  41. `Response*` or tx. A `Response*` or tx may contain multiple events with duplicate
  42. `type` values, where each distinct entry is meant to categorize attributes for a
  43. particular event. Every key and value in an event's attributes must be UTF-8
  44. encoded strings along with the event type itself.
  45. ```protobuf
  46. message Event {
  47. string type = 1;
  48. repeated EventAttribute attributes = 2;
  49. }
  50. ```
  51. The attributes of an `Event` consist of a `key`, `value` and a `index`. The index field notifies the indexer within Tendermint to index the event. This field is non-deterministic and will vary across different nodes in the network.
  52. ```protobuf
  53. message EventAttribute {
  54. bytes key = 1;
  55. bytes value = 2;
  56. bool index = 3; // nondeterministic
  57. }
  58. ```
  59. Example:
  60. ```go
  61. abci.ResponseDeliverTx{
  62. // ...
  63. Events: []abci.Event{
  64. {
  65. Type: "validator.provisions",
  66. Attributes: []abci.EventAttribute{
  67. abci.EventAttribute{Key: []byte("address"), Value: []byte("..."), Index: true},
  68. abci.EventAttribute{Key: []byte("amount"), Value: []byte("..."), Index: true},
  69. abci.EventAttribute{Key: []byte("balance"), Value: []byte("..."), Index: true},
  70. },
  71. },
  72. {
  73. Type: "validator.provisions",
  74. Attributes: []abci.EventAttribute{
  75. abci.EventAttribute{Key: []byte("address"), Value: []byte("..."), Index: true},
  76. abci.EventAttribute{Key: []byte("amount"), Value: []byte("..."), Index: false},
  77. abci.EventAttribute{Key: []byte("balance"), Value: []byte("..."), Index: false},
  78. },
  79. },
  80. {
  81. Type: "validator.slashed",
  82. Attributes: []abci.EventAttribute{
  83. abci.EventAttribute{Key: []byte("address"), Value: []byte("..."), Index: false},
  84. abci.EventAttribute{Key: []byte("amount"), Value: []byte("..."), Index: true},
  85. abci.EventAttribute{Key: []byte("reason"), Value: []byte("..."), Index: true},
  86. },
  87. },
  88. // ...
  89. },
  90. }
  91. ```
  92. ## EvidenceType
  93. A part of Tendermint's security model is the use of evidence which serves as proof of
  94. malicious behaviour by a network participant. It is the responsibility of Tendermint
  95. to detect such malicious behaviour, to gossip this and commit it to the chain and once
  96. verified by all validators to pass it on to the application through the ABCI. It is the
  97. responsibility of the application then to handle the evidence and exercise punishment.
  98. EvidenceType has the following protobuf format:
  99. ```proto
  100. enum EvidenceType {
  101. UNKNOWN = 0;
  102. DUPLICATE_VOTE = 1;
  103. LIGHT_CLIENT_ATTACK = 2;
  104. }
  105. ```
  106. There are two forms of evidence: Duplicate Vote and Light Client Attack. More
  107. information can be found in either [data structures](https://github.com/tendermint/spec/blob/master/spec/core/data_structures.md)
  108. or [accountability](https://github.com/tendermint/spec/blob/master/spec/light-client/accountability.md)
  109. ## Determinism
  110. ABCI applications must implement deterministic finite-state machines to be
  111. securely replicated by the Tendermint consensus. This means block execution
  112. over the Consensus Connection must be strictly deterministic: given the same
  113. ordered set of requests, all nodes will compute identical responses, for all
  114. BeginBlock, DeliverTx, EndBlock, and Commit. This is critical, because the
  115. responses are included in the header of the next block, either via a Merkle root
  116. or directly, so all nodes must agree on exactly what they are.
  117. For this reason, it is recommended that applications not be exposed to any
  118. external user or process except via the ABCI connections to a consensus engine
  119. like Tendermint Core. The application must only change its state based on input
  120. from block execution (BeginBlock, DeliverTx, EndBlock, Commit), and not through
  121. any other kind of request. This is the only way to ensure all nodes see the same
  122. transactions and compute the same results.
  123. If there is some non-determinism in the state machine, consensus will eventually
  124. fail as nodes disagree over the correct values for the block header. The
  125. non-determinism must be fixed and the nodes restarted.
  126. Sources of non-determinism in applications may include:
  127. - Hardware failures
  128. - Cosmic rays, overheating, etc.
  129. - Node-dependent state
  130. - Random numbers
  131. - Time
  132. - Underspecification
  133. - Library version changes
  134. - Race conditions
  135. - Floating point numbers
  136. - JSON serialization
  137. - Iterating through hash-tables/maps/dictionaries
  138. - External Sources
  139. - Filesystem
  140. - Network calls (eg. some external REST API service)
  141. See [#56](https://github.com/tendermint/abci/issues/56) for original discussion.
  142. Note that some methods (`Query, CheckTx, DeliverTx`) return
  143. explicitly non-deterministic data in the form of `Info` and `Log` fields. The `Log` is
  144. intended for the literal output from the application's logger, while the
  145. `Info` is any additional info that should be returned. These are the only fields
  146. that are not included in block header computations, so we don't need agreement
  147. on them. All other fields in the `Response*` must be strictly deterministic.
  148. ## Block Execution
  149. The first time a new blockchain is started, Tendermint calls
  150. `InitChain`. From then on, the following sequence of methods is executed for each
  151. block:
  152. `BeginBlock, [DeliverTx], EndBlock, Commit`
  153. where one `DeliverTx` is called for each transaction in the block.
  154. The result is an updated application state.
  155. Cryptographic commitments to the results of DeliverTx, EndBlock, and
  156. Commit are included in the header of the next block.
  157. ## State Sync
  158. State sync allows new nodes to rapidly bootstrap by discovering, fetching, and applying
  159. state machine snapshots instead of replaying historical blocks. For more details, see the
  160. [state sync section](apps.md#state-sync).
  161. When a new node is discovering snapshots in the P2P network, existing nodes will call
  162. `ListSnapshots` on the application to retrieve any local state snapshots. The new node will
  163. offer these snapshots to its local application via `OfferSnapshot`.
  164. Once the application accepts a snapshot and begins restoring it, Tendermint will fetch snapshot
  165. chunks from existing nodes via `LoadSnapshotChunk` and apply them sequentially to the local
  166. application with `ApplySnapshotChunk`. When all chunks have been applied, the application
  167. `AppHash` is retrieved via an `Info` query and compared to the blockchain's `AppHash` verified
  168. via light client.
  169. ## Messages
  170. ### Echo
  171. - **Request**:
  172. - `Message (string)`: A string to echo back
  173. - **Response**:
  174. - `Message (string)`: The input string
  175. - **Usage**:
  176. - Echo a string to test an abci client/server implementation
  177. ### Flush
  178. - **Usage**:
  179. - Signals that messages queued on the client should be flushed to
  180. the server. It is called periodically by the client
  181. implementation to ensure asynchronous requests are actually
  182. sent, and is called immediately to make a synchronous request,
  183. which returns when the Flush response comes back.
  184. ### Info
  185. - **Request**:
  186. - `Version (string)`: The Tendermint software semantic version
  187. - `BlockVersion (uint64)`: The Tendermint Block Protocol version
  188. - `P2PVersion (uint64)`: The Tendermint P2P Protocol version
  189. - **Response**:
  190. - `Data (string)`: Some arbitrary information
  191. - `Version (string)`: The application software semantic version
  192. - `AppVersion (uint64)`: The application protocol version
  193. - `LastBlockHeight (int64)`: Latest block for which the app has
  194. called Commit
  195. - `LastBlockAppHash ([]byte)`: Latest result of Commit
  196. - **Usage**:
  197. - Return information about the application state.
  198. - Used to sync Tendermint with the application during a handshake
  199. that happens on startup.
  200. - The returned `AppVersion` will be included in the Header of every block.
  201. - Tendermint expects `LastBlockAppHash` and `LastBlockHeight` to
  202. be updated during `Commit`, ensuring that `Commit` is never
  203. called twice for the same block height.
  204. ### InitChain
  205. - **Request**:
  206. - `Time (google.protobuf.Timestamp)`: Genesis time.
  207. - `ChainID (string)`: ID of the blockchain.
  208. - `ConsensusParams (ConsensusParams)`: Initial consensus-critical parameters.
  209. - `Validators ([]ValidatorUpdate)`: Initial genesis validators, sorted by voting power.
  210. - `AppStateBytes ([]byte)`: Serialized initial application state. Amino-encoded JSON bytes.
  211. - `InitialHeight (int64)`: Height of the initial block (typically `1`).
  212. - **Response**:
  213. - `ConsensusParams (ConsensusParams)`: Initial
  214. consensus-critical parameters (optional).
  215. - `Validators ([]ValidatorUpdate)`: Initial validator set (optional).
  216. - `AppHash ([]byte)`: Initial application hash.
  217. - **Usage**:
  218. - Called once upon genesis.
  219. - If ResponseInitChain.Validators is empty, the initial validator set will be the RequestInitChain.Validators
  220. - If ResponseInitChain.Validators is not empty, it will be the initial
  221. validator set (regardless of what is in RequestInitChain.Validators).
  222. - This allows the app to decide if it wants to accept the initial validator
  223. set proposed by tendermint (ie. in the genesis file), or if it wants to use
  224. a different one (perhaps computed based on some application specific
  225. information in the genesis file).
  226. ### Query
  227. - **Request**:
  228. - `Data ([]byte)`: Raw query bytes. Can be used with or in lieu
  229. of Path.
  230. - `Path (string)`: Path of request, like an HTTP GET path. Can be
  231. used with or in liue of Data.
  232. - Apps MUST interpret '/store' as a query by key on the
  233. underlying store. The key SHOULD be specified in the Data field.
  234. - Apps SHOULD allow queries over specific types like
  235. '/accounts/...' or '/votes/...'
  236. - `Height (int64)`: The block height for which you want the query
  237. (default=0 returns data for the latest committed block). Note
  238. that this is the height of the block containing the
  239. application's Merkle root hash, which represents the state as it
  240. was after committing the block at Height-1
  241. - `Prove (bool)`: Return Merkle proof with response if possible
  242. - **Response**:
  243. - `Code (uint32)`: Response code.
  244. - `Log (string)`: The output of the application's logger. May
  245. be non-deterministic.
  246. - `Info (string)`: Additional information. May
  247. be non-deterministic.
  248. - `Index (int64)`: The index of the key in the tree.
  249. - `Key ([]byte)`: The key of the matching data.
  250. - `Value ([]byte)`: The value of the matching data.
  251. - `Proof (Proof)`: Serialized proof for the value data, if requested, to be
  252. verified against the `AppHash` for the given Height.
  253. - `Height (int64)`: The block height from which data was derived.
  254. Note that this is the height of the block containing the
  255. application's Merkle root hash, which represents the state as it
  256. was after committing the block at Height-1
  257. - `Codespace (string)`: Namespace for the `Code`.
  258. - **Usage**:
  259. - Query for data from the application at current or past height.
  260. - Optionally return Merkle proof.
  261. - Merkle proof includes self-describing `type` field to support many types
  262. of Merkle trees and encoding formats.
  263. ### BeginBlock
  264. - **Request**:
  265. - `Hash ([]byte)`: The block's hash. This can be derived from the
  266. block header.
  267. - `Header (struct{})`: The block header.
  268. - `LastCommitInfo (LastCommitInfo)`: Info about the last commit, including the
  269. round, and the list of validators and which ones signed the last block.
  270. - `ByzantineValidators ([]Evidence)`: List of evidence of
  271. validators that acted maliciously.
  272. - **Response**:
  273. - `Events ([]abci.Event)`: Type & Key-Value events for indexing
  274. - **Usage**:
  275. - Signals the beginning of a new block. Called prior to
  276. any DeliverTxs.
  277. - The header contains the height, timestamp, and more - it exactly matches the
  278. Tendermint block header. We may seek to generalize this in the future.
  279. - The `LastCommitInfo` and `ByzantineValidators` can be used to determine
  280. rewards and punishments for the validators. NOTE validators here do not
  281. include pubkeys.
  282. ### CheckTx
  283. - **Request**:
  284. - `Tx ([]byte)`: The request transaction bytes
  285. - `Type (CheckTxType)`: What type of `CheckTx` request is this? At present,
  286. there are two possible values: `CheckTx_New` (the default, which says
  287. that a full check is required), and `CheckTx_Recheck` (when the mempool is
  288. initiating a normal recheck of a transaction).
  289. - **Response**:
  290. - `Code (uint32)`: Response code
  291. - `Data ([]byte)`: Result bytes, if any.
  292. - `Log (string)`: The output of the application's logger. May
  293. be non-deterministic.
  294. - `Info (string)`: Additional information. May
  295. be non-deterministic.
  296. - `GasWanted (int64)`: Amount of gas requested for transaction.
  297. - `GasUsed (int64)`: Amount of gas consumed by transaction.
  298. - `Events ([]abci.Event)`: Type & Key-Value events for indexing
  299. transactions (eg. by account).
  300. - `Codespace (string)`: Namespace for the `Code`.
  301. - **Usage**:
  302. - Technically optional - not involved in processing blocks.
  303. - Guardian of the mempool: every node runs CheckTx before letting a
  304. transaction into its local mempool.
  305. - The transaction may come from an external user or another node
  306. - CheckTx need not execute the transaction in full, but rather a light-weight
  307. yet stateful validation, like checking signatures and account balances, but
  308. not running code in a virtual machine.
  309. - Transactions where `ResponseCheckTx.Code != 0` will be rejected - they will not be broadcast to
  310. other nodes or included in a proposal block.
  311. - Tendermint attributes no other value to the response code
  312. ### DeliverTx
  313. - **Request**:
  314. - `Tx ([]byte)`: The request transaction bytes.
  315. - **Response**:
  316. - `Code (uint32)`: Response code.
  317. - `Data ([]byte)`: Result bytes, if any.
  318. - `Log (string)`: The output of the application's logger. May
  319. be non-deterministic.
  320. - `Info (string)`: Additional information. May
  321. be non-deterministic.
  322. - `GasWanted (int64)`: Amount of gas requested for transaction.
  323. - `GasUsed (int64)`: Amount of gas consumed by transaction.
  324. - `Events ([]abci.Event)`: Type & Key-Value events for indexing
  325. transactions (eg. by account).
  326. - `Codespace (string)`: Namespace for the `Code`.
  327. - **Usage**:
  328. - The workhorse of the application - non-optional.
  329. - Execute the transaction in full.
  330. - `ResponseDeliverTx.Code == 0` only if the transaction is fully valid.
  331. ### EndBlock
  332. - **Request**:
  333. - `Height (int64)`: Height of the block just executed.
  334. - **Response**:
  335. - `ValidatorUpdates ([]ValidatorUpdate)`: Changes to validator set (set
  336. voting power to 0 to remove).
  337. - `ConsensusParamUpdates (ConsensusParams)`: Changes to
  338. consensus-critical time, size, and other parameters.
  339. - `Events ([]abci.Event)`: Type & Key-Value events for indexing
  340. - **Usage**:
  341. - Signals the end of a block.
  342. - Called after all transactions, prior to each Commit.
  343. - Validator updates returned by block `H` impact blocks `H+1`, `H+2`, and
  344. `H+3`, but only effects changes on the validator set of `H+2`:
  345. - `H+1`: NextValidatorsHash
  346. - `H+2`: ValidatorsHash (and thus the validator set)
  347. - `H+3`: LastCommitInfo (ie. the last validator set)
  348. - Consensus params returned for block `H` apply for block `H+1`
  349. ### Commit
  350. - **Response**:
  351. - `Data ([]byte)`: The Merkle root hash of the application state
  352. - `RetainHeight (int64)`: Blocks below this height may be removed. Defaults
  353. to `0` (retain all).
  354. - **Usage**:
  355. - Persist the application state.
  356. - Return an (optional) Merkle root hash of the application state
  357. - `ResponseCommit.Data` is included as the `Header.AppHash` in the next block
  358. - it may be empty
  359. - Later calls to `Query` can return proofs about the application state anchored
  360. in this Merkle root hash
  361. - Note developers can return whatever they want here (could be nothing, or a
  362. constant string, etc.), so long as it is deterministic - it must not be a
  363. function of anything that did not come from the
  364. BeginBlock/DeliverTx/EndBlock methods.
  365. - Use `RetainHeight` with caution! If all nodes in the network remove historical
  366. blocks then this data is permanently lost, and no new nodes will be able to
  367. join the network and bootstrap. Historical blocks may also be required for
  368. other purposes, e.g. auditing, replay of non-persisted heights, light client
  369. verification, and so on.
  370. ### ListSnapshots
  371. - **Response**:
  372. - `Snapshots ([]Snapshot)`: List of local state snapshots.
  373. - **Usage**:
  374. - Used during state sync to discover available snapshots on peers.
  375. - See `Snapshot` data type for details.
  376. ### LoadSnapshotChunk
  377. - **Request**:
  378. - `Height (uint64)`: The height of the snapshot the chunks belongs to.
  379. - `Format (uint32)`: The application-specific format of the snapshot the chunk belongs to.
  380. - `Chunk (uint32)`: The chunk index, starting from `0` for the initial chunk.
  381. - **Response**:
  382. - `Chunk ([]byte)`: The binary chunk contents, in an arbitray format. Chunk messages cannot be
  383. larger than 16 MB _including metadata_, so 10 MB is a good starting point.
  384. - **Usage**:
  385. - Used during state sync to retrieve snapshot chunks from peers.
  386. ### OfferSnapshot
  387. - **Request**:
  388. - `Snapshot (Snapshot)`: The snapshot offered for restoration.
  389. - `AppHash ([]byte)`: The light client-verified app hash for this height, from the blockchain.
  390. - **Response**:
  391. - `Result (Result)`: The result of the snapshot offer.
  392. - `ACCEPT`: Snapshot is accepted, start applying chunks.
  393. - `ABORT`: Abort snapshot restoration, and don't try any other snapshots.
  394. - `REJECT`: Reject this specific snapshot, try others.
  395. - `REJECT_FORMAT`: Reject all snapshots with this `format`, try others.
  396. - `REJECT_SENDERS`: Reject all snapshots from all senders of this snapshot, try others.
  397. - **Usage**:
  398. - `OfferSnapshot` is called when bootstrapping a node using state sync. The application may
  399. accept or reject snapshots as appropriate. Upon accepting, Tendermint will retrieve and
  400. apply snapshot chunks via `ApplySnapshotChunk`. The application may also choose to reject a
  401. snapshot in the chunk response, in which case it should be prepared to accept further
  402. `OfferSnapshot` calls.
  403. - Only `AppHash` can be trusted, as it has been verified by the light client. Any other data
  404. can be spoofed by adversaries, so applications should employ additional verification schemes
  405. to avoid denial-of-service attacks. The verified `AppHash` is automatically checked against
  406. the restored application at the end of snapshot restoration.
  407. - For more information, see the `Snapshot` data type or the [state sync section](apps.md#state-sync).
  408. ### ApplySnapshotChunk
  409. - **Request**:
  410. - `Index (uint32)`: The chunk index, starting from `0`. Tendermint applies chunks sequentially.
  411. - `Chunk ([]byte)`: The binary chunk contents, as returned by `LoadSnapshotChunk`.
  412. - `Sender (string)`: The P2P ID of the node who sent this chunk.
  413. - **Response**:
  414. - `Result (Result)`: The result of applying this chunk.
  415. - `ACCEPT`: The chunk was accepted.
  416. - `ABORT`: Abort snapshot restoration, and don't try any other snapshots.
  417. - `RETRY`: Reapply this chunk, combine with `RefetchChunks` and `RejectSenders` as appropriate.
  418. - `RETRY_SNAPSHOT`: Restart this snapshot from `OfferSnapshot`, reusing chunks unless
  419. instructed otherwise.
  420. - `REJECT_SNAPSHOT`: Reject this snapshot, try a different one.
  421. - `RefetchChunks ([]uint32)`: Refetch and reapply the given chunks, regardless of `Result`. Only
  422. the listed chunks will be refetched, and reapplied in sequential order.
  423. - `RejectSenders ([]string)`: Reject the given P2P senders, regardless of `Result`. Any chunks
  424. already applied will not be refetched unless explicitly requested, but queued chunks from these senders will be discarded, and new chunks or other snapshots rejected.
  425. - **Usage**:
  426. - The application can choose to refetch chunks and/or ban P2P peers as appropriate. Tendermint
  427. will not do this unless instructed by the application.
  428. - The application may want to verify each chunk, e.g. by attaching chunk hashes in
  429. `Snapshot.Metadata` and/or incrementally verifying contents against `AppHash`.
  430. - When all chunks have been accepted, Tendermint will make an ABCI `Info` call to verify that
  431. `LastBlockAppHash` and `LastBlockHeight` matches the expected values, and record the
  432. `AppVersion` in the node state. It then switches to fast sync or consensus and joins the
  433. network.
  434. - If Tendermint is unable to retrieve the next chunk after some time (e.g. because no suitable
  435. peers are available), it will reject the snapshot and try a different one via `OfferSnapshot`.
  436. The application should be prepared to reset and accept it or abort as appropriate.
  437. ## Data Types
  438. ### Header
  439. - **Fields**:
  440. - `Version (Version)`: Version of the blockchain and the application
  441. - `ChainID (string)`: ID of the blockchain
  442. - `Height (int64)`: Height of the block in the chain
  443. - `Time (google.protobuf.Timestamp)`: Time of the previous block.
  444. For most blocks it's the weighted median of the timestamps of the valid votes in the
  445. block.LastCommit, except for the initial height where it's the genesis time.
  446. - `LastBlockID (BlockID)`: Hash of the previous (parent) block
  447. - `LastCommitHash ([]byte)`: Hash of the previous block's commit
  448. - `ValidatorsHash ([]byte)`: Hash of the validator set for this block
  449. - `NextValidatorsHash ([]byte)`: Hash of the validator set for the next block
  450. - `ConsensusHash ([]byte)`: Hash of the consensus parameters for this block
  451. - `AppHash ([]byte)`: Data returned by the last call to `Commit` - typically the
  452. Merkle root of the application state after executing the previous block's
  453. transactions
  454. - `LastResultsHash ([]byte)`: Root hash of all results from the txs from the previous block.
  455. - `EvidenceHash ([]byte)`: Hash of the evidence included in this block
  456. - `ProposerAddress ([]byte)`: Original proposer for the block
  457. - **Usage**:
  458. - Provided in RequestBeginBlock
  459. - Provides important context about the current state of the blockchain -
  460. especially height and time.
  461. - Provides the proposer of the current block, for use in proposer-based
  462. reward mechanisms.
  463. - `LastResultsHash` is the root hash of a Merkle tree built from `ResponseDeliverTx` responses (`Log`, `Info`, `Codespace` and `Events` fields are ignored).
  464. ### Version
  465. - **Fields**:
  466. - `Block (uint64)`: Protocol version of the blockchain data structures.
  467. - `App (uint64)`: Protocol version of the application.
  468. - **Usage**:
  469. - Block version should be static in the life of a blockchain.
  470. - App version may be updated over time by the application.
  471. ### Validator
  472. - **Fields**:
  473. - `Address ([]byte)`: Address of the validator (the first 20 bytes of SHA256(public key))
  474. - `Power (int64)`: Voting power of the validator
  475. - **Usage**:
  476. - Validator identified by address
  477. - Used in RequestBeginBlock as part of VoteInfo
  478. - Does not include PubKey to avoid sending potentially large quantum pubkeys
  479. over the ABCI
  480. ### ValidatorUpdate
  481. - **Fields**:
  482. - `PubKey (PubKey)`: Public key of the validator
  483. - `Power (int64)`: Voting power of the validator
  484. - **Usage**:
  485. - Validator identified by PubKey
  486. - Used to tell Tendermint to update the validator set
  487. ### VoteInfo
  488. - **Fields**:
  489. - `Validator (Validator)`: A validator
  490. - `SignedLastBlock (bool)`: Indicates whether or not the validator signed
  491. the last block
  492. - **Usage**:
  493. - Indicates whether a validator signed the last block, allowing for rewards
  494. based on validator availability
  495. ### PubKey
  496. - **Fields**:
  497. - `Sum (oneof PublicKey)`: This field is a Protobuf [`oneof`](https://developers.google.com/protocol-buffers/docs/proto#oneof)
  498. - **Usage**:
  499. - A generic and extensible typed public key
  500. ### Evidence
  501. - **Fields**:
  502. - `Type (EvidenceType)`: Type of the evidence. An enum of possible evidence's.
  503. - `Validator (Validator`: The offending validator
  504. - `Height (int64)`: Height when the offense occured
  505. - `Time (google.protobuf.Timestamp)`: Time of the block that was committed at the height that the offense occured
  506. - `TotalVotingPower (int64)`: Total voting power of the validator set at
  507. height `Height`
  508. ### LastCommitInfo
  509. - **Fields**:
  510. - `Round (int32)`: Commit round.
  511. - `Votes ([]VoteInfo)`: List of validators addresses in the last validator set
  512. with their voting power and whether or not they signed a vote.
  513. ### ConsensusParams
  514. - **Fields**:
  515. - `Block (BlockParams)`: Parameters limiting the size of a block and time between consecutive blocks.
  516. - `Evidence (EvidenceParams)`: Parameters limiting the validity of
  517. evidence of byzantine behaviour.
  518. - `Validator (ValidatorParams)`: Parameters limiting the types of pubkeys validators can use.
  519. - `Version (VersionParams)`: The ABCI application version.
  520. ### BlockParams
  521. - **Fields**:
  522. - `MaxBytes (int64)`: Max size of a block, in bytes.
  523. - `MaxGas (int64)`: Max sum of `GasWanted` in a proposed block.
  524. - NOTE: blocks that violate this may be committed if there are Byzantine proposers.
  525. It's the application's responsibility to handle this when processing a
  526. block!
  527. ### EvidenceParams
  528. - **Fields**:
  529. - `MaxAgeNumBlocks (int64)`: Max age of evidence, in blocks.
  530. - `MaxAgeDuration (time.Duration)`: Max age of evidence, in time.
  531. It should correspond with an app's "unbonding period" or other similar
  532. mechanism for handling [Nothing-At-Stake
  533. attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed).
  534. - Evidence older than `MaxAgeNumBlocks` && `MaxAgeDuration` is considered
  535. stale and ignored.
  536. - In Cosmos-SDK based blockchains, `MaxAgeDuration` is usually equal to the
  537. unbonding period. `MaxAgeNumBlocks` is calculated by dividing the unboding
  538. period by the average block time (e.g. 2 weeks / 6s per block = 2d8h).
  539. - `MaxNum (uint32)`: The maximum number of evidence that can be committed to a single block
  540. ### ValidatorParams
  541. - **Fields**:
  542. - `PubKeyTypes ([]string)`: List of accepted public key types.
  543. - Uses same naming as `PubKey.Type`.
  544. ### VersionParams
  545. - **Fields**:
  546. - `AppVersion (uint64)`: The ABCI application version.
  547. ### Proof
  548. - **Fields**:
  549. - `Ops ([]ProofOp)`: List of chained Merkle proofs, of possibly different types
  550. - The Merkle root of one op is the value being proven in the next op.
  551. - The Merkle root of the final op should equal the ultimate root hash being
  552. verified against.
  553. ### ProofOp
  554. - **Fields**:
  555. - `Type (string)`: Type of Merkle proof and how it's encoded.
  556. - `Key ([]byte)`: Key in the Merkle tree that this proof is for.
  557. - `Data ([]byte)`: Encoded Merkle proof for the key.
  558. ### Snapshot
  559. - **Fields**:
  560. - `Height (uint64)`: The height at which the snapshot was taken (after commit).
  561. - `Format (uint32)`: An application-specific snapshot format, allowing applications to version
  562. their snapshot data format and make backwards-incompatible changes. Tendermint does not
  563. interpret this.
  564. - `Chunks (uint32)`: The number of chunks in the snapshot. Must be at least 1 (even if empty).
  565. - `Hash (bytes)`: An arbitrary snapshot hash. Must be equal only for identical snapshots across
  566. nodes. Tendermint does not interpret the hash, it only compares them.
  567. - `Metadata (bytes)`: Arbitrary application metadata, for example chunk hashes or other
  568. verification data.
  569. - **Usage**:
  570. - Used for state sync snapshots, see [separate section](apps.md#state-sync) for details.
  571. - A snapshot is considered identical across nodes only if _all_ fields are equal (including
  572. `Metadata`). Chunks may be retrieved from all nodes that have the same snapshot.
  573. - When sent across the network, a snapshot message can be at most 4 MB.