Skip links

Table of Contents

[SOLVED] “evm: execution reverted” Error

Have you ever faced a sudden stop sign while navigating the Ethereum universe? Meet the execution reverted errors, the EVM’s way of keeping things in check. Imagine the Ethereum Virtual Machine (EVM) as a smart, powerful computer that runs the show for Ethereum’s smart contracts. But sometimes, things don’t go as planned. This is where “EVM execution reverted errors” come in. Think of them as the EVM saying, “Oops, something went wrong!” These errors stop a contract when there’s a problem. For people who make these contracts, understanding these errors is super important. It helps them fix mistakes and make everything run smoothly. And for users, it means less trouble and better trust in using Ethereum. Let’s learn more about these errors and why they matter.

What are EVM Execution Reverted Errors?

Navigating through the Ethereum blockchain can sometimes feel like a thrilling puzzle, especially when you encounter something known as an “EVM execution reverted error.” Let’s break this down in a simple way, so even if you’re new to Ethereum, you’ll understand what these errors are, how they’re different from other errors, and what typically causes them.

What Are EVM Execution Reverted Errors?

Imagine you’re playing a video game where you need to follow specific rules to move to the next level. Now, if you don’t follow a rule, the game stops you from moving forward. EVM execution reverted errors are similar. They occur when a smart contract on the Ethereum blockchain hits a snag because a certain rule or condition isn’t met. These errors are the EVM’s way of saying, “Wait, we can’t do this because something is not right.” This stop is important because it prevents any bad or incorrect transactions from happening.

How Are They Different from Other Ethereum Errors?

Ethereum can have several types of errors, but EVM execution reverted errors are unique. They specifically relate to the rules and logic of smart contracts. Unlike other errors that might happen because of technical issues like network problems or incorrect gas estimates (which is like the fee you pay to make transactions), EVM execution reverted errors are all about the contract’s code and logic. They are the EVM’s method of enforcing the contract’s rules strictly.

Common Causes of EVM Reverted Errors

Smart Contract Business Logic Violations

Imagine a smart contract as a set of rules that everyone agrees to follow. Now, if someone tries to do something that goes against these rules, the EVM steps in and stops it. This is what we call a business logic violation. For example, if a contract is designed to only allow withdrawals of a certain amount of cryptocurrency, and someone tries to take out more, the EVM will revert the transaction, saying, “You can’t do that!”

Out of Gas Errors

Ethereum transactions require fuel, known as “gas,” to run. Each operation in a transaction costs a certain amount of gas. If you start a transaction without enough gas, it’s like trying to drive a car without enough fuel – you won’t get far. The EVM stops these transactions, indicating you’ve run out of gas.

Invalid JUMP and Stack Overflow/Underflow Errors

These errors are a bit more technical but think of them as the EVM getting confused due to a misdirection or overload. An invalid JUMP error occurs when a transaction tries to execute an operation that doesn’t exist or isn’t currently available. Stack overflow and underflow errors happen when there’s too much or too little data in the EVM’s memory stack, respectively. It’s like trying to put too many or too few books in a stack; either way, it becomes unstable.

Invalid Opcode Errors

Opcode stands for “operation code,” which is a part of the EVM’s language. An invalid opcode error happens when the EVM encounters an unknown or invalid command. It’s like giving someone instructions in a language they don’t understand; they won’t know what to do.

LedgerAPI Errors and Other Specific Scenarios

These errors are specific to certain interfaces and tools used in Ethereum, like Ledger Live. They usually occur due to issues like network congestion or incorrect transaction pricing. It’s similar to trying to make a call during a network outage – the call just won’t go through.

Understanding these common causes of EVM reverted errors can be a huge help in navigating Ethereum’s ecosystem. It’s all about knowing the rules, having enough gas, giving clear instructions, and being aware of network issues. With this knowledge, you’ll be better equipped to handle the challenges of Ethereum transactions and smart contract interactions.

Debugging EVM Reverted Errors

When encountering EVM reverted errors, practical examples can be incredibly helpful to understand the application of various debugging tools. Here are some scenarios to illustrate their use:

Using Remix Debugger UI

