The Ethereum network underwent a significant transformation with the Berlin hard fork on April 14, 2021. This upgrade introduced several changes, but one of the most discussed was the adjustment to gas costs, particularly for the SLOAD operation. For users and developers, understanding these changes is crucial for navigating transaction fees effectively.
The SLOAD Gas Cost Increase
The Berlin hard fork implemented EIP-2929, which increased the gas cost for certain computational operations, including SLOAD. This operation is essential for reading data from the blockchain, a common requirement for many smart contracts. The adjustment marked the third significant increase in SLOAD costs since Ethereum's inception:
- EIP-150 (October 2016): Increased cost from 50 to 200 gas.
- EIP-1884 (December 2019): Raised cost from 200 to 800 gas.
- EIP-2929 (April 2021): Final increase to 2600 gas.
This represents a 52-fold increase from the original cost. The primary rationale was to mitigate potential denial-of-service attacks by making it more expensive to spam the network with data-reading operations. However, critics argue that such attacks are highly improbable, especially during periods of high network congestion when gas prices are naturally elevated.
How Ethereum Fees Work
Ethereum transaction fees are a fundamental aspect of the network's economic model. Users pay for computational services in two primary ways.
Direct Transaction Fees
The most direct cost is the transaction fee, calculated using the formula: Transaction Fee = Gas Price × Gas Used. This fee compensates miners for processing transactions and helps prevent network spam. It is an inevitable cost for any on-chain activity.
Indirect Inflationary Pressure
Miners also receive block rewards through newly minted ETH, a process that introduces inflation. These rewards are paid regardless of network activity. To cover operational costs like electricity and hardware, miners often sell this ETH, creating constant downward pressure on its price. This can devalue user holdings during bear markets or suppress price growth in bull markets.
Gas Price Dynamics
Ethereum uses an auction-based system for transaction fees. Users specify the gas price they are willing to pay, and miners prioritize transactions with the highest bids. However, each block has a limited capacity—currently capped at 30 million gas. During times of high demand, this leads to congestion, causing users and automated bots to bid increasingly higher prices to secure block space. This competition can cause gas prices to spike dramatically.
Understanding Gas Costs
Every operation on the Ethereum Virtual Machine (EVM) has a predefined gas cost, consensus-mandated and only alterable via network upgrades. Simple operations like arithmetic (ADD, SUB) have low costs, while data-reading operations (BALANCE, SLOAD) or complex actions (CREATE) are more expensive.
Standard transactions have fixed costs:
- Sending ETH: 21,000 gas
- Sending ERC-20 tokens: ~65,000 gas (varies by contract)
Real-world examples from blockchain data illustrate the variability:
- HEX Stake Start: 62,000 – 95,000 gas
- HEX End Stake: Formula-based (~2,310 × days staked + 53,694)
- Uniswap v2 Swap (USDC/HEX): ~112,000 gas
- Uniswap v3 Swap (ETH/HEX): 100,000 – 160,000 gas
- Cross-chain Bridge (Polygon/Ethereum): ~295,000 gas
👉 Explore real-time gas tracking tools to monitor current network conditions.
Setting the Gas Limit
The gas limit is a user-defined cap on the amount of gas a transaction can consume. It is a critical parameter:
- Setting it too low risks an "out of gas" error. Miners will execute the transaction until the gas is exhausted, keep the fees for the work done, but the transaction will fail.
- Setting it higher than needed is safe. The wallet only deducts the gas actually used, so any unused portion is refunded.
This is particularly important for complex transactions whose cost can vary, like ending a HEX stake. The gas required for an end-stake transaction increases with the stake duration. If network congestion delays your transaction, the required gas might increase beyond your initial limit, causing a failure. To avoid this, it is often recommended to set the gas limit 10% higher than the wallet's estimate.
Frequently Asked Questions
What was the main goal of the Berlin hard fork?
The Berlin upgrade aimed to optimize gas costs for certain EVM operations and enhance network security. EIP-2929 specifically increased the cost of SLOAD operations to reduce the risk of theoretical denial-of-service attacks.
How can I estimate the cost of ending a HEX stake?
The gas cost for ending a HEX stake is not fixed; it scales with the number of days staked. A common formula used is approximately 2,310 gas multiplied by the days staked, plus a base fee of around 53,694 gas. Always use an online calculator for the most accurate estimate and consider adding a 10% buffer to the gas limit.
Why do gas prices fluctuate so much?
Gas prices are determined by supply and demand for block space. During periods of high network activity, users engage in a bidding war to get their transactions included in the next block, which drives prices up. Prices can calm down during periods of low activity.
What happens if my transaction runs out of gas?
If a transaction exceeds its gas limit, it will fail immediately. All state changes are reverted, but the miner still collects the fees for the computational work performed up to the point of failure. No gas is refunded in this case.
Is it better to set a high gas limit?
Yes, within reason. Setting a higher gas limit than estimated is safe because you are only charged for the gas actually consumed. The key is to ensure your wallet has enough ETH to cover the maximum potential fee (Gas Price × Gas Limit). The main risk is setting the limit too low, not too high.
Did the Berlin upgrade make all transactions more expensive?
Not all transactions. The upgrade targeted specific opcodes, like SLOAD. Transactions that frequently read state from the blockchain saw a significant cost increase. Simple value transfers were largely unaffected.
👉 Get advanced strategies for managing transaction fees and optimizing your on-chain operations.