See Virtual TestNets in action! ⚡ Replace slow public testnets in dapp development. Join our Office Hours

Tenderly

A Guide to Tenderly TX Preview Snap

Learn all about Tenderly TX Preview Snap for MetaMask. Find out how to use it to preview transactions before sending them on-chain. Then, jump into Tenderly Debugger to inspect a failed transaction simulation and try out a possible solution.

Milica Lukic
Milica Lukic
Sep 12, 2023 · 4 min read

In this post

How to preview transactions on MetaMask with Tenderly Snap simulations

MetaMask Snaps allows you to extend the functionalities of the MetaMask wallet with your unique features and APIs. By using the open-source MetaMask Snap system together with the Tenderly Simulation API, we created Tenderly TX Preview Snap.

Using the Tenderly snap, you can preview the expected outcomes of your transactions without sending them on-chain. Tenderly TX Preview Snap gives you detailed and easily understandable information about your transactions, enabling you to sign and approve them with confidence and peace of mind.

How does Tenderly TX Preview Snap work?

The TX Preview snap simulates your transactions and gives you detailed information about their execution. It uses the Tenderly Simulation Infrastructure to run your transactions against more than 30 EVM-compatible networks, including Ethereum, Arbitrum, Optimism, Base, and Polygon. 

The snap then returns simulation data in a human-readable format instantly, displaying: 

  • Whether your transaction is successful or not.
  • Which ERC-20 and ERC-721 assets are transferred within your transaction.
  • The corresponding dollar values of your transferred assets based on real-time data. 
Transaction preview in MetaMask with Tenderly Snap
Transaction preview in MetaMask with Tenderly Snap

How does the Tenderly Snap protect wallet users?

With Tenderly TX Preview Snap, you can know what’s going to happen with your transactions before actually sending them. This helps you avoid any unwanted consequences, prevent failed transactions, and save money on gas. 

Additionally, you receive this information automatically after installing the Tenderly TX Preview snap, without having to execute transactions on a real network. And you don’t even need technical knowledge to run or interpret simulations.

Yes, it’s that easy! 😎

How to preview transactions using the Tenderly snap

To start using Tenderly TX Preview snap, you just need to set it up by following a few simple installation steps. The process is quick and straightforward, automatically setting up your credentials. 

Once you’ve completed the installation, you can head over to any DeFi platform you typically use. After being prompted to confirm a transaction on MetaMask, you’ll notice a new “Tenderly TX Preview” tab. Here, you’ll find an overview of your simulated transaction, with details on its status, asset changes, and real-time dollar values. 

Want to see it in action? 👀 Check out this short tutorial: 

What you can do with simulated transactions

The Tenderly TX Preview snap gives you a few additional options if you’d like to further inspect your simulated transactions. Here’s how to dive deeper and get more granular information on your transaction simulations using Tenderly: 

1. Inspect and debug a failed transaction instantly 

In the TX Preview tab, you also get a link to the simulated transaction leading you to the Tenderly Dashboard. Once you open it, you can inspect the simulation in greater detail, including the contracts it interacted with, how much gas it used, which events were emitted, and which state changes happened. 

An overview of a transaction simulation on Tenderly
An overview of a transaction simulation on Tenderly

This can be particularly useful in the event your transaction fails since you can immediately see what happened and try to fix it. Simply jump into Tenderly Debugger to step through the transaction trace by trace and analyze the exact cause of the failure.  

Debugging a failed transaction simulation on Tenderly
Debugging a failed transaction simulation on Tenderly

2. Re(simulate) a transaction for new outcomes

After inspecting a failed transaction in detail, you can immediately test out a potential solution. Tenderly’s Transaction Simulator allows you to replay failed transactions with updated parameters and validate bug fixes. 

Just click the Re-Simulate button to initiate a new transaction simulation. Then, you can change transaction parameters, update state overrides, and even modify contract source code. After making the necessary changes, click Simulate to see whether your adjustments were successful.

3. Share a simulated transaction publicly with anyone 

Finally, transaction simulations in Tenderly TX Preview Snap, as well as on the Tenderly platform, are publicly shareable. This means you can share your simulations with anyone regardless of whether they have a Tenderly account. This way, you can encourage knowledge sharing among your team members or seek assistance with failed transactions. 

Start getting transaction previews in your MetaMask wallet

You don’t have to approve transactions hoping for the best. With Tenderly TX Preview Snap, get exact and clear insights into transaction outcomes before even sending them to a network. Use this information to inform your decisions, avoid making a mistake, and save valuable resources. 

And with the Tenderly Simulation API, you can integrate the same functionality into your wallet or dapp. This way, you can bring additional value to wallet users, improve their experience in Web3, and support wider blockchain adoption. 

If you’d like to try integrating transaction simulations yourself, follow this step-by-step tutorial showing how to add the same functionality to MetaMask Snap. Also, to learn how transaction simulations work, head over to the Tenderly Dashboard and try simulating transactions.  

Use Tenderly Node Extensions to build custom RPC endpoints that fit your dapp without changing its existing logic. Optimize dapp performance, improve user experience, and get greater control and flexibility both on-chain and during development.

Try Tenderly Node Extensions