# Messages

# MsgEthereumTx

An EVM state transition can be achieved 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 of this, is because 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.

Copy // MsgEthereumTx encapsulates an Ethereum transaction as an SDK message. type MsgEthereumTx struct { Data TxData // caches size atomic.Value from atomic.Value }

Copy // TxData implements the Ethereum transaction data structure. It is used // solely as intended in Ethereum abiding by the protocol. type TxData struct { AccountNonce uint64 `json:"nonce"` Price *big.Int `json:"gasPrice"` GasLimit uint64 `json:"gas"` Recipient *ethcmn.Address `json:"to" rlp:"nil"` // nil means contract creation Amount *big.Int `json:"value"` Payload []byte `json:"input"` // signature values V *big.Int `json:"v"` R *big.Int `json:"r"` S *big.Int `json:"s"` // hash is only used when marshaling to JSON Hash *ethcmn.Hash `json:"hash" rlp:"-"` }

This message validation is expected to fail if:

  • Data.Price (i.e gas price) is ≤ 0.
  • Data.Amount is negative

The transaction execution is expected to fail if:

  • Any of the custom AnteHandler Ethereum decorators checks fail:
    • Minimum gas amount requirements for transaction
    • Tx sender account doesn't exist or hasn't enough balance for fees
    • Account sequence doesn't match the transaction Data.AccountNonce
    • Message signature verification fails
  • EVM contract creation (i.e evm.Create) fails, or evm.Call fails