Transactions
This section defines the sdk.Msg concrete types that result in the state transitions defined on the previous section.
MsgEthereumTx
MsgEthereumTxAn EVM state transition can be achieved by using the MsgEthereumTx. This message encapsulates an Ethereum transaction data (TxData) as a sdk.Msg.
It contains the necessary transaction data fields. Note, that the MsgEthereumTx implements both the sdk.Msg and sdk.Tx interfaces. Normally, SDK messages only implement the former, while the latter is a group of messages bundled together.
type MsgEthereumTx struct {
// inner transaction data
Data *types.Any `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
// DEPRECATED: encoded storage size of the transaction
Size_ float64 `protobuf:"fixed64,2,opt,name=size,proto3" json:"-"`
// transaction hash in hex format
Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty" rlp:"-"`
// ethereum signer address in hex format. This address value is checked
// against the address derived from the signature (V, R, S) using the
// secp256k1 elliptic curve
From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"`
}This message field validation is expected to fail if:
Fromfield is defined and the address is invalidTxDatastateless validation fails
The transaction execution is expected to fail if:
Any of the custom
AnteHandlerEthereum 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.AccountNonceMessage signature verification fails
EVM contract creation (i.e
evm.Create) fails, orevm.Callfails
Conversion
The MsgEthreumTx can be converted to the go-ethereum Transaction and Message types in order to create and call evm contracts.
Signing
In order for the signature verification to be valid, the TxData must contain the v | r | s values from the Signer. Sign calculates a secp256k1 ECDSA signature and signs the transaction. It takes a keyring signer and the chainID to sign an Ethereum transaction according to EIP155 standard.
This method mutates the transaction as it populates the V, R, S fields of the Transaction's Signature. The function will fail if the sender address is not defined for the msg or if the sender is not registered on the keyring.
TxData
The MsgEthereumTx supports the 3 valid Ethereum transaction data types from go-ethereum: LegacyTx, AccessListTx and DynamicFeeTx. These types are defined as protobuf messages and packed into a proto.Any interface type in the MsgEthereumTx field.
LegacyTx: EIP-155 transaction typeDynamicFeeTx: EIP-1559 transaction type. Enabled by London hard fork blockAccessListTx: EIP-2930 transaction type. Enabled by Berlin hard fork block
LegacyTx
LegacyTxThe transaction data of regular Ethereum transactions.
This message field validation is expected to fail if:
GasPriceis invalid (nil, negaitve or out of int256 bound)Fee(gasprice * gaslimit) is invalidAmountis invalid (negaitve or out of int256 bound)Toaddress is invalid (non valid ethereum hex address)
DynamicFeeTx
DynamicFeeTxThe transaction data of EIP-1559 dynamic fee transactions.
This message field validation is expected to fail if:
GasTipCapis invalid (nil, negative or overflows int256)GasFeeCapis invalid (nil, negative or overflows int256)GasFeeCapis less thanGasTipCapFee(gas price * gas limit) is invalid (overflows int256)Amountis invalid (negative or overflows int256)Toaddress is invalid (non-valid ethereum hex address)ChainIDisnil
AccessListTx
AccessListTxThe transaction data of EIP-2930 access list transactions.
This message field validation is expected to fail if:
GasPriceis invalid (nil, negative or overflows int256)Fee(gas price * gas limit) is invalid (overflows int256)Amountis invalid (negative or overflows int256)Toaddress is invalid (non-valid ethereum hex address)ChainIDisnil
Last updated