Bitcoin Analogy
Bitcoin is a cryptocurrency based on a blockchain. Each peer in the network houses, audits, and updates a complete copy of the UTXO database (Unspent Transaction Output). To recreate a system of this nature within Tendermint, the Tendermint Core would abstract away the following functionality:
- Synchronization of transactions and blocks across all nodes
- Ensuring canonical and immutable order of the transactions
- Read and create operations across the UTXO database (in blockchain there are no deletions or updates – transactions are immutable)
- Validating signatures for transactions
- Preventing double-spend and spending non-existent coins
- Servicing UTXO queries from clients
The application would then use a custom implementation of the underlying ABCI to handle remaining functions needed to round out use of the Tendermint Core, via message types exposed by the ABCI (DeliverTx, CheckTx and Commit). That would look as follows:
- Every transaction in the blockchain is delivered via DeliverTx, and the application would need to validate each DeliverTx message, looking at the cryptographic credentials, protocol and state. Once validated, the application would need to update the state of the UTXO database.
- To streamline validation, all DeliverTx messages can be vetted through the CheckTx message type. Tendermint Core handles comparing the supplied transaction against the mempool and relaying it to peers when applicable.
- Once a delivered message is checked and validated, it can be committed using the Commit message type. Commit leans on the Core to generate a satisfactory and properly encrypted update to the applications state, placed into the next block of the chain, and synchronized across all the nodes. If there are any inconsistencies, they will surface as forks in the blockchain, and consensus is baked into the ABCI.
- By default, Tendermint maintains 3 ABCI sockets: one for validation, one for consensus, and one to service queries. The largest concern for the consuming application is to design message handlers in the right way, but Tendermint provides a core and API, leaving the finesse of the actual implementation to the consuming application.