hypersign-protocol / whitepaper

2 stars 0 forks source link

Research on tendermint #6

Closed Vishwas1 closed 2 years ago

Vishwas1 commented 2 years ago

Intro

ABCI

Tendermint passes transactions to the application through an interface called the ABCI (opens new window), which the application must implement.

              +---------------------+
              |                     |
              |     Application     |
              |                     |
              +--------+---+--------+
                       ^   |
                       |   | ABCI
                       |   v
              +--------+---+--------+
              |                     |
              |                     |
              |     Tendermint      |
              |                     |
              |                     |
              +---------------------+

Here are the most important messages of the ABCI:

  1. CheckTx: When a transaction is received by Tendermint Core, it is passed to the application to check if a few basic requirements are met.
  2. DeliverTx: When a valid block (opens new window) is received by Tendermint Core, each transaction in the block is passed to the application via DeliverTx in order to be processed.
  3. BeginBlock/EndBlock: These messages are executed at the beginning and the end of each block, whether the block contains transaction or not. It is useful to trigger automatic execution of logic.

Tendermint's Core BFT POS consensus engine:

Tendermint Core is the consensus system of the Tendermint platform that additionally consists of a generic application interface. What is unique about Tendermint is that, unlike other blockchain solutions pre-packaged and built-in state machines, developers can use the Tendermint for BFT state machine replication of applications whatever language they desire and whatever development environment works for them. (what does this means?)

image

Consensus

image

Tendermint (opens new window) is an application-agnostic engine that is responsible for handling the networking and consensus layers of a blockchain. In practice, this means that Tendermint is responsible for propagating and ordering transaction bytes. Tendermint Core relies on an eponymous Byzantine-Fault-Tolerant (BFT) algorithm to reach consensus on the order of transactions.


Consensus:

NewHeight -> (Propose -> Prevote -> Precommit)+ -> Commit -> NewHeight ->...

The sequence (Propose -> Prevote -> Precommit) is called round

                         +-------------------------------------+
                         v                                     |(Wait til `CommmitTime+timeoutCommit`)
                   +-----------+                         +-----+-----+
      +----------> |  Propose  +--------------+          | NewHeight |
      |            +-----------+              |          +-----------+
      |                                       |                ^
      |(Else, after timeoutPrecommit)         v                |
+-----+-----+                           +-----------+          |
| Precommit |  <------------------------+  Prevote  |          |
+-----+-----+                           +-----------+          |
      |(When +2/3 Precommits for block found)                  |
      v                                                        |
+--------------------------------------------------------------------+
|  Commit                                                            |
|                                                                    |
|  * Set CommitTime = now;                                           |
|  * Wait for block, then stage/save/commit block;                   |
+--------------------------------------------------------------------+

Proposal

A proposal is signed and published by the designated proposer at each round. The proposer is chosen by a deterministic and non-choking round robin selection algorithm that selects proposers in proportion to their voting power.

Prevote

Upon entering Prevote, each validator broadcasts its prevote vote.

Precommit


                ^  +-------------------------------+  ^
                |  |                               |  |
                |  |  State-machine = Application  |  |
                |  |                               |  |   Built with Cosmos SDK
                |  |            ^      +           |  |
                |  +----------- | ABCI | ----------+  v
                |  |            +      v           |  ^
                |  |                               |  |
Blockchain Node |  |           Consensus           |  |
                |  |                               |  |
                |  +-------------------------------+  |   Tendermint Core
                |  |                               |  |
                |  |           Networking          |  |
                |  |                               |  |
                v  +-------------------------------+  v