Example Scenario: You have a smart contract for a voting application and encounter an error when a user attempts to vote.

How Remix Helps: With Remix Debugger UI, you input the transaction hash that failed. The debugger lets you step through the transaction. You notice that the error occurs at a line where the contract checks if the user has already voted. The error is because the contract incorrectly flags the user as having voted already, even on their first vote. This visual step-by-step process makes it easy to spot where things go wrong.

Utilizing Truffle Debug

Example Scenario: A token contract transaction fails during a token transfer.

How Truffle Helps: By running truffle debug <transaction_hash>, you enter a debugging session for the failed transaction. As you step through the code, you find that the error is due to insufficient token balance in the sender’s account – a detail you might have overlooked without this detailed inspection.

Implementing Custom Code for Transaction Inspection

Example Scenario: A smart contract for an auction fails when a bid is placed.

How Custom Code Helps: You write a script using Ethereum’s JSON RPC API to simulate the transaction. This script reveals that the bid is lower than the current highest bid, causing the failure – a fact not evident from the transaction receipt.

Leveraging REST API Gateway Features

Example Scenario: A transaction in a decentralized application fails to process.

How REST API Helps: Using a service like Infura, you send a request to the REST API with the transaction details. The API returns a more detailed error message, indicating that the transaction failed due to a mismatch in the contract’s expected parameters.

Employing Tenderly Debugger for Detailed Analysis

Example Scenario: A complex transaction in a DeFi contract fails, with the cause unclear.

How Tenderly Helps: After inputting the transaction into Tenderly, you see a detailed trace. It reveals that the transaction fails due to an unexpected reentrancy bug. Tenderly shows the state changes and function calls that led to this issue, which would have been difficult to trace manually.

Case Studies and Examples of EVM Reverted Errors

Exploring real-world cases and specific examples of EVM reverted errors can provide invaluable insights into their nature and resolution. Let’s delve into a few instances that highlight common issues encountered in Ethereum smart contract development, along with their analysis and solutions.

Case Study 1: The Overdrawn Token Transfer

Scenario: In a token transfer transaction on a DeFi platform, users repeatedly faced the execution reverted: transfer amount exceeds balance error.

Analysis: The smart contract was designed to transfer tokens from one account to another. However, users attempting to transfer more tokens than they had in their balance triggered this error. This is a classic case of a business logic violation where the contract’s conditions weren’t met.

Resolution: The developers updated the user interface to clearly show available token balances and added checks to prevent users from entering an amount greater than their current balance. Additionally, the error message was made more user-friendly to enhance understanding.

Case Study 2: The Gasless Vote

Scenario: A decentralized voting application saw transactions failing with the error execution reverted: out of gas.

Analysis: This error occurred because the gas limit set for the transaction was insufficient to execute all the operations required by the voting contract. The gas estimation was not accurately accounting for the contract’s complexity.

Resolution: The developers implemented a dynamic gas estimation mechanism in the application that considered the current state and complexity of the smart contract, ensuring sufficient gas was provided for each transaction.

Case Study 3: The Failed Auction Bid

Scenario: An auction contract was reporting execution reverted: invalid jump destination errors.

Analysis: This error was traced back to a function in the contract that was improperly jumping to a non-existent or wrong part of the code. The issue was due to a bug in how the contract’s functions were organized and called.

Resolution: The contract code was refactored, ensuring all jumps and calls were correctly directed to valid functions. Comprehensive testing was conducted to prevent similar issues in the future.

Case Study 4: The Unreachable Function

Scenario: A complex financial smart contract was giving the execution reverted: invalid opcode error.

Analysis: The error was caused by the contract trying to execute an operation that was not supported by the EVM. It turned out that the contract was compiled with a newer version of Solidity that was not fully supported by the current EVM.

Resolution: The contract was recompiled with a compatible Solidity version, and tests were run to ensure all operations were supported by the EVM. Developers also ensured that future contracts would be compatible with the EVM version used on their target network.

Best Practices to Avoid EVM Reverted Errors

Minimizing EVM reverted errors is crucial for a seamless experience in Ethereum smart contract development. Here are some best practices to help prevent common mistakes and ensure the robustness of your smart contracts:

