Web3 Dictionary Logo
Web3 Dictionary
Contribute

Categories

AllBlockchainDappsDAOsDeFiNFTsRegulationSecuritySmart ContractsTokenomicsWalletsWeb3 GamingOthers
  1. Web3 Dictionary
  2. Smart Contracts
  3. Revert
Smart Contracts

Revert

Smart contract instruction that cancels transaction and reverts all state changes.

Last Updated

2026-03-19

Related Concepts

Smart ContractTransactionGas
Web3-Explorer Logo

Scale Blockchain Infra

AD

Smart contracts, protocol integrations, and scalable architecture for high-performance Web3 products.

See Blockchain Services

What is Revert?

A revert is a smart contract instruction that halts execution and rolls back all state changes from a transaction. It is the primary mechanism contracts use to enforce rules and reject invalid operations.

How does Revert work?

  1. A contract evaluates a condition via a require statement during execution.
  2. If the condition fails, a revert is triggered and all changes are rolled back.
  3. The user still pays gas for computation up to the point of failure.
  4. The transaction is recorded on-chain with a "Reverted" status and an error message.

Why does Revert matter?

Reverts enable atomic all-or-nothing transactions, ensuring a multi-step operation either completes fully or has zero effect. This is essential for safe financial interactions on-chain.

Key features of Revert

  • Complete rollback of all state changes within the failed transaction
  • Gas is still consumed up to the point of failure
  • Error messages help developers and users diagnose issues
  • Enables atomic multi-protocol transactions

Examples of Revert

Trying to swap more tokens than exist in a Uniswap pool triggers a revert. A mint contract reverts if the 10000 token supply cap has already been reached.

External References

  • Solidity Errors and Revert
  • Smart Contracts Overview