A failed action can still require paid computation
An Ethereum transaction can be included in a block, execute work and then fail. Reversing the attempted contract changes does not make that computation free. This is why the intended transfer or swap can fail while the sending account still pays a network fee.
MetaMask explains that it does not receive the network gas payment and cannot refund that payment simply because execution failed. Separate any wallet, exchange or application service charge from the on-chain fee; their records and policies are different.
This lesson follows ordinary Ethereum mainnet transactions sent from a conventional externally owned account. Smart-account bundles, sponsored operations, rollups and cross-chain workflows can have additional accounting. Do not apply the simple worksheet to those flows without their specific documentation.
No wallet connection or payment is needed. We use invented receipts to answer two questions separately: what action actually happened, and what fee was actually paid?
Identify which kind of failure you are looking at
A rejected signing request, a simulation warning, a pending broadcast and an included failed transaction describe different stages. An app's red error banner alone does not establish an on-chain charge. First identify the network and transaction hash, if one was produced.
Ethereum's transaction lifecycle separates submission from block inclusion. Inspect the record on an explorer for that network and confirm that it matches the account and action you intended. A hash shown in an app is not itself proof of successful execution.
A receipt is produced for an included transaction. The receipt API distinguishes failure status 0x0 from success status 0x1 and reports gasUsed and effectiveGasPrice. A missing receipt can mean the queried transaction is still pending or unavailable to that node; it is not sufficient evidence of a finalized failure.
For a simple worksheet, record network, hash, inclusion block, receipt status, gas used, effective gas price and the related action. If the app lists an approval and a swap, create separate rows rather than assigning the entire workflow one status.
Reverted execution and running out of gas are different
The REVERT instruction stops execution and rolls back the affected execution state without inherently consuming every remaining gas unit. An unmet contract condition can therefore fail after using only part of the transaction's gas allowance.
If execution exhausts its available gas, the affected execution fails. For a transaction that runs out of gas at the top level, the supplied gas is consumed. A gas limit below the transaction's intrinsic requirement can instead be rejected before inclusion. These cases should not be collapsed into a single instruction to increase gas.
This guide's examples assume the whole top-level transaction has failure status. A contract can catch a failed internal call and continue, leaving the overall transaction successful. Reading the receipt status and the actual resulting transfers matters more than treating every internal error as a complete rollback.
A failed top-level execution does not erase its receipt, gas charge or the sender's consumed transaction sequence number. Nor does it reverse a separate earlier transaction. Keep execution results and transaction accounting distinct.
Worked example: the transfer failed, but only gas was spent
Assume a fictional Ethereum mainnet account starts with 0.500000 ETH. It sends a type-2 transaction attempting to transfer 0.100000 ETH through a contract. The transaction has gas limit 100,000 and maximum fee 30 gwei per gas. Its included receipt shows failure, gasUsed 60,000 and effectiveGasPrice 12 gwei. Assume no other activity or separate service charge.
The actual fee is 60,000 × 12 = 720,000 gwei. Since one ETH equals one billion gwei, the fee is 0.000720 ETH. With the top-level execution reverted, the attempted 0.100000 ETH transfer does not take effect. The account's closing balance is 0.500000 − 0.000720 = 0.499280 ETH.
The gas ceiling was 100,000 × 30 = 3,000,000 gwei, or 0.003000 ETH. That is a maximum gas budget, not the paid fee. Adding the intended value gives a maximum funding requirement of 0.103000 ETH for this simplified type-2 transaction; it is not the amount ultimately spent.
The difference between the gas ceiling and actual fee is 0.002280 ETH. Treat it as unused fee headroom in this worksheet, not as a separate incoming refund transaction that must appear in the activity list. EIP-1559's accounting returns unused prepaid gas at the effective price and constrains the price by the fee cap.
These numbers are original hypothetical inputs, not live gas prices or a typical failure cost. Use gasUsed from the individual receipt, not cumulativeGasUsed for transactions executed so far in the block. Use consistent units; raw API quantities require appropriate decoding.
A successful approval survives a later failed swap
Consider a second fictional workflow with two separate transactions. First, an ordinary finite ERC-20 approval grants a router permission to spend 80 T and succeeds. Its receipt records 45,000 gas at 10 gwei, costing 0.000450 ETH.
The later swap attempts to spend 50 T but reverts at the top level. Its receipt records 70,000 gas at 12 gwei, costing 0.000840 ETH. Assume no token transfer fees, other token activity or allowance changes outside these two transactions.
The workflow's network cost is 0.000450 + 0.000840 = 0.001290 ETH. The failed swap transfers no T in this example, but the earlier approval is still in force: the allowance remains 80 T. A failed swap is not an automatic revocation.
A mistaken summary might say 'Nothing happened because the swap failed.' Our ledger shows two lasting effects: an approved allowance and two network fees. Check the permission separately before deciding whether another attempt is appropriate.
Different token and permit mechanisms can have different rules. The separate approval guide covers permission checks and revocation. Here the purpose is to reconcile independent transactions, not to provide a universal token-recovery procedure.
Diagnose the condition before paying for another attempt
Read the explorer's failure information and the application's documented requirements. A stale deadline, an unmet allowance or an unacceptable swap result needs its own diagnosis. Raising the gas price does not make an invalid contract condition true, and raising slippage can permit a worse trade.
Use the separate swap-quote lesson to inspect minimum received, fees and route conditions. If an estimate or simulation warns of failure, resolve the reason before approving another paid attempt. A simulation is useful evidence about its inputs and state, not a guarantee of future execution.
If the app reports failure but the explorer shows success, stop before retrying and reconcile the actual transfers and application state. An interface timeout can leave you uncertain even when execution completed. Another submission could create an additional action.
For support, provide the public transaction hash, network and a description of the expected action through the verified service channel. Recovery words and private keys are unnecessary to read a public receipt. Do not pay a stranger who promises to unlock a supposed gas refund.
Five-minute practice: classify three records
Record A: a wallet confirmation is rejected, and there is no evidence of broadcast or inclusion. Record B: an included receipt has status 0x0, 40,000 gas used and effective price 8 gwei. Record C: an approval receipt succeeds, followed by a separate swap receipt with status 0x0.
Answer A: there is no demonstrated on-chain fee from that rejected action. Check separately if the account has another submitted transaction. Answer B: execution failed and the fee is 320,000 gwei, or 0.000320 ETH. Answer C: inspect both receipts and the current allowance; the later failure does not undo the earlier approval.
Practice prompt: Using only these fictional records, create one row per transaction. Separate evidence of inclusion, execution result, fee arithmetic and remaining unknowns. Do not infer a transfer from an attempted value or infer a refund from unused fee headroom.
For a real review, preserve the original receipt and observation time. Network inclusion and finality are separate checks, and a service's internal balance can lag its on-chain record. Mark unresolved facts explicitly instead of retrying until the screen looks reassuring.
- The transaction belongs to the intended network and account.
- A receipt, not only an app message, establishes included execution status.
- The fee uses individual gas used and effective gas price.
- Attempted value, actual transfers and gas cost are separate.
- Earlier approvals and other transactions are reconciled independently.
- The failure condition is understood before another paid attempt.
Sources & further reading
- MetaMask: gas paid for failed execution
- Ethereum: transaction lifecycle
- Ethereum: transaction receipt fields
- EIP-140: execution rollback and remaining gas
- Ethereum: gas limits and execution costs
- EIP-1559: fee caps and actual charges
Educational content. Examples are illustrative. Protocols, products and rules can change; consult the linked documentation for current details.