Writing Robust Smart Contract Code

  • Clear and Concise Logic: Write clear, straightforward code. Avoid complex and convoluted logic that can lead to misunderstandings and errors.
  • Validate User Inputs: Always validate inputs to your functions. This can help prevent unexpected behavior and ensure that your functions are being used correctly.
  • Handle Exceptions Appropriately: Use require, revert, and assert statements judiciously to handle exceptions and ensure that errors are clear and informative.
  • Avoid Loops Where Possible: Loops can lead to out-of-gas errors if not carefully managed. Try to design contracts that minimize the use of loops, especially those with potentially unbounded iterations.
  • Use Modifiers for Reusability: Modifiers can help you manage repetitive tasks like access control, reducing the chances of mistakes.

Regular Testing and Auditing Practices

  • Unit Testing: Write comprehensive unit tests for your smart contracts to ensure that each function behaves as expected in various scenarios.
  • Integration Testing: Test how your contracts interact with each other and with other contracts to catch any integration issues.
  • Use Test Networks: Before deploying on the mainnet, use testnets like Ropsten or Rinkeby to thoroughly test your contracts in an environment that simulates the Ethereum mainnet.
  • Professional Audits: Engage with professional auditing firms to review your code. They can provide an expert perspective and identify vulnerabilities you might have missed.

Keeping Abreast with Ethereum Updates and Community Best Practices

  • Stay Updated with Ethereum Releases: Follow Ethereum updates and understand how changes in the network, like upgrades or hard forks, may affect your contracts.
  • Follow Solidity Releases: Keep track of Solidity updates, as new compiler versions can introduce optimizations and changes in behavior.
  • Engage with the Community: Participate in Ethereum developer forums, Reddit, Stack Exchange, and other platforms to learn from others’ experiences and keep up with best practices.
  • Leverage Established Patterns: Use design patterns and best practices established by the Ethereum community to avoid common pitfalls.
  • Continuous Learning: The blockchain space evolves rapidly. Commit to continuous learning to stay ahead of new challenges and solutions in smart contract development.

Future of EVM Error Handling

The Ethereum ecosystem, including the Ethereum Virtual Machine (EVM) and Solidity, is evolving with a strong focus on improving error handling. Here’s a brief look at what the future holds:

Enhancements in EVM and Solidity

  1. More Detailed Error Reporting: Future Solidity versions aim to provide clearer error messages, possibly indicating the exact location of issues in the code.
  2. Richer Revert Reasons: Efforts are underway to enable more informative explanations within revert statements, helping developers understand transaction failures better.
  3. Advanced Debugging Tools: Expect more sophisticated tools integrated with development environments, offering deeper insights into smart contract execution.
  4. Optimized Gas Usage and Error Handling: Upcoming EVM updates may reduce the cost of failed transactions through optimized gas usage.
  5. Improved Security Checks: The EVM might include automated checks for common vulnerabilities to enhance contract security.

Community Efforts for Developer-Friendly Diagnostics

  1. Community Initiatives: The Ethereum community actively participates in forums and discussions, proposing features and improvements for better error handling.
  2. Educational Resources: An increasing number of resources and best practices are being made available to educate developers on avoiding common errors.
  3. Collaborative Tool Development: Debugging tools are often developed with community input, ensuring they meet the needs of Ethereum developers.
  4. Ethereum Improvement Proposals (EIPs): The EIP process continually refines Ethereum, including aspects of error diagnostics and handling, for a better developer experience.

These advancements promise to make Ethereum’s platform more robust, secure, and user-friendly, enhancing its appeal as a top choice for decentralized application development.


Understanding and handling EVM execution reverted errors is crucial in the ever-changing world of Ethereum development. These errors are key to ensuring the integrity and smooth functioning of smart contracts on the Ethereum blockchain. As a developer in this space, it’s essential to stay informed and adapt to new advancements in EVM and Solidity, as well as to actively engage in continuous learning. Embracing these challenges and updates not only enhances your skills but also contributes to the growth and reliability of the Ethereum ecosystem. As we move forward, the ability to navigate and resolve these errors efficiently will remain a vital part of successful Ethereum development.


