Understanding Ethereum Transactions and Messages

·

Transactions and messages are fundamental concepts within the Ethereum ecosystem. While they appear similar in structure, they serve distinct purposes and operate under different rules. This article clarifies the differences between transactions, messages, and message calls, providing a clear overview of their roles and technical characteristics.

What Is an Ethereum Transaction?

A transaction refers to a cryptographically signed data package initiated by an external actor (such as a user) and broadcast to the Ethereum network. It facilitates the transfer of value or data between accounts and can trigger smart contract functions or even create new contracts.

A valid Ethereum transaction includes the following components:

There are two primary types of transactions:

Key Transaction Fields

According to the Ethereum Yellow Paper, a standard transaction consists of these fields:

For contract creation transactions, the following fields are also included:

What Is a Message?

A message is a virtual object generated internally within the Ethereum network—typically by a smart contract. Unlike transactions, messages are not directly signed by external users and are not permanently recorded on the blockchain.

A message usually contains:

Messages can be understood as function calls within the EVM. They facilitate communication between contracts and enable complex, interoperable logic across decentralized applications.

Differences Between Transactions, Messages, and Message Calls

The Ethereum Yellow Paper offers formal definitions for these terms:

Transaction: “A piece of data, signed by an External Actor. It represents either a Message or a new Autonomous Object. Transactions are recorded into each block of the blockchain.”

Message: “Data (as a set of bytes) and Value (specified as Ether) that is passed between two Accounts, either through the deterministic operation of an Autonomous Object or the cryptographically secure signature of the Transaction.”

Message Call: “The act of passing a message from one Account to another. If the destination account is associated with non-empty EVM Code, then the VM will be started with the state of said Object and the Message acted upon.”

In practical terms:

👉 Explore real-time transaction tools

Are Contract Function Calls Treated as Transactions or Messages?

Consider the following scenarios:

  1. Directly calling a contract function using call
  2. Using sendTransaction to invoke a contract function
  3. Calling a contract function from another contract using call
  4. Using sendTransaction to call a contract function from another contract

Cases 1 and 3 are message calls—they are internal, read-only, and do not alter blockchain state. Case 2 creates a transaction since it uses a method intended for external signing and broadcasting.

Case 4 is more nuanced. Although sendTransaction is used, the call originates from a contract rather than an external actor. According to the Yellow Paper, a transaction must be signed by an external actor. Thus, this scenario does not qualify as a transaction.

Frequently Asked Questions

What is the main functional difference between a transaction and a message?
Transactions are signed, broadcasted, and permanently recorded on-chain. Messages are internal signals between contracts, not signed or stored on the blockchain.

Can a message transfer Ether like a transaction?
Yes. Messages can carry Ether value between contracts, just like transactions. However, messages are initiated by contracts rather than external accounts.

Why is gas required for transactions but not always for messages?
All transactions require gas because they modify blockchain state. Message calls that are read-only (using call) do not consume gas since they don’t alter state. However, messages that change state do require gas.

How do I decide between using call or sendTransaction?
Use call for read-only operations that don’t require gas. Use sendTransaction when you want to change the state of the blockchain, which requires gas and a signature.

Are messages secure?
Messages are executed within the EVM under predefined rules, making them deterministic and tamper-resistant. However, the security of a message depends on the correctness of the smart contract code.

Can messages be reversed?
Since messages are part of contract execution, they can be reverted if the overall transaction fails. Once a transaction is confirmed, however, it cannot be reversed.

👉 Get advanced Ethereum methods