Ante handler

Ante handler checks and validates the transaction. After the verification, it checks the balance of the sender for enough fees and deduct fees in case of successful transaction inclusion.

Gas limit

Each block and transaction have a limit for gas usage. A block can contain multiple transactions. But, gas used by all transactions in a block must be less than block gas limit to avoid larger blocks.

block.GasLimit >= sum(tx1.GasUsed + tx2.GasUsed + ..... + txN.GasUsed)

Note that each state manipulation on transaction costs gas, including signature verification for the transaction.

Block gas limit

Max block gas limit and bytes per block is passed while setting up app's consensus params:

maxGasPerBlock int64 = 10000000 // 10 Million
maxBytesPerBlock int64 = 22020096 // 21 MB
// pass consensus params
ConsensusParams: &abci.ConsensusParams{
Block: &abci.BlockParams{
MaxBytes: maxBytesPerBlock,
MaxGas: maxGasPerBlock,

Transaction gas limit

The transaction gas limit is defined in params in auth module. It can be changed through the Heimdall gov module.

Checkpoint TX gas limit

Since block contains multiple transactions and verifies this particular transaction on the Ethereum chain, Merkle proof is required. To avoid extra Merkle proof verification for checkpoint transaction, Heimdall only allows one transaction in the block if the transaction type is MsgCheckpoint

// fee wanted for checkpoint transaction
gasWantedPerCheckpoinTx sdk.Gas = 10000000 // 10 Million
// checkpoint gas limit
if stdTx.Msg.Type() == "checkpoint" && stdTx.Msg.Route() == "checkpoint" {
gasForTx = gasWantedPerCheckpoinTx

Transaction verification and replay protection

Ante handler handles and verifies signature in incoming transaction:

Each transaction must include sequenceNumber to avoid replay attacks. After each successful transaction inclusion, Ante handler increases the sequence number for the TX sender account to avoid duplication (replay) of the previous transactions.

Last updated on