Ethereum, as a decentralized blockchain platform, operates on a set of core concepts that ensure its functionality and security. This guide breaks down the essential elements of Ethereum's architecture, including accounts, transactions, gas, and block gas limits, to help you understand how the network operates efficiently.
What Are Accounts in Ethereum?
In Ethereum, accounts are fundamental entities that interact with the blockchain. There are two primary types of accounts:
- Externally Owned Accounts (EOAs)
- Contract Accounts
Externally Owned Accounts (EOAs)
An Externally Owned Account is controlled by a private key and has the following characteristics:
- It holds an Ether balance.
- It can initiate transactions, such as transferring Ether or triggering contract code.
- It has no associated code of its own.
EOAs are typically managed by users through wallets, allowing them to interact with the Ethereum network seamlessly.
Contract Accounts
A Contract Account, on the other hand, is controlled by its code and has these features:
- It holds an Ether balance.
- It contains associated code that executes when activated.
- Execution is triggered by transactions or calls from other contracts.
- It operates with Turing completeness, meaning it can perform complex computations and manage its own storage state.
- It can call other contracts, enabling interconnected functionalities.
All actions on the Ethereum blockchain are initiated by transactions from accounts. When a contract account receives a transaction, the parameters within the transaction serve as inputs for the code execution. This code runs on the Ethereum Virtual Machine (EVM) across all network nodes during block validation.
Transactions and Messages
Transactions
In Ethereum, a transaction refers to a signed data package sent from an externally owned account to another account. It includes the following components:
- The recipient's address.
- A signature verifying the sender's intent.
- A value field indicating the amount of Wei (the smallest denomination of Ether) to be transferred.
- An optional data field for sending messages to contracts.
- A
GASLIMITvalue, specifying the maximum computational steps allowed for the transaction. - A
GASPRICEvalue, denoting the amount the sender is willing to pay per unit of gas.
Transactions are the primary method for transferring value and invoking contract functionalities on the blockchain.
Messages
Contracts can send "messages" to other contracts. Messages are virtual objects that exist only within the Ethereum execution environment and function similarly to internal function calls. A message includes:
- The sender's address.
- The recipient's address.
- An optional data field for input parameters.
- A
GASLIMITvalue to restrict the computational resources available for the message's execution.
Messages are generated when a contract executes CALL or DELEGATECALL operations. While often conflated with transactions, messages are distinct in that they originate from contract accounts rather than external accounts. Over time, the term "message" has become less common in community discourse, with many referring to both concepts as "transactions."
Understanding Gas in Ethereum
Ethereum operates a runtime environment known as the Ethereum Virtual Machine (EVM). Every node in the network runs the EVM to validate blocks and execute transactions. To prevent resource abuse, each operation in the EVM has a cost measured in gas units.
Gas and Transaction Costs
Every transaction must specify a gas limit (sometimes called startGas) and a gas price. The gas limit sets the maximum amount of gas the transaction can consume, while the gas price determines the cost per unit. Miners prioritize transactions with higher gas prices, as they earn these fees.
If the total gas used in a transaction is within the gas limit, the transaction processes successfully. Excess gas is refunded to the sender. However, if gas consumption exceeds the limit, all operations revert, but the transaction fee is still paid to the miner. This mechanism ensures network stability while compensating miners for their work.
Estimating Transaction Costs
Transaction fees are calculated based on two factors:
gasUsed: The total gas consumed by the transaction.gasPrice: The price per unit of gas (in Ether).
Total Fee = gasUsed × gasPrice
gasUsed
Each EVM operation has a fixed gas cost. The gasUsed is the sum of these costs for all operations performed during the transaction.
gasPrice
Users can set any gas price, including zero, but miners typically ignore low-fee transactions. The default gas price in many Ethereum clients is 0.05e12 Wei, though network conditions may necessitate higher fees for timely processing.
Transaction Fee Example
Think of gasLimit as your car's fuel tank capacity and gasPrice as the cost per liter of fuel. For instance:
- Fuel price: $2.5 per liter → Gas price: 20 GWei per gas.
- Tank capacity: 10 liters → Gas limit: 21,000 gas for a simple transfer.
- Total cost: 10 × $2.5 = $25 → 21,000 × 20 GWei = 0.00042 ETH.
Sending tokens typically requires 50,000–100,000 gas, resulting in fees of 0.001–0.002 ETH.
👉 Explore real-time gas tracking tools
What Is the Block Gas Limit?
The block gas limit is the maximum amount of gas allowed in a single block, determining how many transactions can be included. For example, if five transactions have gas limits of 10, 20, 30, 40, and 50, and the block gas limit is 100, only the first four transactions might fit. Miners select transactions based on fees, potentially including higher-fee ones first.
Currently, the Ethereum block gas limit is approximately 4.7 million gas, allowing around 224 simple transfers per block (with block times averaging 15–20 seconds). The protocol permits miners to adjust the gas limit by ±1/2024 (0.0976%) per block, enabling flexible capacity management.
Who Controls the Block Gas Limit?
Miners collectively determine the block gas limit through their client settings. Most clients default to a minimum limit of 4,712,388 gas, but miners can override this based on network conditions.
How the Block Gas Limit Changes
Miners use software like Geth or Parity to configure their nodes. These clients offer options to set target gas limits and gas prices, allowing miners to influence network capacity dynamically.
Ethereum Network "DoS" Attacks
Network congestion, often termed "DoS" attacks, occurs when blocks are consistently full, leading to transaction delays. This can result from malicious actions or organic demand.
Malicious DoS
In past attacks, bad actors flooded the network with low-gas transactions to clog the system. Miners responded by reducing the block gas limit to 1.5–2 million gas to mitigate the impact. These measures helped stabilize the network but required manual intervention.
Non-Malicious DoS
Organic congestion arises from high demand, such as during popular token sales (ICOs). When transaction volumes exceed block capacity, delays occur naturally. Tools like Infura provide analytics to monitor these events.
Why Doesn't the Gas Limit Adjust Automatically?
Ethereum's protocol includes a mechanism for dynamic gas limit adjustment, but miners often disable it. Initially, the system encouraged miners to vote for limits based on recent block usage, promoting scalability. However, after past attacks, many miners kept manual settings, hindering automatic adjustments. Recent calls for miners to re-enable dynamic limits aim to improve network responsiveness.
👉 Get advanced strategies for network optimization
Frequently Asked Questions
What is the difference between an EOA and a contract account?
An EOA is controlled by a private key and can initiate transactions, while a contract account runs code when triggered and has no private key.
How can I reduce my transaction fees?
You can lower fees by setting a reduced gas price, but this may delay processing. Monitoring network congestion helps optimize costs.
What happens if my transaction runs out of gas?
Operations revert, but the gas used up to that point is not refunded. Always set a sufficient gas limit.
Why do miners control the block gas limit?
Miners secure the network and decide transaction inclusion. Their gas limit choices balance throughput and stability.
How often does the block gas limit change?
Miners can adjust it per block, but changes are typically gradual to avoid network instability.
Can contract accounts hold Ether?
Yes, contract accounts can store Ether and interact with other contracts, enabling complex decentralized applications.
Conclusion
Understanding Ethereum's account system, transactions, gas mechanics, and block gas limits is essential for navigating the network efficiently. By grasping these concepts, users and developers can optimize their interactions and contribute to a healthier ecosystem. Miners play a crucial role in maintaining network performance, and adopting dynamic settings can enhance scalability during periods of high demand.