Skip to main content

Transaction Composition in Cosmos

In Cosmos, a transaction is composed of multiple messages (think of it as native multicall), with the caller deciding how they want to sequence their messages in the transaction. The signature is done on the entire Cosmos transaction. This allows for atomic operations where multiple actions can be combined in a single transaction.

EVM Transactions

EVM Message Format

  • Must be alone in a transaction
  • Cannot be combined with other Cosmos message types
  • This is due to the signature being done on the EVM message (equivalent to a normal EVM transaction in Ethereum) instead of the entire Cosmos transaction
  • Signature follows Ethereum’s EIP-155 format
Example:

Why This Design?

EVM Transaction Format

EVM transactions use Ethereum’s transaction format:
  • Signature is on the EVM transaction itself
  • Follows EIP-155 signature scheme
  • Compatible with Ethereum tooling and wallets
  • Standard EVM transaction behavior

Transaction Sequencing

Transaction sequencing is solely dependent on the block proposer, but the default is FIFO (First In, First Out).

Block Proposer Role

The block proposer (validator) decides:
  • Which transactions to include
  • The order of transactions
  • Transaction prioritization

Default Behavior

By default, transactions are processed in FIFO order:
  1. Transactions are added to the mempool
  2. Block proposer selects transactions in order
  3. Transactions execute sequentially

EVM Transaction Isolation

EVM transactions are isolated:
  • Each EVM transaction is independent
  • Cannot combine with other message types
  • Standard Ethereum transaction behavior
  • Each transaction executes atomically (succeeds or reverts entirely)

Practical Implications

For Developers

EVM:
  • One operation per transaction
  • Standard Ethereum behavior
  • Compatible with existing EVM tooling
  • Use multicall contracts for batching multiple operations

For Users

EVM:
  • One operation per transaction
  • Familiar Ethereum experience
  • Standard gas costs
  • Predictable transaction behavior

Example Scenario

Swap and Stake (EVM)

Using Multicall for Batching

For batching multiple operations, consider using a multicall contract:

Best Practices

For EVM Developers

  • Design contracts to minimize transaction dependencies
  • Use standard EVM patterns
  • Consider using multicall contracts for batching operations
  • Each transaction executes atomically (succeeds or reverts entirely)

Next Steps