Skip to Content
EVMTransaction Overview

Transactions

Sei supports EVM transactions, allowing compatibility with Ethereum-based tools and contracts. Transactions are signed messages originating from an externally owned account (EOA) that trigger state changes on the blockchain.

Transaction Lifecycle

StageDescription
1. CreationA transaction is created by an EOA, specifying the recipient, value, gas parameters, and other fields.
2. SigningThe transaction is signed with the sender’s private key to create a valid signature.
3. SubmissionThe signed transaction is submitted to the network through an RPC endpoint.
4. MempoolThe transaction enters the mempool (transaction pool) where it awaits inclusion in a block.
5. ExecutionWhen selected by a validator, the transaction is executed in the EVM, causing state changes.
6. ValidationThe transaction and its state changes are validated by the consensus mechanism.
7. ConfirmationOnce validated, the transaction is included in a block and confirmed on-chain.
8. FinalityOn Sei, transactions achieve immediate finality once included in a block.

Unlike other EVM chains where you need to wait for multiple confirmations, Sei’s consensus mechanism provides immediate transaction finality. Once a transaction is included in a block, it cannot be reversed.

Gas Mechanics

Gas is a unit of computational work in the EVM that helps prevent spam and allocate resources efficiently:

TermDescription
Gas LimitThe maximum amount of gas the transaction may consume, set by the sender.
Base FeeThe minimum gas price required to be included in a block (burnt by the protocol).
Priority FeeAn additional fee (tip) paid to validators for faster inclusion.
Gas PriceIn legacy transactions, the price per unit of gas the sender is willing to pay.
Effective Gas PriceThe actual price paid per unit of gas (base fee + priority fee in EIP-1559).
Gas Requirements for Common Operations
  • Simple SEI transfer: 21,000 gas
  • ERC-20 transfer: ~45,000 gas
  • Contract deployment: Varies based on contract size and complexity
  • Always estimate gas before sending transactions using eth_estimateGas

Transaction Structure

EVM transactions in Sei follow the Ethereum transaction format with standard properties:

PropertyDescription
fromThe address of the sender who will sign the transaction. This must be an externally-owned account (EOA) as contract accounts cannot send transactions.
toThe receiving address. If this is an EOA, the transaction transfers value. If a contract address, the transaction executes the contract code. If empty or null, the transaction creates a new contract.
signatureThe cryptographic signature generated when the sender’s private key signs the transaction. This confirms the sender has authorized the transaction and includes the v, r, and s components.
nonceA sequentially incrementing counter that indicates the transaction number from the account. This prevents replay attacks and ensures transaction ordering.
dataThe input data (also called ‘input’ or ‘calldata’) for contract execution. For simple transfers, this is usually empty. For contract interactions, this contains the function selector and encoded arguments.
valueAmount of SEI to transfer from sender to recipient (denominated in WEI, where 1 SEI equals 1e+18 WEI).
gasLimitThe maximum amount of gas units that can be consumed by the transaction. Often referred to simply as ‘gas’ in transaction objects.
maxPriorityFeePerGasThe maximum price of the consumed gas to be included as a tip to the validator (denominated in WEI). Used in EIP-1559 transactions.
maxFeePerGasThe maximum fee per unit of gas willing to be paid for the transaction (inclusive of baseFeePerGas and maxPriorityFeePerGas). Used in EIP-1559 transactions.
gasPriceThe price per unit of gas the sender is willing to pay (denominated in WEI). Used in legacy transactions.
chainIdThe chain identifier number. Prevents transaction reuse across different chains.
accessListA list of addresses and storage keys that the transaction plans to access. Used in EIP-2930 and EIP-1559 transactions to reduce gas costs for accessing specified addresses and storage slots.
typeThe transaction type: 0 for legacy (pre-EIP-2718), 1 for EIP-2930 access list transactions, and 2 for EIP-1559 fee market transactions.
hashThe transaction hash, a unique identifier for the transaction generated after signing.

Transaction Guidelines

Transaction Best Practices
  • Set appropriate gas parameters: Use network conditions to estimate optimal values for maxFeePerGas and maxPriorityFeePerGas.

  • Manage nonces carefully: Track and increment nonces correctly to avoid transaction failures.

  • Use typed transactions: Prefer EIP-1559 transactions (type 2) for more predictable fees.

  • Implement proper error handling: Account for potential transaction failures and revert reasons.

  • Verify recipient addresses: Always double-check destination addresses, as transactions cannot be reversed.

Common IssueCauseSolution
Transaction UnderpricedGas price or priority fee too lowIncrease maxFeePerGas and maxPriorityFeePerGas
Nonce Too LowUsing a nonce that’s already been usedQuery current nonce with getTransactionCount
Out of GasGas limit too low for the operationUse eth_estimateGas to set appropriate limit
Contract Execution FailedContract function revertedTest with eth_call before sending transaction

Additional Resources

Last updated on