跳到主要内容

A transaction failed when interacting with a smart contract. What can I do?

Does this article need to be translated?

Contribute to the Help Center

Submit translations, corrections, and suggestions on GitHub, or reach out on our Community forums.

Smart contracts are the bedrock of what makes Ethereum — and, nowadays, many other smart-contract enabled networks — so special. Rather than just a decentralized blockchain for recording a sequence of transactions, smart contract platforms like Ethereum allow virtually anyone to create and run computer programs that interact with their blockchain. These programs are known as smart contracts, and they run on the Ethereum Virtual Machine (EVM).

信息

Transaction?

In this context, when we say 'transaction' we're referring to any point at which a smart contract needs to modify or update the state of the Ethereum network. Day-to-day, most of your transactions on Ethereum are likely to involve smart contracts. If you use MetaMask Swaps, for example, you'll be interacting with one.

Your failed smart contract transaction is more than likely an output from one of these programs (smart contracts) that mandates updating the state of your or others' accounts on the EVM.

Since the functions and design of smart contracts can vary enormously — Ethereum is 'Turing-complete', meaning it can perform any computable task — there are many different reasons why a transaction prompted by one could fail. Solidity, the programming language used for Ethereum smart contracts, also allows the authors to define custom error messages with any conditions they choose, further increasing the potential scope.

You can see the error message for your failed transaction by finding the transaction on Etherscan (or the appropriate block explorer for the network you're on) using its transaction hash/ID.

Although it's virtually impossible to exhaustively document smart contract errors, we have already documented many common ones. Simply type 'Error' in the search bar to see them, or just search more specifically for the one you're experiencing.

If you still need help, feel free to get in touch with Support via the 'start a Conversation' button on the homepage of this site. (If it doesn't appear, try turning off ad blockers or any other features that might interfere, such as a VPN.)