Skip to content
EthNews

News from across Ethereum

Failed EVM Transactions Cost Gas When Included

Do failed crypto transactions cost gas when no tokens move? Yes, if included execution reverts; wallet rejection and pre-broadcast failures incur no onchain execution fee.

The EthNews Desk5 min read

Failed EVM Transactions Cost Gas When Included

The belief that no token movement means no gas charge is wrong: an EVM transaction that is included and reverts normally costs gas, even though its token changes are rolled back. Gas pays for computation attempted by the network, not only for a successful transfer. The charge depends on whether execution began onchain and how much gas it used.

That distinction can be easy to miss in a wallet. A swap can show an error and leave token balances unchanged, while the account that submitted it has less ETH or another fee token. The visible result describes the contract state after execution; it does not show how much computation ran before the failure.

Gas pays for attempted execution

An included EVM transaction consumes gas as the network executes its instructions. The fee is based on gas used and the applicable price per unit, so a failed transaction can still have a fee. Ethereum’s gas documentation states that the fee applies whether execution succeeds or fails.

With a normal REVERT, the contract stops and its state changes from that execution are rolled back. EIP-140 specifies that rollback while preserving unused gas. The work already performed before the REVERT still counts, so the sender pays for gas used up to that point. Unused gas is not charged as used execution gas.

Take a SyncSwap swap that reaches the contract but fails a condition during execution. SyncSwap is a decentralized exchange for trading tokens and accessing liquidity pools on supported networks. Its syncswap farming is a related liquidity activity. If the swap reverts, the attempted token balance changes roll back, but the payer can still lose gas for the execution that reached the failure.

This is the difference between an unsuccessful outcome and an unsubmitted request. Compare a reverted swap with a wallet rejection: the reverted swap was processed onchain and used network computation; a rejected request never reached onchain execution, so it has no execution gas fee. A successful swap transfers tokens, while a reverted one does not, but either can use gas if it is included.

Failure stage determines whether gas is charged

An included revert costs gas because the EVM ran the transaction. The transaction receipt records failure, and the account that paid for execution loses the fee. A token explorer view may show no transfer because the attempted changes were rolled back; the receipt and fee details show whether execution still consumed gas.

Out-of-gas execution is a different failure. If execution exhausts its gas limit, it cannot preserve unused gas: there is none left to return. The transaction still fails and token changes roll back, but the allocated execution gas is consumed. A REVERT reached with gas remaining typically costs only the gas used before and during the revert, rather than the full limit.

A gas estimate can also fail before broadcast. Wallets and apps commonly simulate a proposed transaction to estimate its gas or check whether it would succeed. If that simulation reports a revert and the wallet does not submit the transaction, no onchain execution fee is charged to the user. Likewise, rejecting the wallet confirmation or failing before broadcast produces no included transaction to execute.

A pending transaction has not yet reached its final execution result. It may later be included and succeed, included and revert, or remain pending. Until it is included, it has not incurred the onchain execution fee described here. If a wallet supports cancellation, it generally submits a replacement transaction using the same account nonce; whichever transaction is included first determines the outcome, and an included replacement can itself cost gas.

Sponsorship changes who pays, not whether execution consumes gas. If a relayer or another account sponsors a transaction, the user may not see the fee deducted from their own balance. A failed sponsored execution can still consume network gas, with the sponsor or configured payer covering the charge.

What to check before retrying

Before retrying, identify whether the failed attempt has an onchain transaction hash. If it does, open its receipt and check the status and actual fee. A failed status with a recorded fee means execution was included and gas was charged. If there is no hash and the wallet only reports an estimate or simulation error, the request may have failed before broadcast.

Then inspect the revert reason, if the wallet or block explorer exposes one. It may indicate that a contract condition failed, such as a minimum output not being met, or that execution ran out of gas. Those causes call for different fixes: changing transaction parameters may address a condition failure, while a gas-limit problem concerns the execution allowance. Do not treat a larger gas limit as a general remedy for every revert.

If you retry without changing the cause, the next transaction can fail in the same way and incur another fee if included. Confirm the selected network and transaction details, and use the available simulation result to diagnose the failure before signing again. An estimate that fails before broadcast is useful precisely because it can reveal a problem without creating an onchain execution charge.

Questions users ask next

Can a pending transaction be cancelled?

A pending transaction can sometimes be replaced before it is included, if the wallet and network support that process. The replacement uses the same nonce and must be accepted and included before the original; if the original is included first, cancellation cannot undo it. An included replacement may incur its own gas fee, even if its purpose is only to cancel the earlier action.

How can I diagnose a revert before retrying?

Use the wallet’s simulation or estimate result, then review the transaction receipt or revert data if the transaction was broadcast. A pre-broadcast simulation failure can identify a likely contract condition without an onchain fee. A receipt confirms whether execution was included and charged gas, while its revert reason can help identify what to change before another attempt.