On-chain data analysis involves interpreting behavior, intent, and trading psychology based on raw data. Behavior can refer to trader actions, contract operations, or broader market movements. By assessing trader intent and observing patterns over time, analysts can deduce underlying psychological drivers. Similarly, analyzing contract behavior reveals the intentions of developers or project teams—code doesn’t lie. Ultimately, evaluating specific behaviors and intents helps gauge overall market sentiment and expectations.
At the heart of on-chain data lies transaction information. This article breaks down Ethereum transaction data, starting from fundamental concepts and moving into advanced details. We’ll use Ethereum’s operational principles as a baseline to interpret transaction data as displayed on blockchain explorers.
We’ve categorized key concepts into three tiers based on complexity:
- Level 1: Regular Transactions | Contract Transactions
- Level 2: Externally Owned Accounts (EOAs) | Contract Accounts | Internal Transactions
- Level 3: Transfer | Transaction | Events | Logs
Types of Ethereum Transactions
Ethereum transactions can be broadly divided into two types: transactions between externally owned accounts (EOAs) and contract transactions.
A regular address transaction involves the transfer of Ethereum’s native token (ETH) without any smart contract interaction or other token transfers. Key components of such a transaction include:
- Transaction Index: Identifying details like transaction hash and timestamp.
- Transaction Amount: The quantity of ETH transferred.
- Sender and Receiver: The parties involved in the transaction.
- Gas Fees: The transaction cost borne by the sender.
In contrast, a contract transaction includes additional elements:
- Internal transaction processes.
- Results of token transfers.
- Input data used for contract execution.
Contract transaction pages on explorers also feature extra tabs, such as Internal Transactions and Event Logs.
So, what are internal transactions? Why do regular address transactions lack this tab? How should one interpret the information under this tab? And what distinguishes an internal transaction from a regular transaction?
To answer these questions, we must first understand two core concepts: externally owned accounts and contract accounts.
Externally Owned Accounts vs. Contract Accounts
Ethereum addresses are categorized into two types: externally owned accounts (EOAs) and contract accounts.
EOAs are controlled by private keys and are owned by users. Contract accounts, on the other hand, are not directly accessible like wallets; they can only be interacted with by calling their functions.
EOAs act as bridges between the external world and the Ethereum ecosystem. They are the primary drivers of state changes on the blockchain. When a transaction is initiated from an EOA to a smart contract, the input data included in the transaction serves as parameters for contract methods. The execution of these methods may trigger further contract calls, creating a chain of interactions known as internal transactions.
For example, in a typical contract interaction:
- An EOA sends a transaction to a contract address.
- The contract executes a method based on the input data.
- This execution may call other contracts, resulting in internal transactions.
It’s important to note that internal transactions involving ETH transfers are not stored directly on the blockchain. Instead, only the resulting state changes are recorded. However, details of these internal processes are often displayed by blockchain explorers for transparency.
Transfers vs. Transactions
The terms transfer and transaction are often used interchangeably, but they have distinct meanings in the Ethereum context.
- A transfer typically refers to the movement of tokens, which can involve native ETH or other standard tokens like ERC-20 or ERC-721 tokens.
- A transaction refers to a request submitted by an EOA to miners. If included in a block and validated, the transaction is executed; otherwise, it fails.
A transaction request includes several pieces of information:
- Recipient (To): The target address for the transaction. If left empty, the transaction deploys a new contract using the input data.
- Value: The amount of ETH to be transferred.
- Input Data: Parameters for smart contract execution.
How Do Contracts Interpret Method Calls?
When an EOA sends a transaction to a contract, the contract must determine which method to execute. This is done by parsing the input data.
The first 8 characters of the input data (after removing the ‘0x’ prefix) represent the method identifier, which is derived by applying the SHA-3 hash algorithm to the method signature and taking the first 8 bytes. The remaining data contains the parameters for the method.
For example, a method identifier might correspond to a function like:
swap(string aggregatorId, address tokenFrom, uint256 amount, bytes data)Since smart contract methods can be reused across different contracts, the same method identifier may appear in multiple contracts.
Event Logs: What Are They and Why Are They Important?
Smart contracts can define and emit events—special structures that record specific occurrences during contract execution. These events are stored in logs, which are included in the transaction receipt.
Events serve two primary purposes:
- Off-Chain Notification: Events allow external applications (like wallets or DApps) to be notified of on-chain occurrences. For instance, when you receive tokens, your wallet may alert you based on an emitted event.
- Cost-Efficient Storage: Storing data in logs is significantly cheaper than storing it in contract variables. Log storage costs approximately 8 gas per byte, compared to 625 gas per byte for contract storage.
A log entry typically includes:
- Indexed Topics: Up to four topics, with Topic0 usually containing the hash of the event signature.
- Data: Additional unindexed information related to the event.
For example, a Sync event in a liquidity pool contract might record reserve values, and this event would be emitted whenever reserves change.
Frequently Asked Questions
Q: What is the difference between an internal transaction and a regular transaction?
A: A regular transaction is initiated by an EOA and recorded on-chain. An internal transaction represents a sub-call within a contract execution and is not directly stored on the blockchain—only its results are.
Q: Can smart contracts access data from event logs?
A: No, smart contracts cannot read event logs. Events are designed for off-chain use cases, such as notifying external applications about on-chain activities.
Q: Why are some parameters in events indexed?
A: Indexing parameters in events allows for efficient filtering and querying. Indexed fields are stored in topics, making it easier to search for specific events.
Q: How can I decode input data in a transaction?
A: Input data can be decoded using tools that recognize method identifiers. The first 8 bytes of the input data correspond to the method identifier, and the rest represents parameters.
Q: Are internal transactions free?
A: No, internal transactions consume gas just like regular transactions. The gas cost depends on the complexity of the operations performed.
Q: What is the most common type of event on Ethereum?
A: Transfer events for ERC-20 tokens are among the most frequently emitted events on the network.
Conclusion
In this article, we explored the two primary types of Ethereum transactions: regular address transactions and contract transactions. Both involve transaction indices, counterparties, transfer amounts, and costs. However, contract transactions include additional layers, such as internal processes and event logs.
While regular transactions are straightforward, contract transactions involve complex execution chains. Only the initial contract call is recorded on-chain; internal transactions are not stored directly, though their results are reflected in state changes. Events provide a cost-effective way to record and notify off-chain systems about on-chain activities.
By understanding these concepts, you can better interpret Ethereum transaction data and gain deeper insights into on-chain behavior. 👉 Explore advanced on-chain analysis techniques