Understanding Accounts, Transactions, Gas, and Block Gas Limits in Ethereum

·

Ethereum, as a decentralized blockchain platform, introduces unique concepts that form the backbone of its operations. This article explores core components including accounts, transactions, gas fees, and block gas limits, providing clarity on how they interact within the Ethereum ecosystem.

What Are Ethereum Accounts?

Ethereum accounts differ significantly from traditional banking accounts and even from Bitcoin's Unspent Transaction Output (UTXO) model. They serve as the primary entry point for interacting with the blockchain.

There are two distinct types of accounts on the Ethereum network:

Externally Owned Accounts (EOAs)

An EOA is what most users consider their personal Ethereum wallet. It's controlled by a private key and has the following characteristics:

Contract Accounts

Contract accounts represent one of Ethereum's most innovative features. They are not controlled by private keys but by their underlying code. Key attributes include:

When executed, contract accounts:

All operations on the Ethereum blockchain are initiated through transactions from accounts. When a contract account receives a transaction, the parameters become inputs for the contract code. This code runs on the EVM across all network nodes during block validation.

Transactions and Messages

Transactions

In Ethereum, a transaction refers to a signed data package sent from one account to another, recorded permanently on the blockchain. This includes:

Transactions that modify contract states also incur fees, similar to simple ETH transfers.

Messages

Contracts can send "messages" to other contracts—virtual objects that exist only within Ethereum's execution environment. These function similarly to function calls in programming.

Messages contain:

Essentially, a message is an internal transaction generated when executing code contains CALL or DELEGATECALL operations. Unlike regular transactions, messages aren't created by external accounts but by contracts during execution. This enables complex interactions between smart contracts.

Understanding Gas in Ethereum

The Ethereum Virtual Machine (EVM) requires computational resources to execute operations. Since every network node performs identical computations and stores the same data, contract execution becomes resource-intensive across the entire network.

To prevent network abuse and ensure sustainable operation, Ethereum charges fees for every computational step in transactions or contract calls. These fees are measured in gas units, often called "fuel."

Gas and Transaction Costs

Every transaction specifies both a gas limit and gas price. Miners prioritize transactions based on these parameters.

If a transaction's total gas used is within the limit, it processes successfully. If execution exceeds the limit, operations revert, but the gas consumed up to that point is still paid. Unused gas is refunded after completion.

Since gas consumption is challenging to predict precisely, users often overestimate limits to ensure transaction processing.

Estimating Transaction Costs

Transaction fees comprise two components:

Total Fee = gasUsed × gasPrice

GasUsed Calculation

Each EVM operation has a fixed gas cost. The total gasUsed sums the cost of all executed operations. Developers can estimate this using tools like web3.eth.estimateGas.

GasPrice Determination

Users set their preferred gasPrice based on network conditions. During congestion, higher prices incentivize faster processing. Current average prices can be checked on blockchain explorers.

Practical Example

Think of gasLimit as your car's fuel tank capacity and gasPrice as fuel cost per liter.

If gasPrice is 20 Gwei per gas unit and your transaction requires 21,000 gas (a standard transfer), your cost would be: 21,000 × 20 Gwei = 0.00042 ETH.

Ether Unit Conversions

UnitWei ValueEquivalent
wei1 wei1
Kwei (babbage)1e3 wei1,000
Mwei (lovelace)1e6 wei1,000,000
Gwei (shannon)1e9 wei1,000,000,000
microether (szabo)1e12 wei1,000,000,000,000
milliether (finney)1e15 wei1,000,000,000,000,000
ether1e18 wei1,000,000,000,000,000,000

Block Gas Limits

The block gas limit defines the maximum total gas allowed per block, determining how many transactions a block can contain.

For example, if five transactions have gas limits of 10, 20, 30, 40, and 50 respectively, and the block gas limit is 100, a miner could include the first four transactions (10+20+30+40=100). Alternatively, they might choose the two largest (50+40=90) plus one smaller transaction (10).

Miners decide which transactions to include based on fee preferences. Transactions exceeding the current block gas limit are rejected by the network.

The current standard transaction gas cost is 21,000 units, while the network-wide block gas limit is adjusted by miners through consensus. Most clients default to a minimum of approximately 4.7 million gas units per block.

👉 Explore real-time gas tracking tools

Network Congestion and DoS Considerations

Some reports describe Ethereum network slowdowns as "DoS attacks." Actually, these situations occur when blocks consistently reach their gas limits while numerous transactions remain pending.

During such congestion:

Understanding gas mechanics helps users navigate these situations effectively by adjusting gas prices appropriately.

Frequently Asked Questions

What's the difference between an EOA and a contract account?
EOAs are controlled by private keys and can initiate transactions, while contract accounts are controlled by code and only activate when called by transactions or other contracts. Both can hold ETH, but only EOAs can start transactional processes.

Why do transactions sometimes fail even when I pay gas?
If your transaction exceeds the gas limit you set, it reverts all operations but still consumes gas up to the point of failure. This prevents infinite loops while compensating miners for their computational work.

How can I estimate the right gas limit for my transaction?
Most wallets provide automatic estimations, but for complex contracts, you can use development tools like estimateGas. For standard ETH transfers, 21,000 gas units is sufficient.

What happens during network congestion?
When many users submit transactions simultaneously, miners prioritize those with higher gas prices. To ensure timely processing during congested periods, consider increasing your gas price.

Can contract accounts initiate transactions?
Contract accounts cannot start transactions independently. They can only send messages or ETH in response to being called by an EOA or another contract.

How often does the block gas limit change?
Miners collectively adjust the block gas limit through voting mechanisms in the consensus protocol. The limit gradually increases or decreases based on network demand and miner preferences.