A transaction refers to an action initiated by an account which changes the state of the blockchain. To effectively perform the state change, every transaction is broadcasted to the whole network. Any node can broadcast a request for a transaction to be executed on the blockchain state machine; after this happens, a validator will validate, execute the transaction and propagate the resulting state change to the rest of the network.
ante/ante.go:18-71
)txpool.ValidateTransaction()
(ante/evm/mono_decorator.go:99+
)PendingFilter
with configurable MinTip
, base fee, and transaction type filters (mempool/mempool.go:455-461
)InsertInvalidNonce()
(mempool/check_tx.go:21-23
)msg.AsTransaction()
extracts Ethereum transaction from MsgEthereumTx
(x/vm/keeper/msg_server.go:32
)ApplyTransaction()
executes EVM logic with gas isolation (x/vm/keeper/state_transition.go:165-199
)x/vm/keeper/state_transition.go:182
)MsgEthereumTx
(x/vm/types/tx.pb.go:36-43
), which contains:
From
: Ethereum signer address bytes for signature verificationRaw
: Complete Ethereum transaction datasdk.Msg
and sdk.Tx
interfaces, bypassing standard SDK transaction bundling to use go-ethereum validation logic directly.
Find more information about these two types on the following sections.
sdk.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 transactiongas
. (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:
to
address, where the contract code is sent in the data
fieldto
address is the smart contract addressrecipient
: 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 txAcceptedTxType
(ante/evm/mono_decorator.go:23-27
):
x/vm/types/tx.go:28
)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.
The MsgEthereumTx
implements both sdk.Msg
and sdk.Tx
interfaces to bypass standard Cosmos SDK transaction bundling. This design enables:
txpool.ValidateTransaction()
instead of SDK ante handlersx/vm/keeper/state_transition.go:153-164
)CheckSenderBalance()
compares account balance with transaction cost (x/vm/keeper/fees.go:24-39
)ante/evm/mono_decorator.go:88-91
)x/vm/keeper/state_transition.go:46-57
):
x/vm/keeper/state_transition.go:114-122
)x/vm/keeper/state_transition.go:67-78
):
CREATE
, CREATE2
, and CALL
operationsx/vm/keeper/state_transition.go:125
):
x/vm/keeper/msg_server.go:77-80
)crypto.CreateAddress()
(x/vm/keeper/state_transition.go:198
)gas_tip_cap
or min(gas_tip_cap, gas_fee_cap - base_fee)
(fee_amount / gas_limit) - base_fee
x/vm/keeper/state_transition.go:125-146
) includes:
Bloom Filter Computation: initializeBloomFromLogs()
creates transaction and block-level bloom filters for efficient log filtering.
Gas Reconciliation: calculateCumulativeGasFromEthResponse()
reconciles EVM gas usage with SDK gas meter state.
Dual Event Emission: Events contain both Ethereum transaction hash (for Ethereum tools) and CometBFT transaction hash (for Cosmos tools) (x/vm/keeper/msg_server.go:77-80
).
Receipt fields include:
transactionHash
: hash of the transactiontransactionIndex
: integer of the transactions index position in the blockblockHash
: hash of the block where this transaction was inblockNumber
: block number where this transaction was infrom
: address of the senderto
: address of the receiver. null when its a contract creation transactioncumulativeGasUsed
: The total amount of gas used when this transaction was executed in the blockeffectiveGasPrice
: The sum of the base fee and tip paid per unit of gasgasUsed
: The amount of gas used by this specific transaction alonecontractAddress
: The contract address created, if the transaction was a contract creation, otherwise nulllogs
: Array of log objects, which this transaction generatedlogsBloom
: Bloom filter for light clients to quickly retrieve related logstype
: integer of the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees, 0x04 for set code transactionsroot
: transaction stateroot (pre Byzantium)status
: either 1 (success) or 0 (failure)x/vm/types/tx.pb.go:36-43
- MsgEthereumTx
protobuf structure with dual interface implementationx/vm/types/tx.go:13-29
- EvmTxArgs
supporting all transaction types including EIP-7702 authorization listsante/evm/mono_decorator.go
- Consolidated EVM transaction validation with go-ethereum integrationx/vm/keeper/msg_server.go:29-47
- Message server processing and telemetryx/vm/keeper/state_transition.go:165-199
- Cache contexts, gas isolation, and EVM executionx/vm/keeper/state_transition.go:38-78
- Block context mapping and access control hooksx/vm/keeper/fees.go
- Balance verification, fee deduction, and SDK integrationmempool/mempool.go:44-70
- Unified mempool managing both EVM and Cosmos transactions with fee-based prioritizationmempool/mempool.go:455-461
- Configurable filtering by minimum tip, base fee, and transaction typesmempool/mempool.go:473-497
- Automatic EVM transaction wrapping and broadcast via MsgEthereumTx
mempool/check_tx.go:16-40
- Nonce gap detection and local queuing mechanism