Cosmos mempools and blocks
Recently with the Celestia airdrop, Cosmos was jammed. IBC transfers were taking ages if getting executed at all and this is the optimistic scenerio where something valuable was filling up the blockspace but there have been instances where the mempool was flooded with malicious transactions and validators struggled to handle load. To understand the nitty gritty lets first dive into how transactions work on cosmos.
Pipeline
From the very basic, a user signs a transaction which is simulated to verify hashes and format by the rpc, which then is picked up by the relayer and sent to one of the nodes on the network.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
The transactions are are shared over the gossip network between all the nodes, while the scheduled proposer builds a block after calling the checkTx
function to verify it once again and then proposer creates a proposal which is voted upon and where the bft consensus comes into play and after the block is finalised the transactions. every block contains
- The transactions
- A reference to the hash of the previous block, linking the new block to the existing blockchain.
- The proposer's signature.
- Additional metadata, like the block's timestamp.
The built up block is put up for consesus so the participating nodes could determine whether the transactions are valid and should the block be included in the ledger, its a multi step process which consists of
- Pre-Vote-> If more than two-thirds of the validators pre-vote for the same block (or nil), the network moves to the pre-commit phase.
- Pre-Commit -> Here, validators broadcast a pre-commit for the block they pre-voted for. If a validator did not receive the proposed block or does not consider it valid, they pre-commit for nil.
- Commit phase -> If more than two-thirds of the validators pre-commit for a specific block, the block is considered committed and is added to the blockchain. This represents the final agreement among the validators on the next block in the chain.
Some Questions
Does every app chain have its wn mempool?
- Yup, Once you send a transaction to the node closest to you its sorted and sent to the specific mempool unless its touching the hub.
Is there a different block building pipeline for every single cosmos chain?
- Not always, still figuring this out.
Are transactions executed optimistically like on solana?
Feel free to drop comments if I wrote soemthing wrong or you wanna add some suggestions. learning is a continious and open process.
Resources