tendermint/docs/spec/README.md

82 lines
4.3 KiB
Markdown
Raw Normal View History

2017-12-26 15:43:03 -08:00
# Tendermint Specification
This is a markdown specification of the Tendermint blockchain.
2018-01-21 15:19:38 -08:00
It defines the base data structures, how they are validated,
and how they are communicated over the network.
2017-12-26 15:43:03 -08:00
2018-01-19 14:51:09 -08:00
If you find discrepancies between the spec and the code that
do not have an associated issue or pull request on github,
please submit them to our [bug bounty](https://tendermint.com/security)!
2017-12-26 15:43:03 -08:00
2018-01-19 14:51:09 -08:00
## Contents
- [Overview](#overview)
2018-01-21 15:19:38 -08:00
### Data Structures
2018-05-23 07:01:32 -07:00
- [Encoding and Digests](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/encoding.md)
- [Blockchain](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/blockchain.md)
- [State](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/state.md)
### Consensus Protocol
2018-06-15 22:56:26 -07:00
- [Consensus Algorithm](/docs/spec/consensus/consensus.md)
- [Creating a proposal](/docs/spec/consensus/creating-proposal.md)
2018-06-15 22:56:26 -07:00
- [Time](/docs/spec/consensus/bft-time.md)
- [Light-Client](/docs/spec/consensus/light-client.md)
2018-01-21 15:19:38 -08:00
### P2P and Network Protocols
2018-05-23 07:01:32 -07:00
- [The Base P2P Layer](https://github.com/tendermint/tendermint/tree/master/docs/spec/p2p): multiplex the protocols ("reactors") on authenticated and encrypted TCP connections
- [Peer Exchange (PEX)](https://github.com/tendermint/tendermint/tree/master/docs/spec/reactors/pex): gossip known peer addresses so peers can find each other
- [Block Sync](https://github.com/tendermint/tendermint/tree/master/docs/spec/reactors/block_sync): gossip blocks so peers can catch up quickly
- [Consensus](https://github.com/tendermint/tendermint/tree/master/docs/spec/reactors/consensus): gossip votes and block parts so new blocks can be committed
- [Mempool](https://github.com/tendermint/tendermint/tree/master/docs/spec/reactors/mempool): gossip transactions so they get included in blocks
- Evidence: Forthcoming, see [this issue](https://github.com/tendermint/tendermint/issues/2329).
2018-01-21 15:19:38 -08:00
2018-06-15 22:56:26 -07:00
### Software
- [ABCI](/docs/spec/software/abci.md): Details about interactions between the
application and consensus engine over ABCI
- [Write-Ahead Log](/docs/spec/software/wal.md): Details about how the consensus
engine preserves data and recovers from crash failures
2017-12-26 15:43:03 -08:00
2017-12-27 12:14:49 -08:00
## Overview
Tendermint provides Byzantine Fault Tolerant State Machine Replication using
hash-linked batches of transactions. Such transaction batches are called "blocks".
2018-01-24 18:11:07 -08:00
Hence, Tendermint defines a "blockchain".
2017-12-27 12:14:49 -08:00
Each block in Tendermint has a unique index - its Height.
2018-06-15 22:56:26 -07:00
Height's in the blockchain are monotonic.
2017-12-27 12:14:49 -08:00
Each block is committed by a known set of weighted Validators.
2018-06-15 22:56:26 -07:00
Membership and weighting within this validator set may change over time.
2017-12-27 12:14:49 -08:00
Tendermint guarantees the safety and liveness of the blockchain
so long as less than 1/3 of the total weight of the Validator set
2018-01-24 18:11:07 -08:00
is malicious or faulty.
2017-12-27 12:14:49 -08:00
A commit in Tendermint is a set of signed messages from more than 2/3 of
the total weight of the current Validator set. Validators take turns proposing
blocks and voting on them. Once enough votes are received, the block is considered
committed. These votes are included in the _next_ block as proof that the previous block
2017-12-27 12:14:49 -08:00
was committed - they cannot be included in the current block, as that block has already been
created.
Once a block is committed, it can be executed against an application.
The application returns results for each of the transactions in the block.
The application can also return changes to be made to the validator set,
as well as a cryptographic digest of its latest state.
Tendermint is designed to enable efficient verification and authentication
of the latest state of the blockchain. To achieve this, it embeds
cryptographic commitments to certain information in the block "header".
This information includes the contents of the block (eg. the transactions),
the validator set committing the block, as well as the various results returned by the application.
Note, however, that block execution only occurs _after_ a block is committed.
Thus, application results can only be included in the _next_ block.
2017-12-27 12:14:49 -08:00
Also note that information like the transaction results and the validator set are never
directly included in the block - only their cryptographic digests (Merkle roots) are.
Hence, verification of a block requires a separate data structure to store this information.
We call this the `State`. Block verification also requires access to the previous block.