logoAcademy

Transactions and Blocks

Learn about another fundamental aspect of the Ethereum ecosystem - Transactions and Blocks.

Transactions

In the EVM, a transaction is the smallest unit of work that can be included in a block. It represents a state transition, modifying account data and transferring Ether across the network.

Transactions can either transfer Ether or invoke smart contracts. Each transaction includes the following components:

  • Nonce: A unique value set by the sender to ensure the transaction is processed only once, preventing replay attacks.
  • Gas Price: The amount the sender is willing to pay per unit of gas, typically measured in nanoAvax (1 nAvax = 1/(10^9) Avax). It consists of three parts:
    • Base Gas Fee: The minimum nAvax required per unit of gas.
    • Maximum Priority Gas Fee: Additional nAvax the sender is willing to pay on top of the base fee.
    • Maximum Total Gas Fee: The maximum nAvax the sender is willing to spend per unit of gas. If the sum of the base gas fee and the priority gas fee exceeds this amount, the gas price paid will be capped at the maximum total gas fee.
  • Gas Limit: The maximum amount of gas units the sender is willing to pay for executing the transaction. If this limit is reached, the transaction fails, preventing indefinite execution.
  • To: The recipient's Ethereum address or the target smart contract.
  • V, R, S: Cryptographic data used to create the sender's signature.

Blocks

A block in the EVM is a bundle of validated transactions, grouped together and linked to the previous block. Each block contains:

  • Block Number: The index of the block, representing its position in a zero-indexed linked list.
  • Timestamp: The time the block was mined.
  • Transactions Root: The Merkle root of all transactions within the block.
  • Receipts Root: The Merkle root of all transaction receipts.
  • State Root: A hash of the entire Ethereum state after executing all transactions in the block.
  • Parent Hash: The hash of the previous (parent) block.
  • Gas Limit: The maximum gas all transactions in the block can consume.
  • Gas Used: The total gas consumed by all transactions in the block.
  • Extra Data: An optional field for including arbitrary data up to 32 bytes.
  • Validator: The address of the node that proposed the block.

On this page