Skip to main content

What Happens If a Transaction Runs out of Gas during Execution?

If a transaction runs out of gas, its execution stops immediately, and all changes to the blockchain state that occurred during the execution are reverted (the transaction fails). However, the sender still pays the transaction fee for the gas that was consumed up to the point of failure.

This mechanism prevents malicious or buggy smart contracts from indefinitely consuming network resources and ensures miners are compensated for the work they performed.

What Happens If a Transaction Runs out of Gas before Completion?
What Happens to the Gas Fee If a Smart Contract Execution Fails?
How Does the ‘Out-of-Gas’ Error Impact a Smart Contract Transaction’s State Change?
Why Is the Consumed Gas Not Refunded upon Transaction Failure?