2. What is
Tendermint?
A fast blockchain consensus
engine that enables you to run
Byzantine fault tolerant
applications, written in any
programming language, in a
distributed way.
3. Up to 4k tx/sec
Tested on a laptop with a single
validator. Computer specs:
MacBook Air (13-inch, 2017)
Processor: 1.8 GHz Intel Core i5
Memory: 8 GB 1600 MHz DDR3
6. Tendermint consists of:
Tendermint Core – a consensus engine that ensures that
the same transactions are recorded on every machine in the
same order.
ABCI (Application BlockChain Interface) – it enables us to
process transactions in any programming language against
some persistent state.
7. ABCI messages
The ABCI consists of 3 primary message types that get
delivered from the Tendermint core, to the application:
- CheckTx
- DeliverTx
- Commit
8.
9. CheckTx (ABCI message)
CheckTx message can be used to accept or reject
transactions, before they are stored in memory or gossipped
to other peers.
10. DeliverTx (ABCI message)
The application needs to validate each transaction received
with the DeliverTx message against the current state,
application protocol, and the cryptographic credentials of the
transaction.
A validated transaction then needs to update the application
state
12. Validators
Validators are responsible for committing new blocks in the
blockchain. They participate in the consensus protocol by
broadcasting votes which contain cryptographic signatures
signed by each validator's private key.
13. Validators
Tendermint expects validators to be online.
The set of validators is permissioned / curated by some
external process. For example by locking stake tokens – this
is optional for Tendermint.
14. How to become a validator?
There are two ways to become a validator:
1. They can be pre-established in the genesis state via
genesis.json file in config folder.
2. The ABCI app responds to the EndBlock message with
changes to the existing validator set.
15. A dapp example: kvstore
The kvstore app is a Merkle tree that stores all
transactions. If the transaction contains an =, e.g.
key=value, then the value is stored under the key.
Otherwise, the full transaction bytes are stored as the key
and the value.
16. Configuration files
config.toml contains a configuration file for Tendermint node.
priv_validator.json contains a private key, and should thus be
kept absolutely secret.
genesis.json contains the list of public keys which may
participate in the consensus, and their corresponding voting
power.
20. Different ways to send tx
/broadcast_tx_async will return right away without waiting to
hear if the transaction is even valid.
/broadcast_tx_sync will return with the result of running the
transaction through CheckTx.
/broadcast_tx_commit will wait until the transaction is
committed in a block or until some timeout is reached, but will
return right away if the transaction does not pass CheckTx.
21. Query for stored tx
$ curl 'http://localhost:26657/abci_query?data="hello"'
26. View block info on Cosmos testnet
Using RPC API:
https://gaia-seeds.interblock.io/block?height=106456
Using web UI:
https://explorecosmos.network/blocks/106456
27. Where:
● c – number of open connections
● r – how much txs per second to send while benchmarking
● s – size of each tx in bytes
$ tm-bench -c 8 -r 10000 -s 200 localhost:26657
Stats Avg StdDev Max Total
Txs/sec 4579 3262 8448 45786
Blocks/sec 0.700 0.458 1 7
Tools: tm-bench
tm-bench can be used to test performance of Tendermint.
28. Tendermint performance
Overall throughput is dependent number of factors: a number of
validators, size of transactions, network latency, etc.
Cosmos, for example, starts with 100 validator set (globally
distributed) and can achieve a few hundreds tx/sec with 3-5
seconds block time.
If you reduce the the validator set to 21 nodes (EOS), then
throughput goes up.
29. Tools: tm-monitor
tm-monitor watches over one or more nodes, collecting and
providing various statistics.
$ tm-monitor localhost:26657
Height: 6920
Avg block time: 1063.175 ms
Avg tx throughput: 810 per sec
Avg block latency: 0.268 ms
Active nodes: 1/1 (health: full) Validators: 1
NAME HEIGHT BLOCK LATENCY ONLINE VALIDATOR
localhost:26657 6920 0.329 ms true true
30. Who is using Tendermint?
More than 50 projects are building on Tendermint (Aug 2018)
https://forum.cosmos.network/t/list-of-projects-in-cosmos-tendermint-ecosy
stem/243
31.
32.
33. Ethermint
Ethermint is an implementation of the Ethereum Virtual
Machine that runs on top of Tendermint consensus, a Proof
of Stake system.
Still work in progress and devs are talking about its second
version.
https://github.com/cosmos/ethermint
34. Hyperledger Burrow
Burrow is an alternative implementation of the Ethereum
Virtual Machine and Ethereum transaction mechanics on top
of Tendermint.
It has additional features for a name-registry, permissions,
and native contracts, and an alternative blockchain API.
https://github.com/hyperledger/burrow