What is the structure of an Ethereum transaction?

Every block in an Ethereum blockchain contains several transactions made by the users (using EOAsExternally owned accounts-These are the accounts owned by the user.). Every transaction is either a record of Ether transfer from one EOA to another or is a call to a smart contract. We can use these records to trace every Ether back to its point of creation. The basic structure of an Ethereum transaction is as follows:

An Ethereum transaction

Types of Ethereum transactions

  • Type-0 transactions (also called Legacy transactions)

  • Type-2 transactions (also called EIP-1559 transactions)

Note: Read more about the differences between these two types of transactions here.

Breaking down an Ethereum transaction

Every Ethereum transaction has the following fields:

Nonce: This is a unique identifier for every transaction. It should be consistent with the account nonce (stored in the world stateIt stores state of every account on the Ethereum blockchain.) at the transaction creation time.

It's used to prevent replay attacks on the network. For example, if someone stores a transaction made by Alice and replays the same transaction to the network. It won't work because the nonce will have to be incremented for the next transaction. Thus, the previous signature will become invalid because the data has changed and the sender should sign the transaction again with their private key. It is further explained in the following slides:

Replay attack
1 of 6

Recipient: It is the receiver's account address. It has the following three cases:

  • If the receiver is an EOA, the transaction will transfer the value (mentioned in the "value" field).

  • If the receiver is a contract account, then the transaction will execute the contract code.

  • If it is a contract deployment transaction, this field is empty.

Signature: It is used to authenticate the sender. The transaction is signed by the sender's private key.

Value: This is the amount of Wei (1 Ether = 101810^{18}Wei) to be sent to the receiver (payee) from the sender (payer).

Data: It is some arbitrary data (to be stored on the blockchain or input to a smart contract's function) or code of unlimited size. In the case of a contract deployment transaction, this field contains the byte code of the smart contract.

Gas limit: It is the maximum amount of gas units that this transaction can consume. If the gas limit is exhausted by a transaction and the transaction is still not completed, the transaction will fail, and any changes made will be reverted. Therefore, it gives extra gas to the transaction is usually a good idea, as the excess gas will eventually be refunded to the user.

Maximum priority fee per gas: This is the tip the sender is willing to pay the miner. The higher the tip, the higher the chances of your transaction being processed early. The unit of this field is Giga Wei (also known as GWei).

Maximum fee per gas: This is the maximum price per gas unit that the sender is willing to pay for this transaction. The unit of this field is Giga Wei (also known as GWei).

Chain ID: For replay protection on different chains. The ID of the main chain is 1.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved