When Your Transaction Fails on Polygon…

If you spend some time on any network, a connection is bound to fail. That applies to your home Internet, a call on your phone, or even the Polygon network. This article is a quick explainer on how to you might resolve a failing transaction.

#1 Try it again

The definition of craziness is doing the same thing over and over again expecting a different result… except sometimes it works. A temporary blip on a network like Polygon can sometimes be resolved by waiting things out.

#2 Try disconnecting your wallet

Sometimes a connection to the network just needs to be reset. Try disconnecting your wallet then reconnecting and see if the issue resolves itself.

On Metamask you can tap on “Connected” then the three dots to disconnect

#3 Up your gas limit or price

At the busiest times of day the network can get congested and your transaction may fail if the gas price or limit is too low.

Metamask lets you edit your Gas Price or Limit easily

Use a site like polygongasstation.com to learn about the averages and adjust accordingly. I sometime use gas prices that are 3–5x what the site recommends just to get it done. Don’t worry, the transaction cost on Polygon is so low the difference is usually fractions of a cent. I’m not gonna explain gas price versus limits here but read this article for more info.

#4 Change your RPC

If your transaction continues to fail after the above try changing your RPC (Remote Procedure Call). An RPC is your way of connecting with the network. Different groups can create an RPC for use and some are more congested than others. Y

ou can see a list of RPCs from Polygon here. Just because it isn’t on that list though doesn’t mean it isn’t legit. There are thousands of RPCs out there and even private ones just for you (if you want to pay for them) or set them up on your own.

You can change your RPC on Metamask pretty easily: follow this guide or the one below:

First, find a good RPC. I like the ones in the article here or but you can find others by searching online. Make sure you trust the provider!

Then you can change the RPC in your wallet by adding a Custom RPC, entering the RPC info, and saving. Try your transaction again afterward. The below screenshots are captioned to assist you at each step.

1. Open Metamask and click on the network dropdown.
2. Click on “Custom RPC” to add another RPC
3. Enter the information for the RPC and click Save

#5 If all else fails, write to the contract

One of my favorite parts of DeFi is that you don’t need to deal with a site’s user interface at all, and in an emergency can always write directly to the smart contract. To do so you’ll need a couple of things:

  • Set up a wallet browser capable of interacting with Web3 elements (I use Metamask)
  • Find the contract you want to interact with (I’ll give you an example below)
  • Connect to the contract over Etherscan or Polygonscan
  • Write to the contract

Finding your contract

Want to write to a smart contract directly? Search the documentation of your protocol for the contract you are looking for then enter it at Polygonscan.com. If you’re not sure which contract you interacted with you can search your Metamask transactions.

The contract you interacted can be copied.

Connect to the contract at Etherscan or Polygonscan

To interact with a contract on Polygon you’ll need to connect to it with a web3 capable wallet. Head to polygonscan.com, enter the contract address, click on contract, then “Write Contract”.

In this case I want to interact with Qi DAO’s farm.

Afterward, you’ll connect to it by clicking “Connect to Web3” and then confirming in your wallet.

You can then interact with the contract however you’d like, as long as you have the right permission to do so. A couple of things to keep in mind:

  • When you’re reviewing a transaction you’ll need to decode it to be human readable. Polygonscan.com helps you do that.
Robot speak needs translated.
  • Notice how amounts are formatted. You may need to refer to an example transaction to get it right. In the below case I deposited 14.042375908289341684 LP tokens.
  • You’ll often need to find a _pid (pool ID) to interact with a vault or farm.

Writing to a contract: emergency withdraw example

Let’s say for some reason I want to emergency withdraw from the QiDAO farm for Qi/MAI.(I doubt I will ever actually have to do that but you never know: frontend website can fail during a DDOS or due to another issue).

  1. I go look at my previous transaction where I interacted with the contract and find the contract address (or I look it up on the Qi DAO docs): 0x574Fe4E8120C4Da1741b5Fd45584de7A5b521F0F
  2. Using that at Polygonscan.com I search for the contract, click on “Write Contract”, connect to it using web3, and then look for the emergencyWithdraw action.
  3. I enter my _pid of 2 then click on “Write”. Afterward, Iapprove the transaction in my wallet and the LP tokens are back in my wallet. Boom.

Have more steps for resolving a transaction failing? Need specific help with a transaction? Let me know via a DM over Twitter and I’ll see what I can do!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Revolutionary Spaces

Revolutionary Spaces

I swear to God if you tell me to “Slurp up that dipperino!” one more time…