Documentation ¶
Index ¶
- Constants
- func Init(cfg Config, ntw network.Network, trcCfg stdtracer.Config) error
- type Config
- type Node
- type TendermintABCI
- func (abci *TendermintABCI) BeginBlock(req tmtAbciTypes.RequestBeginBlock) tmtAbciTypes.ResponseBeginBlock
- func (abci *TendermintABCI) CheckTx(txBytes []byte) tmtAbciTypes.ResponseCheckTx
- func (abci *TendermintABCI) Commit() tmtAbciTypes.ResponseCommit
- func (abci *TendermintABCI) DeliverTx(txBytes []byte) tmtAbciTypes.ResponseDeliverTx
- func (abci *TendermintABCI) EndBlock(req tmtAbciTypes.RequestEndBlock) tmtAbciTypes.ResponseEndBlock
- func (abci *TendermintABCI) Info(req tmtAbciTypes.RequestInfo) tmtAbciTypes.ResponseInfo
- func (abci *TendermintABCI) InitChain(req tmtAbciTypes.RequestInitChain) tmtAbciTypes.ResponseInitChain
- func (abci *TendermintABCI) Query(query tmtAbciTypes.RequestQuery) tmtAbciTypes.ResponseQuery
- func (abci *TendermintABCI) ResetBlockState() error
- func (abci *TendermintABCI) RewardReceiver() common.Address
- func (abci *TendermintABCI) SetOption(req tmtAbciTypes.RequestSetOption) tmtAbciTypes.ResponseSetOption
Constants ¶
const DataDirName = "consensus"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is general consensus node config.
Default values:
- rpcListenPort 26657 - p2pListenPort 26656 - proxyAppName lightchain
func (Config) RPCListenPort ¶
func (Config) TendermintConfigFilePath ¶
type TendermintABCI ¶
type TendermintABCI struct {
// contains filtered or unexported fields
}
TendermintABCI is the main hook of application layer (blockchain) for connecting to consensus (Tendermint) using ABCI.
Tendermint ABCI requires three connections to the application to handle the different message types. Connections:
Consensus Connection - InitChain, BeginBlock, DeliverTx, EndBlock, Commit Mempool Connection - CheckTx Info Connection - Info, SetOption, Query
Flow:
- BeginBlock
- CheckTx
- DeliverTx
- EndBlock
- Commit
- CheckTx (clean mempool from TXs not included in committed block)
Tendermint runs CheckTx and DeliverTx concurrently with each other, though on distinct ABCI connections - the mempool connection and the consensus connection.
Full ABCI specs: https://tendermint.com/docs/spec/abci/abci.html
func NewTendermintABCI ¶
func (*TendermintABCI) BeginBlock ¶
func (abci *TendermintABCI) BeginBlock(req tmtAbciTypes.RequestBeginBlock) tmtAbciTypes.ResponseBeginBlock
BeginBlock signals the beginning of a new block.
The header contains the height, timestamp, and more - it exactly matches the Tendermint block header. The `req.LastCommitInfo` and `req.ByzantineValidators` attributes can be used to determine rewards and punishments for the validators.
Response:
- Optional Key-Value tags for filtering and indexing
func (*TendermintABCI) CheckTx ¶
func (abci *TendermintABCI) CheckTx(txBytes []byte) tmtAbciTypes.ResponseCheckTx
CheckTx validates 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).
The application should maintain a separate state to support CheckTx. This state can be reset to the latest committed state during Persist. Before calling Persist, Tendermint will lock and flush the mempool, ensuring that all existing CheckTx are responded to and no new ones can begin. After Persist, 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.
Response:
- Response code
- Optional Key-Value tags for filtering and indexing
func (*TendermintABCI) Commit ¶
func (abci *TendermintABCI) Commit() tmtAbciTypes.ResponseCommit
Commit persists the application state.
Response:
- 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!
func (*TendermintABCI) DeliverTx ¶
func (abci *TendermintABCI) DeliverTx(txBytes []byte) tmtAbciTypes.ResponseDeliverTx
DeliverTx executes the transaction against Ethereum block's work state.
Response:
- 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")
func (*TendermintABCI) EndBlock ¶
func (abci *TendermintABCI) EndBlock(req tmtAbciTypes.RequestEndBlock) tmtAbciTypes.ResponseEndBlock
EndBlock signals the end of a block.
An opportunity to propose changes to a validator set.
Response:
- Validator updates returned for block H
- apply to the NextValidatorsHash of block H+1
- apply to the ValidatorsHash (and thus the validator set) for block H+2
- apply to the RequestBeginBlock.LastCommitInfo (ie. the last validator set) for block H+3
- Consensus params returned for block H apply for block H+1
func (*TendermintABCI) Info ¶
func (abci *TendermintABCI) Info(req tmtAbciTypes.RequestInfo) tmtAbciTypes.ResponseInfo
Info returns information about the last height and app_hash to the tmtCfg engine
func (*TendermintABCI) InitChain ¶
func (abci *TendermintABCI) InitChain(req tmtAbciTypes.RequestInitChain) tmtAbciTypes.ResponseInitChain
InitChain is called upon genesis.
Can be used to define validators set and consensus params on the application side.
Response:
- If `ResponseInitChain.Validators` is empty, the initial validator set will be the `RequestInitChain.Validators`
func (*TendermintABCI) Query ¶
func (abci *TendermintABCI) Query(query tmtAbciTypes.RequestQuery) tmtAbciTypes.ResponseQuery
Query for data from the application at current or past height.
func (*TendermintABCI) ResetBlockState ¶ added in v0.10.0
func (abci *TendermintABCI) ResetBlockState() error
ResetBlockState resets the in-memory block's processing state.
func (*TendermintABCI) RewardReceiver ¶ added in v0.10.0
func (abci *TendermintABCI) RewardReceiver() common.Address
RewardReceiver returns the receiving address based on the selected strategy
func (*TendermintABCI) SetOption ¶
func (abci *TendermintABCI) SetOption(req tmtAbciTypes.RequestSetOption) tmtAbciTypes.ResponseSetOption
SetOption sets 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).