What is an EVM execution reverted error in Ethereum?

  • An EVM execution reverted error occurs when a transaction or smart contract operation violates the rules or logic set in the contract, prompting the Ethereum Virtual Machine to stop and revert the transaction.

Why are EVM execution reverted errors important in Ethereum?

  • These errors are crucial for maintaining the integrity and reliability of smart contracts on the Ethereum blockchain. They ensure that only valid transactions that comply with the contract’s rules are executed.

How can I prevent EVM execution reverted errors in my smart contracts?

  • To prevent these errors, ensure your smart contract code is clear, follows best practices, and undergoes thorough testing and auditing. Regularly update your knowledge about Ethereum and Solidity to avoid common pitfalls.

What are some common causes of EVM execution reverted errors?

  • Common causes include violations of smart contract business logic, insufficient gas for transaction completion, invalid JUMP or stack errors, and attempts to execute undefined operations in the contract.

Can EVM execution reverted errors be fixed after deploying a smart contract?

  • Once a smart contract is deployed on Ethereum, its code cannot be altered. However, understanding the cause of the error can help in creating a new, corrected version of the contract.

What is gas in Ethereum, and how does it work?

  • Gas in Ethereum is a unit that measures the computational effort required to execute operations. Each transaction requires gas to process, and users pay gas fees to compensate for the computational resources used.

What is Solidity, and why is it important for Ethereum development?

  • Solidity is a programming language specifically designed for writing smart contracts on the Ethereum blockchain. It’s essential for developers to create the logic for decentralized applications and transactions.

Can Ethereum smart contracts be used for real-world applications?

  • Yes, Ethereum smart contracts are increasingly being used in various real-world applications, including finance (DeFi), gaming, supply chain management, and more, due to their secure and decentralized nature.

What is the difference between Ethereum and Bitcoin?

  • Ethereum and Bitcoin are both cryptocurrencies, but Ethereum offers more functionality with its smart contract capabilities, enabling a wider range of decentralized applications beyond just transactions.

Is it possible to retrieve lost Ether from a failed transaction?

  • If a transaction fails (like due to an EVM execution reverted error), the Ether used in the transaction is not lost but returned to the sender. However, the gas fees paid for the transaction are not recoverable.

Metana Guarantees a Job 💼

Plus Risk Free 2-Week Refund Policy ✨

You’re guaranteed a new job in web3—or you’ll get a full tuition refund. We also offer a hassle-free two-week refund policy. If you’re not satisfied with your purchase for any reason, you can request a refund, no questions asked.

Web3 Solidity Bootcamp

The most advanced Solidity curriculum on the internet!

Full Stack Web3 Beginner Bootcamp

Learn foundational principles while gaining hands-on experience with Ethereum, DeFi, and Solidity.

You may also like

Metana Guarantees a Job 💼

Plus Risk Free 2-Week Refund Policy

You’re guaranteed a new job in web3—or you’ll get a full tuition refund. We also offer a hassle-free two-week refund policy. If you’re not satisfied with your purchase for any reason, you can request a refund, no questions asked.

Web3 Solidity Bootcamp

The most advanced Solidity curriculum on the internet

Full Stack Web3 Beginner Bootcamp

Learn foundational principles while gaining hands-on experience with Ethereum, DeFi, and Solidity.

Learn foundational principles while gaining hands-on experience with Ethereum, DeFi, and Solidity.

Events by Metana

Dive into the exciting world of Web3 with us as we explore cutting-edge technical topics, provide valuable insights into the job market landscape, and offer guidance on securing lucrative positions in Web3.

Start Your Application

Secure your spot now. Spots are limited, and we accept qualified applicants on a first come, first served basis..

Career Track(Required)

The application is free and takes just 3 minutes to complete.

What is included in the course?

Expert-curated curriculum

Weekly 1:1 video calls with your mentor

Weekly group mentoring calls

On-demand mentor support

Portfolio reviews by Design hiring managers

Resume & LinkedIn profile reviews

Active online student community

1:1 and group career coaching calls

Access to our employer network

Job Guarantee