project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

Replay

A tool to replay failed transactions in a convenient and easy way.

Replay

Created At

Superhack

Winner of

trophy

🏊‍♀️ Optimism — Super Pool Prize

trophy

🥇 Covalent — Best Use

Project Description

Replay is a tool for replaying failed transactions on any of the sponsors' chains: Optimism, Base, Zora (incl. testnets).

The idea was inspired by the task #100 on the Optimism ecosystem contributions list (https://github.com/ethereum-optimism/ecosystem-contributions/issues/100).

For most users that are not tech-savvy it's a challenge to replay failed transactions. So this tool makes it easy and convenient by providing a simple-to-use interface. Additionally, it's also a developer tool as it should be equally convenient for them to replay failed tx's through it. Failed transactions could include approvals, functions calls (like in the demo depositing into WETH) or cross-chain messaging and deployments.

When connecting your wallet, it automatically loads all recent transactions. For demo purposes successful and failed transactions are shown (checkmark or warning icon). Only the failed transactions can be replayed. For any transaction data fetching, I used the sponsor Covalent and its APIs.

Switching networks to Optimism, Base, Zora (incl. testnets) will automatically reload the transactions for the connected account on that network. So also transactions for any of these networks can be replayed. It's a tool for everyone on any chain.

Clicking the replay button a popup will open that shows the selected transaction hash at the top (which can also be opened in the block explorer).

An original feature from the idea on the Optimism contributions list was to be able to customize the gas limit. This is possible but I took it even further. On opening the popup the app will automatically estimate the fees for the tx but also auto-populate the custom gas limit.

Additionally, I added tenderly for simulations of the transaction. So the user can be really sure that this transaction will go through. In the demo, I also show that this works in terms of putting a custom gas limit that is too low.

So in most cases here the user won't even have to do anything but just verify that the tx would go through and then go with all automatically provided values.

When hitting the replay button in the popup, this will open your wallet where you can sign the transaction - which then should be successfully replayed. In the success screen this can be verified on Etherscan too.

How it's Made

The project is based on the optimism starter (https://github.com/ethereum-optimism/optimism-starter) which is a great template for hackathons.

Since it's a fronted project, the main frameworks used are viem, wagmi and ChakraUI (all w/ typescript).

For fetching any transaction data, I used the API's of Covalent.

In addition to the original idea of the Optimism ecosystem contributions list, I added automatically fetching the gas limit and also for security of the user (to prevent another failed transaction), I added tenderly simulations.

Once the recent transactions where fetched (via Covalent API) and the user selected a tx to replay, the process of replaying transactions mainly works like this:

  • use the transaction hash and fetch a transaction object with viem/wagmi (getTransaction, line 78 ReplayTransaction.tsx)
  • use that tx data to estimate fees
  • determine whether to use custom gas limit (input by the user) or auto-set it
  • copy all necessary transactions data (especially to, from, data/input, value are important) to prepare it for sending a new transaction (replaying)
  • simulate tx with tenderly (to make sure it won't fail)
  • send tx
background image mobile

Join the mailing list

Get the latest news and updates