跳到主要内容

Transaction Lifecycle

This page traces a transaction's journey from creation to finality on Monolythium. Both Cosmos SDK transactions and EVM transactions follow distinct paths that converge at state commitment.


Cosmos Transaction Flow

 ┌──────────────────────────────────────────────────────────────┐
│ 1. CREATE & SIGN │
│ Client builds MsgSend/MsgDelegate/etc. │
│ Signs with EthSecp256k1 key │
│ Wraps in Tx with fee, gas limit, memo │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 2. BROADCAST │
│ Submitted via Cosmos RPC (broadcast_tx_sync/async/commit)│
│ Node receives and runs CheckTx │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 3. MEMPOOL │
│ Passes basic validation (signature, sequence, min fee) │
│ Sits in mempool until proposer includes it in a block │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 4. ANTE HANDLERS (in order) │
│ ├── SetupContext Set gas meter │
│ ├── ValidateBasic Check message structure │
│ ├── ValidateMemo Enforce memo length limit │
│ ├── DeductFeeDecorator Deduct fee from sender │
│ ├── x/burn FeeHandler Split: 90% burn, 10% proposer │
│ ├── SigVerification Verify EthSecp256k1 signature │
│ ├── IncrementSequence Bump account sequence (nonce) │
│ └── x/validator Check (if MsgRegisterValidator) │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 5. EXECUTION │
│ Message handler runs (bank.Send, staking.Delegate, etc.) │
│ State changes written to transient store │
│ Events emitted │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 6. STATE COMMIT │
│ Block is proposed by the current proposer │
│ Other validators prevote and precommit │
│ 2/3+ validators sign → block committed │
│ State changes persisted to disk │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 7. FINALITY (INSTANT) │
│ Block is final once committed. No reorgs, no rollbacks. │
└──────────────────────────────────────────────────────────────┘

Ante Handler Details

Ante handlers are middleware that run before message execution. They form a chain and each must pass for the transaction to proceed.

HandlerPurposeFailure Mode
SetupContextInitialize gas meter with the tx gas limit--
ValidateBasicCheck message fields are well-formedReject malformed messages
ValidateMemoEnforce max memo length (256 bytes)Reject oversized memos
DeductFeeDecoratorDeduct the fee from the sender's balanceReject if insufficient balance
x/burn FeeHandlerRoute 90% of the deducted fee to the burn address, 10% to the block proposer--
SigVerificationVerify the EthSecp256k1 signature against the signing bytesReject invalid signatures
IncrementSequenceBump the sender's account sequence (prevents replay)--
x/validator CheckFor MsgRegisterValidator: verify 100K LYTH burn deposit + 100K self-delegationReject insufficient deposit

EVM Transaction Flow

 ┌──────────────────────────────────────────────────────────────┐
│ 1. CREATE & SIGN │
│ Build EVM tx (to, value, data, gasLimit, gasPrice) │
│ Sign with ECDSA (same key, 0x-prefixed address) │
│ Encode as raw transaction bytes │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 2. BROADCAST │
│ Submitted via eth_sendRawTransaction │
│ Node decodes and validates basic fields │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 3. EVM MEMPOOL │
│ Nonce check, gas price check, balance check │
│ Queued until included in a block by the proposer │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 4. EVM EXECUTION │
│ Wrapped as a Cosmos MsgEthereumTx │
│ EVM state transition: run bytecode, update storage │
│ Gas consumed, logs emitted │
│ Fees processed through x/burn (90/10 split) │
└──────────────────────┬───────────────────────────────────────┘


┌──────────────────────────────────────────────────────────────┐
│ 5. STATE COMMIT & FINALITY │
│ Same BFT consensus as Cosmos transactions │
│ EVM state root included in block header │
│ Instant finality once committed │
└──────────────────────────────────────────────────────────────┘

EVM-Cosmos Bridge

Internally, EVM transactions are wrapped in a Cosmos MsgEthereumTx message. This means:

  1. EVM transactions go through the same BFT consensus as native Cosmos transactions.
  2. Gas fees from EVM transactions are subject to the same x/burn 90/10 split.
  3. The EVM nonce and Cosmos account sequence are kept in sync.
  4. EVM state (contract storage, balances) and Cosmos state (staking, governance) share the same committed state.

Instant Finality

Monolythium uses LythiumBFT consensus, which provides instant finality. Once a block is committed (2/3+ validator signatures), it is permanent.

PropertyValue
Finality typeInstant (single-block)
Reorgs possibleNo
Confirmation requirement1 block
Average block time~3 seconds

This means:

  • No confirmation waiting: Unlike Ethereum (12-15 confirmations) or Bitcoin (6 confirmations), a single committed block is final.
  • No uncle/ommer blocks: Every committed block is canonical.
  • Safe for exchanges: Deposits can be credited after 1 block confirmation.
Exchange Integration

Monolythium's instant finality means exchanges and services can safely credit deposits after a single block confirmation. See Exchange Integration.


Transaction Status

Cosmos

# Query transaction by hash
monod query tx <txhash> --output json

# Check if transaction was successful
monod query tx <txhash> --output json | jq '.code'
# code 0 = success, any other value = failure

EVM

const receipt = await provider.getTransactionReceipt(txHash);

if (receipt === null) {
console.log("Transaction pending or not found");
} else if (receipt.status === 1) {
console.log("Transaction succeeded, block:", receipt.blockNumber);
} else {
console.log("Transaction reverted");
}

Status Codes

Cosmos CodeMeaning
0Success
2Tx parse error
5Insufficient funds
11Out of gas
13Insufficient fee
19Tx already in mempool
32Account sequence mismatch

Common Failure Modes

FailureCauseSolution
Out of gasGas limit too lowIncrease --gas-adjustment or set higher gas limit
Insufficient fundsBalance below fee + amountFund the account
Sequence mismatchStale nonce (concurrent txs)Query latest sequence and retry
Signature verification failedWrong chain ID or keyVerify --chain-id matches the network
EVM execution revertedContract logic rejected the callCheck revert reason with debug_traceTransaction