- A transaction hash is cryptographically generated.
- The transaction is validated through CheckTx and added to the mempool (see Transaction Ordering below).
- The transaction is broadcasted to the network peers (only if immediately executable).
- A validator selects your transaction for inclusion in a block based on fee prioritization.
- The transaction is executed and the state change is committed.
For detailed transaction flow and mempool behavior, see the Mempool documentation and Cosmos SDK lifecycle.
Transaction Types
Cosmos EVM supports two transaction types:- Cosmos transactions
- Ethereum transactions
sdk.Msg
contained in an auth.StdTx
. All relevant Ethereum transaction information is contained in this message. This includes the signature, gas, payload, etc.
Find more information about these two types on the following sections.
Cosmos Transactions
On Cosmos chains, transactions are comprised of metadata held in contexts andsdk.Msg
s that trigger state changes within a module through the module’s Protobuf Msg service.
When users want to interact with an application and make state changes (e.g. sending coins), they create transactions. Cosmos transactions can have multiple sdk.Msg
s. Each of these must be signed using the private key associated with the appropriate account(s), before the transaction is broadcasted to the network.
A Cosmos transaction includes the following information:
Msgs
: an array of msgs (sdk.Msg
)GasLimit
: option chosen by the users for how to calculate how much gas they will need to payFeeAmount
: max amount user is willing to pay in feesTimeoutHeight
: block height until which the transaction is validSignatures
: array of signatures from all signers of the txMemo
: a note or comment to send with the transaction
Ethereum Transactions
Ethereum transactions refer to actions initiated by EOAs (externally-owned accounts, managed by humans), rather than internal smart contract calls. Ethereum transactions transform the state of the EVM and therefore must be broadcasted to the entire network. Ethereum transactions also require a fee, known asgas
. (EIP-1559) introduced the idea of a base fee, along with a priority fee which serves as an incentive for validators to include specific transactions in blocks.
There are several categories of Ethereum transactions:
- regular transactions: transactions from one account to another
- contract deployment transactions: transactions without a
to
address, where the contract code is sent in thedata
field - execution of a contract: transactions that interact with a deployed smart contract, where the
to
address is the smart contract address
recipient
: receiving addresssignature
: sender’s signaturenonce
: counter of tx number from accountvalue
: amount of ETH to transfer (in wei)data
: include arbitrary data. Used when deploying a smart contract or making a smart contract method callgasLimit
: max amount of gas to be consumedmaxPriorityFeePerGas
: mas gas to be included as tip to validatorsmaxFeePerGas
: max amount of gas to be paid for tx
Note: Unprotected legacy transactions are not supported by default.
- Dynamic Fee Transactions (EIP-1559)
- Access List Transactions (EIP-2930)
- Legacy Transactions (EIP-2718)
sdk.Msg
. It achieves this by using the MsgEthereumTx
. This message encapsulates an Ethereum transaction as an SDK message and contains the necessary transaction data fields.
One remark about the MsgEthereumTx
is that it implements both the sdk.Msg
and sdk.Tx
interfaces (generally SDK messages only implement the former, while the latter is a group of messages bundled together). The reason for this is that the MsgEthereumTx
must not be included in a auth.StdTx
(SDK’s standard transaction type) as it performs gas and fee checks using the Ethereum logic from Geth instead of the Cosmos SDK checks done on the auth module AnteHandler
.
Ethereum Tx Type
There are three types of transaction types used in Cosmos EVM’s Go Ethereum implementation that came from Ethereum Improvement Proposals(EIPs):- LegacyTxType (EIP-155): The LegacyTxType represents the original transaction format that existed before Ethereum Improvement Proposal (EIP) 155. These transactions do not include a chain ID, which makes them vulnerable to replay attacks. EIP-155 was introduced to solve this problem by incorporating a chain ID, which uniquely identifies a specific Ethereum chain to prevent cross-chain replay attacks.
- AccessListTxType (EIP-2930): AccessListTxType was introduced with EIP-2930 as part of the Berlin upgrade. This new transaction type allows users to specify an access list – a list of addresses and storage keys that the transaction plans to access. The primary goal of access lists is to mitigate some of the gas cost increases introduced with EIP-2929, which increased gas costs for state access operations to improve denial-of-service (DoS) attack resistance. By specifying an access list, users can avoid paying higher gas costs for subsequent accesses to the same addresses and storage keys within the same transaction.
- DynamicFeeTxType (EIP-1559): DynamicFeeTxType was introduced with EIP-1559 as part of the London upgrade. This transaction type brought significant changes to Ethereum’s fee market, with the aim of making gas fees more predictable and improving user experience. EIP-1559 transactions include two main components: a base fee and a priority fee (or tip). The base fee is algorithmically determined by the network, while the priority fee is set by users to incentivize miners to include their transaction. The base fee is burned, effectively reducing the overall ETH supply, while the priority fee goes to miners as a reward for their work. DynamicFeeTxType transactions allow for more predictable and efficient gas fee management.
Interchain Transactions
Interchain transactions refer to the transfer of digital assets or data between two or more different blockchain networks. Each blockchain network has its own unique protocol and data structure, making it difficult to directly transfer assets or data from one blockchain to another. Interchain transactions allow for the transfer of assets and data between different blockchains by using intermediary mechanisms or protocols. One such mechanism is a cross-chain bridge, which acts as a connector between different blockchains, enabling the transfer of assets or data. Cross-chain bridges typically require some form of trust or consensus mechanism to ensure the security and integrity of the transaction. Another possibility is to use the IBC (Inter-Blockchain Communication) protocol. To make an interchain transaction using IBC a user needs to:- Choose the source and destination blockchain networks that the user wants to transfer assets or data between.
- Ensure that both blockchain networks have implemented the IBC protocol
- Ensure there’s a connection and channel established between the two blockchain networks using IBC
- Initiate the transfer of assets or data: this is done by sending a transaction from the source blockchain to the destination blockchain through the IBC channel
Transaction Ordering and Prioritization
In Cosmos EVM, both Ethereum and Cosmos transactions compete fairly for block inclusion:Transactions are ordered by their effective tips:
- Ethereum:
gas_tip_cap
ormin(gas_tip_cap, gas_fee_cap - base_fee)
- Cosmos:
(fee_amount / gas_limit) - base_fee
- Higher tips = higher priority, regardless of transaction type
For detailed mempool behavior and flow diagrams, see Mempool Architecture.
Transaction Receipts
A transaction receipt shows data returned by an Ethereum client to represent the result of a particular transaction, including a hash of the transaction, its block number, the amount of gas used, and, in case of deployment of a smart contract, the address of the contract. Additionally, it includes custom information from the events emitted in the smart contract. A receipt contains the following information:transactionHash
: hash of the transaction.transactionIndex
: integer of the transactions index position in the block.blockHash
: hash of the block where this transaction was in.blockNumber
: block number where this transaction was in.from
: address of the sender.to
: address of the receiver. null when its a contract creation transaction.cumulativeGasUsed
: The total amount of gas used when this transaction was executed in the block.effectiveGasPrice
: The sum of the base fee and tip paid per unit of gas.gasUsed
: The amount of gas used by this specific transaction alone.contractAddress
: The contract address created, if the transaction was a contract creation, otherwise null.logs
: Array of log objects, which this transaction generated.logsBloom
: Bloom filter for light clients to quickly retrieve related logs.type
: integer of the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees. It also returns either.root
: transaction stateroot (pre Byzantium)status
: either 1 (success) or 0 (failure)