How to Use Ethereum: Surfing Ethereum Transactions
The Ethereum network is a blockchain-powered world computer. Millions of users access this world computer by creating accounts on the Ethereum blockchain and running programs on its execution layer, the Ethereum Virtual Machine (EVM).
An Ethereum block comprises a diverse and complex matrix of on-chain interactions, spanning multi-million dollar token transfers, smart contract calls across an intricate web of on and off-chain ecosystems, cross-chain information exchange, and often some meme coins and jpegs. Therefore, the Ethereum blockchain ledger is the telescope through which we can gaze upon the ornate design of Web3.
In this piece, we present a guide on How to Use Ethereum. Here, we extend the context to include the value exchange between accounts and smart contracts, giving readers a peek into the gears that turn to make DeFi happen. Let’s dive in!
What is Ethereum?
Ethereum is a blockchain housing a virtual computer. The virtual computer, also known as the Ethereum Virtual Machine (EVM), forms the basis for conducting arbitrary computations or installing decentralized applications on the Ethereum network. Anyone can create an Ethereum account for free and publish a computation request to the EVM.
These computation requests emit EVM state changes. A series of interconnected computers, called nodes, keep track of these state changes. The term “Ethereum network” refers to this web of nodes that maintain an identical history of Ethereum’s state changes, stored as “blocks.” The Ethereum nodes must agree on an identical network state to ensure security. They use a mechanism called Proof of Stake to vote for the state of the network during a consensus process held periodically. Ethereum nodes conduct this process to validate each block, earning them the title of "validators."
As this article aims to be more of a “guide,” we cover Ethereum's tech, specs, history and use cases in more detail in our Ethereum 101 article if you would like to dive deeper into the world's leading smart contract protocol.
The Economics of an Ethereum Block
Ethereum nodes must stake 32 ETH in a staking deposit contract to become validators and lease the right to vote in the PoS consensus. The deposit is an economic security to guarantee a validator’s honest behaviour. A validator may collude for personal profit by manipulating the network in three broad ways:
- Voting for two different blocks for the same slot
- Violating the natural chronology of block propagation
- Confirming two blocks for the same slot
If a validator is caught engaging in the above activities, the protocol slashes a part of their stake. A validator remains honest as long as the loss from slashing outweighs the profit from colluding, creating an economic incentive to act honestly. Check out our Guide to Ethereum Staking if you want to learn more or get involved.
Validators receive compensation for their security services. Users who access the Ethereum network to send ETH or perform computations on EVM pay a fee to the validators for using the network’s resources. The user’s computation request is considered valid only when the validators add it to the block history, agree upon the resultant final state during consensus, and propagate the new block throughout the network. Validators have two major income streams:
- Fees collected from network users.
- ETH inflation: Every new block created mints new units of ETH, which are distributed between the validators.
Decoding Ethereum Transactions
An Ethereum transaction is an action initiated by an Ethereum user account that leads to a state change of the EVM. Two types of accounts exist on the Ethereum blockchain -
- Externally Owned Accounts (EOAs): User accounts controlled by a private key and visible through public keys.
- Contract accounts: A smart contract (bits of reusable code) account deployed on the network. Contract accounts possess a public key but no private key.
An Ethereum transaction is an action initiated by an EOA, signed with their private key. While both account types can receive, hold, and send ETH and other ERC-20 tokens, contract accounts lack a private key to sign transactions. Instead, EOAs interact with contract accounts by submitting transactions to execute functions within the contracts based on the user’s inputs, which ultimately results in a state change. Contract accounts are commonly known as smart contracts.
Types of Ethereum Transactions
There are three types of transactions possible on the Ethereum network:
- Transactions between EOAs
- Transaction to deploy a smart contract
- Transaction to execute a smart contract
Ethereum Transactions Lifecycle
A transaction lives through the following stages during its cycle:
- A node calculates the cryptographic hash of the transaction.
- It broadcasts the hash over the networking, adding it to a cluster of pending transactions known as the mempool.
- A validator node picks up the transaction, confirms its validity, and adds it to the latest block under construction.
- A successful consensus confirms the block and gets stored on-chain. As more blocks are passed over this block with time, it will reach finality, establishing it as an immutable part of the Ethereum history.
Ethereum validators are in the service of securing blocks in the blockchain network. A validator’s job is to verify the legitimacy of the transactions and execute the computations requested by the users, requiring validators to spend their monetary resources and processing power.
The Ethereum network compensates for the efforts of validators. It distributes the fees collected from network users and new ETH minted with every block between the validators. Transaction fees fuel the Ethereum network, so they are known as gas fees.
Understanding Ethereum Blocks
With the transition to Proof of Stake, Ethereum block characteristics are closely determined by factors like the demand for the Ethereum network and the gas fees users are willing to pay for their transactions.
What is Gas?
Gas is the unit that measures the amount of computational effort the validators spend executing the user’s requested on-chain process. Gas fees are the total units of gas consumed by the validators, calculated by multiplying the number of units consumed with the cost of gas. Gas costs are measured in gwei, a unit of ETH (1 gwei is 10^-9 ETH).
Ethereum redefined gas management in the network with EIP-1559. The gas fee a user pays consists of two parts -
- Base fee - The minimum amount of gas a user must spend to constitute a valid transaction.
- Priority fee - Users often include a tip above the base fee to incentivize validators to include their transactions in the block.
Most wallets let users set a gas limit when sending transactions. This limit sets an upper cap on the priority fee, i.e., the premium one is willing to pay to have validators their request processed before others. After adding a successful block, the priority fee is rewarded to the miners, while the network burns the base fee.
The gas limit is often breached during traffic as users ramp up the priority fee, reverting the transaction. A gas limit protects users from unwanted expenditures because a transaction would keep consuming the ETH in the wallet for gas without it.
Note: Remember that a reverted transaction will not return your gas consumed by the validators in processing the transaction, even if it fails to complete or is not included in the block. Therefore, setting very low or high gas limits can result in unnecessary loss of funds.
Ethereum Block Breakdown
We measure the size of an Ethereum block in the amount of gas consumed. Every 12 seconds, the network randomly selects a validator to produce the block. The target block size is 15 million gas, while the maximum block limit is 30 million gas.
The Ethereum network must remain fast, lightweight, and sufficiently decentralized. If gas is allowed to run wild without any check, it could sore exponentially, raising block storage costs, which increases node running costs, resulting in network centralization as financially stressed nodes are washed out.
Ethereum prevents this scenario by managing the base fee based on its affinity to the target block size. Here’s how this works:
- The target block size is set at 15 million gas.
- If a block consumes more than 15 million gas for two consecutive blocks, the base fee is raised by 12.5% with every block; transactions keep getting pricier.
- The surge pricing continues until a block consumes less than 15 million gas, after which the base fee is decreased by 12.5% with every block, targeting an equilibrium at 15 million gas.
A common misconception about EIP-1559 (which introduced the above mechanism) is that it made Ethereum gas cheaper, which is an incorrect interpretation of the proposal. Instead, the purpose of EIP-1559 was to make gas more predictable, which the network achieves with the base fee model.
Insights Into ETH Inflation
If you have been following Ethereum’s developments actively in the last few years, you must have heard people talking about how ETH is a deflationary currency now; this is an incomplete analysis. Each Ethereum block mints new units of ETH while burning the old ETH collected as the base fee. ETH deflates in supply only when the protocol burns more base fee than it mints new ETH, which happens when the base fee is steep during high network demand.
Therefore, the ETH supply is a function of demand for the Ethereum network; higher demand leads to scarcer ETH, and faint demand adds more ETH.
Sending Ethereum Transactions
We now have a good idea of the value flow between network participants that process an Ethereum Transaction, but how do you send one?
To send a transaction on the Ethereum network, one must have:
- A wallet (a public-private key pair).
- Sufficient ETH to cover the gas fees.
An online wallet like Metamask is the most conventional method of using the Ethereum network. Setting up a Metamask wallet involves adding it as a browser extension and creating a wallet by setting up a seed phrase.
If you’re looking for a guide to walk you through the entire process of setting up a Metamask wallet, Coin Bureau has you covered!
You can use Metamask to exchange any ERC-20 token on Ethereum. Metamask’s gas estimates are accurate and include base and priority fees. However, it is advisable to be cautious during peak network traffic. Once you have made your choice for which Ethereum Wallet to use, here are the steps to sending an Ethereum transaction:
- Choose the recipient address and the amount of ETH you want to send. You can also include some optional data, such as a message or a contract function call. It is recommended to use the copy/paste function or QR Code scanner if supported to send an ETH transaction. Important note: Even if you copy/paste the address ALWAYS double-check the receiving address as there are things like keyboard hijackers that can swap the pasted address with the address of a malicious actor.
- Set the gas limit and the gas price for your transaction. The gas limit is the maximum amount of gas units that your transaction can consume, and the gas price is the amount of ETH you are willing to pay for each gas unit.
- Sign your transaction. Signature requests typically come in the form of a popup in your wallet. This step will generate a unique identifier for your transaction and prove that you are the owner of the wallet.
- Broadcast your transaction to the Ethereum network. This is typically done by simply hitting the “confirm” or “send” button in your wallet. You will get a transaction hash that you can use to track the status of your transaction on a block explorer, which will be covered next.
- Wait for your transaction to be confirmed by the network. Depending on the network congestion and your gas price, this may take from a few seconds to several minutes or hours. Once your transaction is included in a block, it is considered final and irreversible.
With the basics of transaction mechanics covered, it is time to break open an Ethereum transaction and look under the hood. The best tool to analyze blockchain activity is blockchain explorers.
What is a Blockchain Explorer?
A blockchain explorer is a web interface for analyzing blockchain network activity. While writing or performing computations on Ethereum costs gas, reading past block data is freely accessible. One may use a node to retrieve block activity or a blockchain explorer. Explorers filter and organize block data to help gather insights efficiently.
Blockchain explorers fulfil several functions:
- They are a blockchain search engine that looks into block data, gas prices, wallets, smart contracts and track transactions.
- As a blockchain API, explorers can both read data from the blockchain and write commands on it.
- One may also use it as an analytics platform, with access to several charts to interpret on-chain activity.
- Explorers may also help in auditing to verify smart contract codes and look for suspicious activity.
Etherscan is the most widely used blockchain explorer for the Ethereum mainnet. Let’s have a tour of Etherescan and try to know it better.
Anatomy of Ethereum Transactions
Blockchain explorers do the neat work of gathering raw blockchain data and organizing it so ordinary folks like you and I can understand it. We begin our tour with the Etherscan homepage.
The homepage is a bird’s eye view of the state of the Ethereum blockchain that provides essential information like ETH price, current block, and gas price. The search bar lets you look up any on-chain activity (blocks and transactions) or identity (wallet addresses, smart contracts, tokens, domains). The transactions are displayed with a unique identifier called a hash.
Ethereum Block Breakdown
Let’s dive into one of the blocks to uncover more insights. The blocks are chronologically listed on the left side by their block number. You can click on any block number link or look it up using the number on the search bar. Here is a snapshot of block #18135009:
The block status describes the stage of the block in the consensus process. The Ethereum blockchain divides blocks into epochs. Each Epoch has 32 slots, and each slot can contain one block. The validators run the POS consensus process for each slot. The Block status depends on the status of this consensus process. There are three Block statuses -
- Unfinalized - The consensus process for the block is still underway. The block is at risk of chain reorganization at this stage.
- Unfinalized (safe) - The block has completed the consensus process to receive attestations from 2/3rd of the validators. Such a block runs a shallow risk of getting reorganized.
- Finalized - An unfinalized (safe) block attains finality when one epoch is behind. Finalized blocks are canonical parts of the Ethereum main chain and are immutable.
Gas is Ethereum is adjusted to hit the ideal target of 15 million. The block mentioned above used 36% of the 30 million gas available. At this stage, the protocol is programmed to raise the base fee to cover the 26% lag in the target gas utilization.
With every block, some ETH is minted (brought into supply), and some is burnt (deleted from supply). Etherscan provides both the block reward and the burnt fees data. For instance, the block above minted about 0.092 ETH and burned 0.342 ETH, making ETH deflationary.
Ethereum Transaction Breakdown
Here is a simple BAYC NFT transfer between two addresses. Let’s break this transaction down:
Some notable insights from the above data:
- Status - The success status of the transaction means it was successfully added to a block, which was finalized into the Ethereum ledger. The transaction may also have ‘Pending,’ ‘Failed,’ or ‘Dropped’ status, as the case may be.
- Block confirmations - The green check mark represents a successful transaction. The number of block confirmations counts the number of blocks added to the chain after the block containing this transaction. A higher number of confirmations increases the safety and immutability of the transaction.
- From - This is the sender’s address. The sender had a domain name 1606.eth instead of a traditional public address.
- Interacted with - We learned that smart contracts on Ethereum cannot send new transactions by themselves but are triggered by an EOA instead. EOA 1606.eth interacted with the BAYC NFT token contract to trigger a transfer. The receiving address is also mentioned in the subsequent row. Users generally refer to these details to cross-check their transactions.
- Gas - Etherscan provides all gas-related details for the transaction-
- The sender used 92.67% of its gas limit and spent 121,397 gas.
- The gas price for the transaction was 10.969 gwei.
- Therefore, the sender spent 121,397 * 10.969 gwei, or 0.00133 ETH, for this transaction.
The transaction decoder is a tool to gain more insights about transactions. Each transaction emits events and smart contract calls involving nodes that add transactions from the mempool. The transaction decoder provides an intuitive interface to track the value transfer between such parties. Access the decore under the ‘More’ menu on any transaction page.
Tracking Wallet Transactions
While the block page lists all the transactions within a block, users may want to track and analyze activity from a particular smart contract or wallet address. Etherscan lets users track any wallet with their public address or domain name or any smart contract with their contract address. Let’s peek into the sender address 1606.eth from the BAYC transfer above and check its activity.
The picture above illustrates the address page's appearance. It mentions the wallet's public address, ETH balance, and other token holdings. The page also summarizes all the transactions conducted by the address and the related block data.
Navigating Cross-Chain Transactions
The Ethereum ecosystem is home to several layer-2 ecosystems that deploy various rollup technologies like ZK Rollups and Optimistic Rollups. Ethereum’s rollup-centric roadmap accentuates the role layer-2 chains will play in the future. Therefore, understanding Ethereum mainnet transactions is not enough these days. A diligent blockchain analyst must also know how to follow money outside Ethereum.
To understand cross-chain transactions, one must understand how cross-chain bridging works. Bridge designs are incredibly intricate and deserve a full-length deep dive. However, to learn cross-chain transactions, here is a simplified process behind a typical cross-chain transaction -
- The bridge protocol deploys specialized smart contracts on the source and destination chains. These smart contracts act as junction points that send and receive user cross-chain requests.
- The sender from the source chain sends the tokens to be bridged to the bridge smart contract on the source chain and the receiving address in the destination chain.
- After performing the necessary security checks, the source chain smart contract exports this information to the destination channel bridge smart contract.
- The destination chain bridge smart contract executes the instructions it receives, sending the token to the destination chain target address after compensating for gas fees.
Let’s follow a cross-chain transaction from Ethereum to Polygon zkEVM. Since both these chains run EVM, their operation and blockchain explorer interface are similar and easy to comprehend.
The transaction above shows the first half of a cross-chain transaction between Ethereum and Polygon zkEVM. The ‘To’ address mentioned here is the Polygon zkEVM bridge smart contract deployed on Ethereum. We can look into logs to determine how this transaction passes all the necessary information cross-chain.
We need to observe the first event emitted in the logs. The bridge contract 0x2a3dd3eb832af982ec71669e178424b10dca2ede receives a destination address embedded in the transaction. This address leads to the destination chain receiving address in the Polygon zkEVM blockchain. Moving on to the second half of this cross-chain transaction, we will access Polygonscan, the blockchain explorer for Polygon zkEVM. Here’s the transaction for your reference.
The bridge contract on the destination chain received the cross-chain data and sent the tokens to the mentioned address, completing the cross-chain transfer. It is worth noting that all this process happens in the backend, and the user is only concerned with entering the correct destination address and having sufficient funds to complete the transfer.
Understanding the intricacies of Ethereum transactions is essential for anyone interested in the blockchain space, be it developers, traders, or casual users. From grasping the block propagation structure to comprehending the fluctuating nature of gas prices, thorough knowledge aids in making informed decisions. Tools like Etherscan further demystify the complexities, making the Ethereum network accessible and transparent.
The next frontier is learning about cross-chain transactions, such as those between Ethereum and Polygon. As blockchains proliferate, the ability to move assets seamlessly across chains will become increasingly critical. Mastering these aspects equips you with the tools to optimize your transactions and provides a more comprehensive understanding of blockchain interoperability.
Valuable insights from tracking transactions:
- Fee Optimization: By tracking gas prices over time, you can identify the best times to conduct transactions, thereby saving costs.
- Fraud Detection: Following the flow of funds can help you spot suspicious activities, a vital skill for personal security.
- Investment Decisions: Monitoring transactions of tokens or NFTs you own or are interested in can provide insights into market trends.
- Smart Contract Interactions: Understanding how transactions interact with smart contracts can clue you in on the contract’s reliability and functionality.
By becoming proficient in these areas, you are not just a passive user but an informed participant in the blockchain revolution.
Frequently Asked Questions
Ethereum's block size is determined by the amount of gas consumed. The target block size is 15 million gas, with the maximum limit being 30 million gas. If more than 15 million gas is consumed consecutively, base fees are adjusted to steer consumption towards the target.
EIP-1559 was introduced to make gas fees more predictable. While many assume its purpose was to reduce gas fees, its primary goal was to enhance fee predictability through a base fee model, which auto-adjusts depending on network activity.
ETH becomes deflationary when more ETH is burned as a base fee than the newly minted ETH. After implementing EIP-1559, base fees collected are burned. Hence, during high network demand, if more ETH is burned as fees than the minted amount, the supply shrinks, leading to deflation.
Etherscan provides comprehensive details about each Ethereum transaction. You can see the transaction status, whether it's 'Pending,' 'Failed,' or 'Successful,' as well as the number of block confirmations, which indicates transaction immutability. It also shows the sending and receiving addresses, gas usage, gas price, and the total transaction cost in ETH. For smart contract interactions, you can see which contracts were invoked and review more details through the transaction decoder.
Cross-chain transactions utilize bridge protocols with specialized smart contracts on both the source and destination chains. The sender sends tokens to the bridge contract on the source chain, which, after security checks, relays the information to the destination chain's bridge contract, which completes the transaction.
Disclaimer: These are the writer’s opinions and should not be considered investment advice. Readers should do their own research.