@ -36,9 +36,9 @@ Commit are included in the header of the next block.
Tendermint opens three connections to the application to handle the
Tendermint opens three connections to the application to handle the
different message types:
different message types:
- `Consensus Connection - InitChain, BeginBlock, DeliverTx, EndBlock, Commit`
- `Mempool Connection - CheckTx`
- `Info Connection - Info, SetOption, Query`
- `Consensus Connection - InitChain, BeginBlock, DeliverTx, EndBlock, Commit`
- `Mempool Connection - CheckTx`
- `Info Connection - Info, SetOption, Query`
The `Flush` message is used on every connection, and the `Echo` message
The `Flush` message is used on every connection, and the `Echo` message
is only used for debugging.
is only used for debugging.
@ -54,272 +54,272 @@ See below for more details on the message types and how they are used.
### Echo
### Echo
- **Request** :
- `Message (string)` : A string to echo back
- **Response** :
- `Message (string)` : The input string
- **Usage** :
- Echo a string to test an abci client/server implementation
- **Request** :
- `Message (string)` : A string to echo back
- **Response** :
- `Message (string)` : The input string
- **Usage** :
- Echo a string to test an abci client/server implementation
### Flush
### Flush
- **Usage** :
- Signals that messages queued on the client should be flushed to
the server. It is called periodically by the client
implementation to ensure asynchronous requests are actually
sent, and is called immediately to make a synchronous request,
which returns when the Flush response comes back.
- **Usage** :
- Signals that messages queued on the client should be flushed to
the server. It is called periodically by the client
implementation to ensure asynchronous requests are actually
sent, and is called immediately to make a synchronous request,
which returns when the Flush response comes back.
### Info
### Info
- **Request** :
- `Version (string)` : The Tendermint version
- **Response** :
- `Data (string)` : Some arbitrary information
- `Version (Version)` : Version information
- `LastBlockHeight (int64)` : Latest block for which the app has
called Commit
- `LastBlockAppHash ([]byte)` : Latest result of Commit
- **Usage** :
- Return information about the application state.
- Used to sync Tendermint with the application during a handshake
that happens on startup.
- Tendermint expects `LastBlockAppHash` and `LastBlockHeight` to
be updated during `Commit` , ensuring that `Commit` is never
called twice for the same block height.
- **Request** :
- `Version (string)` : The Tendermint version
- **Response** :
- `Data (string)` : Some arbitrary information
- `Version (Version)` : Version information
- `LastBlockHeight (int64)` : Latest block for which the app has
called Commit
- `LastBlockAppHash ([]byte)` : Latest result of Commit
- **Usage** :
- Return information about the application state.
- Used to sync Tendermint with the application during a handshake
that happens on startup.
- Tendermint expects `LastBlockAppHash` and `LastBlockHeight` to
be updated during `Commit` , ensuring that `Commit` is never
called twice for the same block height.
### SetOption
### SetOption
- **Request** :
- `Key (string)` : Key to set
- `Value (string)` : Value to set for key
- **Response** :
- `Code (uint32)` : Response code
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- **Usage** :
- Set non-consensus critical application specific options.
- e.g. Key="min-fee", Value="100fermion" could set the minimum fee
required for CheckTx (but not DeliverTx - that would be
consensus critical).
- **Request** :
- `Key (string)` : Key to set
- `Value (string)` : Value to set for key
- **Response** :
- `Code (uint32)` : Response code
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- **Usage** :
- Set non-consensus critical application specific options.
- e.g. Key="min-fee", Value="100fermion" could set the minimum fee
required for CheckTx (but not DeliverTx - that would be
consensus critical).
### InitChain
### InitChain
- **Request** :
- `Validators ([]Validator)` : Initial genesis validators
- `AppStateBytes ([]byte)` : Serialized initial application state
- **Response** :
- `ConsensusParams (ConsensusParams)` : Initial
consensus-critical parameters.
- `Validators ([]Validator)` : Initial validator set.
- **Usage** :
- Called once upon genesis.
- **Request** :
- `Validators ([]Validator)` : Initial genesis validators
- `AppStateBytes ([]byte)` : Serialized initial application state
- **Response** :
- `ConsensusParams (ConsensusParams)` : Initial
consensus-critical parameters.
- `Validators ([]Validator)` : Initial validator set.
- **Usage** :
- Called once upon genesis.
### Query
### Query
- **Request** :
- `Data ([]byte)` : Raw query bytes. Can be used with or in lieu
of Path.
- `Path (string)` : Path of request, like an HTTP GET path. Can be
used with or in liue of Data.
- Apps MUST interpret '/store' as a query by key on the
underlying store. The key SHOULD be specified in the Data field.
- Apps SHOULD allow queries over specific types like
'/accounts/...' or '/votes/...'
- `Height (int64)` : The block height for which you want the query
(default=0 returns data for the latest committed block). Note
that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- `Prove (bool)` : Return Merkle proof with response if possible
- **Response** :
- `Code (uint32)` : Response code.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `Index (int64)` : The index of the key in the tree.
- `Key ([]byte)` : The key of the matching data.
- `Value ([]byte)` : The value of the matching data.
- `Proof ([]byte)` : Proof for the data, if requested.
- `Height (int64)` : The block height from which data was derived.
Note that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- **Usage** :
- Query for data from the application at current or past height.
- Optionally return Merkle proof.
- **Request** :
- `Data ([]byte)` : Raw query bytes. Can be used with or in lieu
of Path.
- `Path (string)` : Path of request, like an HTTP GET path. Can be
used with or in liue of Data.
- Apps MUST interpret '/store' as a query by key on the
underlying store. The key SHOULD be specified in the Data field.
- Apps SHOULD allow queries over specific types like
'/accounts/...' or '/votes/...'
- `Height (int64)` : The block height for which you want the query
(default=0 returns data for the latest committed block). Note
that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- `Prove (bool)` : Return Merkle proof with response if possible
- **Response** :
- `Code (uint32)` : Response code.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `Index (int64)` : The index of the key in the tree.
- `Key ([]byte)` : The key of the matching data.
- `Value ([]byte)` : The value of the matching data.
- `Proof ([]byte)` : Proof for the data, if requested.
- `Height (int64)` : The block height from which data was derived.
Note that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- **Usage** :
- Query for data from the application at current or past height.
- Optionally return Merkle proof.
### BeginBlock
### BeginBlock
- **Request** :
- `Hash ([]byte)` : The block's hash. This can be derived from the
block header.
- `Header (struct{})` : The block header
- `Validators ([]SigningValidator)` : List of validators in the current validator
set and whether or not they signed a vote in the LastCommit
- `ByzantineValidators ([]Evidence)` : List of evidence of
validators that acted maliciously
- **Response** :
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
- **Usage** :
- Signals the beginning of a new block. Called prior to
any DeliverTxs.
- The header is expected to at least contain the Height.
- The `Validators` and `ByzantineValidators` can be used to
determine rewards and punishments for the validators.
- **Request** :
- `Hash ([]byte)` : The block's hash. This can be derived from the
block header.
- `Header (struct{})` : The block header
- `Validators ([]SigningValidator)` : List of validators in the current validator
set and whether or not they signed a vote in the LastCommit
- `ByzantineValidators ([]Evidence)` : List of evidence of
validators that acted maliciously
- **Response** :
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
- **Usage** :
- Signals the beginning of a new block. Called prior to
any DeliverTxs.
- The header is expected to at least contain the Height.
- The `Validators` and `ByzantineValidators` can be used to
determine rewards and punishments for the validators.
### CheckTx
### CheckTx
- **Request** :
- `Tx ([]byte)` : The request transaction bytes
- **Response** :
- `Code (uint32)` : Response code
- `Data ([]byte)` : Result bytes, if any.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `GasWanted (int64)` : Amount of gas request for transaction.
- `GasUsed (int64)` : Amount of gas consumed by transaction.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
transactions (eg. by account).
- `Fee (cmn.KI64Pair)` : Fee paid for the transaction.
- **Usage** : Validate a mempool transaction, prior to broadcasting
or proposing. CheckTx should perform stateful but light-weight
checks of the validity of the transaction (like checking signatures
and account balances), but need not execute in full (like running a
smart contract).
Tendermint runs CheckTx and DeliverTx concurrently with eachother,
though on distinct ABCI connections - the mempool connection and the
consensus connection, respectively.
The application should maintain a separate state to support CheckTx.
This state can be reset to the latest committed state during
`Commit` . Before calling Commit, Tendermint will lock and flush the mempool,
ensuring that all existing CheckTx are responded to and no new ones can
begin. After `Commit` , the mempool will rerun
CheckTx for all remaining transactions, throwing out any that are no longer valid.
Then the mempool will unlock and start sending CheckTx again.
Keys and values in Tags must be UTF-8 encoded strings (e.g.
"account.owner": "Bob", "balance": "100.0", "date": "2018-01-02")
- **Request** :
- `Tx ([]byte)` : The request transaction bytes
- **Response** :
- `Code (uint32)` : Response code
- `Data ([]byte)` : Result bytes, if any.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `GasWanted (int64)` : Amount of gas request for transaction.
- `GasUsed (int64)` : Amount of gas consumed by transaction.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
transactions (eg. by account).
- `Fee (cmn.KI64Pair)` : Fee paid for the transaction.
- **Usage** : Validate a mempool transaction, prior to broadcasting
or proposing. CheckTx should perform stateful but light-weight
checks of the validity of the transaction (like checking signatures
and account balances), but need not execute in full (like running a
smart contract).
Tendermint runs CheckTx and DeliverTx concurrently with eachother,
though on distinct ABCI connections - the mempool connection and the
consensus connection, respectively.
The application should maintain a separate state to support CheckTx.
This state can be reset to the latest committed state during
`Commit` . Before calling Commit, Tendermint will lock and flush the mempool,
ensuring that all existing CheckTx are responded to and no new ones can
begin. After `Commit` , the mempool will rerun
CheckTx for all remaining transactions, throwing out any that are no longer valid.
Then the mempool will unlock and start sending CheckTx again.
Keys and values in Tags must be UTF-8 encoded strings (e.g.
"account.owner": "Bob", "balance": "100.0", "date": "2018-01-02")
### DeliverTx
### DeliverTx
- **Request** :
- `Tx ([]byte)` : The request transaction bytes.
- **Response** :
- `Code (uint32)` : Response code.
- `Data ([]byte)` : Result bytes, if any.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `GasWanted (int64)` : Amount of gas requested for transaction.
- `GasUsed (int64)` : Amount of gas consumed by transaction.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
transactions (eg. by account).
- `Fee (cmn.KI64Pair)` : Fee paid for the transaction.
- **Usage** :
- Deliver a transaction to be executed in full by the application.
If the transaction is valid, returns CodeType.OK.
- Keys and values in Tags must be UTF-8 encoded strings (e.g.
"account.owner": "Bob", "balance": "100.0",
"time": "2018-01-02T12:30:00Z")
- **Request** :
- `Tx ([]byte)` : The request transaction bytes.
- **Response** :
- `Code (uint32)` : Response code.
- `Data ([]byte)` : Result bytes, if any.
- `Log (string)` : The output of the application's logger. May
be non-deterministic.
- `Info (string)` : Additional information. May
be non-deterministic.
- `GasWanted (int64)` : Amount of gas requested for transaction.
- `GasUsed (int64)` : Amount of gas consumed by transaction.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
transactions (eg. by account).
- `Fee (cmn.KI64Pair)` : Fee paid for the transaction.
- **Usage** :
- Deliver a transaction to be executed in full by the application.
If the transaction is valid, returns CodeType.OK.
- Keys and values in Tags must be UTF-8 encoded strings (e.g.
"account.owner": "Bob", "balance": "100.0",
"time": "2018-01-02T12:30:00Z")
### EndBlock
### EndBlock
- **Request** :
- `Height (int64)` : Height of the block just executed.
- **Response** :
- `ValidatorUpdates ([]Validator)` : Changes to validator set (set
voting power to 0 to remove).
- `ConsensusParamUpdates (ConsensusParams)` : Changes to
consensus-critical time, size, and other parameters.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
- **Usage** :
- Signals the end of a block.
- Called prior to each Commit, after all transactions.
- Validator set and consensus params are updated with the result.
- Validator pubkeys are expected to be go-wire encoded.
- **Request** :
- `Height (int64)` : Height of the block just executed.
- **Response** :
- `ValidatorUpdates ([]Validator)` : Changes to validator set (set
voting power to 0 to remove).
- `ConsensusParamUpdates (ConsensusParams)` : Changes to
consensus-critical time, size, and other parameters.
- `Tags ([]cmn.KVPair)` : Key-Value tags for filtering and indexing
- **Usage** :
- Signals the end of a block.
- Called prior to each Commit, after all transactions.
- Validator set and consensus params are updated with the result.
- Validator pubkeys are expected to be go-wire encoded.
### Commit
### Commit
- **Response** :
- `Data ([]byte)` : The Merkle root hash
- **Usage** :
- Persist the application state.
- Return a Merkle root hash of the application state.
- It's critical that all application instances return the
same hash. If not, they will not be able to agree on the next
block, because the hash is included in the next block!
- **Response** :
- `Data ([]byte)` : The Merkle root hash
- **Usage** :
- Persist the application state.
- Return a Merkle root hash of the application state.
- It's critical that all application instances return the
same hash. If not, they will not be able to agree on the next
block, because the hash is included in the next block!
## Data Messages
## Data Messages
### Header
### Header
- **Fields** :
- **Fields** :
- `ChainID (string)` : ID of the blockchain
- `Height (int64)` : Height of the block in the chain
- `Time (int64)` : Unix time of the block
- `NumTxs (int32)` : Number of transactions in the block
- `TotalTxs (int64)` : Total number of transactions in the blockchain until
now
- `LastBlockHash ([]byte)` : Hash of the previous (parent) block
- `ValidatorsHash ([]byte)` : Hash of the validator set for this block
- `AppHash ([]byte)` : Data returned by the last call to `Commit` - typically the
Merkle root of the application state after executing the previous block's
transactions
- `Proposer (Validator)` : Original proposer for the block
- `ChainID (string)` : ID of the blockchain
- `Height (int64)` : Height of the block in the chain
- `Time (int64)` : Unix time of the block
- `NumTxs (int32)` : Number of transactions in the block
- `TotalTxs (int64)` : Total number of transactions in the blockchain until
now
- `LastBlockHash ([]byte)` : Hash of the previous (parent) block
- `ValidatorsHash ([]byte)` : Hash of the validator set for this block
- `AppHash ([]byte)` : Data returned by the last call to `Commit` - typically the
Merkle root of the application state after executing the previous block's
transactions
- `Proposer (Validator)` : Original proposer for the block
- **Usage** :
- **Usage** :
- Provided in RequestBeginBlock
- Provides important context about the current state of the blockchain -
especially height and time.
- Provides the proposer of the current block, for use in proposer-based
reward mechanisms.
- Provided in RequestBeginBlock
- Provides important context about the current state of the blockchain -
especially height and time.
- Provides the proposer of the current block, for use in proposer-based
reward mechanisms.
### Validator
### Validator
- **Fields** :
- **Fields** :
- `Address ([]byte)` : Address of the validator (hash of the public key)
- `PubKey (PubKey)` : Public key of the validator
- `Power (int64)` : Voting power of the validator
- `Address ([]byte)` : Address of the validator (hash of the public key)
- `PubKey (PubKey)` : Public key of the validator
- `Power (int64)` : Voting power of the validator
- **Usage** :
- **Usage** :
- Provides all identifying information about the validator
- Provides all identifying information about the validator
### SigningValidator
### SigningValidator
- **Fields** :
- **Fields** :
- `Validator (Validator)` : A validator
- `SignedLastBlock (bool)` : Indicated whether or not the validator signed
the last block
- `Validator (Validator)` : A validator
- `SignedLastBlock (bool)` : Indicated whether or not the validator signed
the last block
- **Usage** :
- **Usage** :
- Indicates whether a validator signed the last block, allowing for rewards
based on validator availability
- Indicates whether a validator signed the last block, allowing for rewards
based on validator availability
### PubKey
### PubKey
- **Fields** :
- **Fields** :
- `Type (string)` : Type of the public key. A simple string like `"ed25519"` .
In the future, may indicate a serialization algorithm to parse the `Data` ,
for instance `"amino"` .
- `Data ([]byte)` : Public key data. For a simple public key, it's just the
raw bytes. If the `Type` indicates an encoding algorithm, this is the
encoded public key.
- `Type (string)` : Type of the public key. A simple string like `"ed25519"` .
In the future, may indicate a serialization algorithm to parse the `Data` ,
for instance `"amino"` .
- `Data ([]byte)` : Public key data. For a simple public key, it's just the
raw bytes. If the `Type` indicates an encoding algorithm, this is the
encoded public key.
- **Usage** :
- **Usage** :
- A generic and extensible typed public key
- A generic and extensible typed public key
### Evidence
### Evidence
- **Fields** :
- **Fields** :
- `Type (string)` : Type of the evidence. A hierarchical path like
"duplicate/vote".
- `Validator (Validator` : The offending validator
- `Height (int64)` : Height when the offense was committed
- `Time (int64)` : Unix time of the block at height `Height`
- `TotalVotingPower (int64)` : Total voting power of the validator set at
height `Height`
- `Type (string)` : Type of the evidence. A hierarchical path like
"duplicate/vote".
- `Validator (Validator` : The offending validator
- `Height (int64)` : Height when the offense was committed
- `Time (int64)` : Unix time of the block at height `Height`
- `TotalVotingPower (int64)` : Total voting power of the validator set at
height `Height`