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


Improving Dapp UX with Transaction Simulations

Transaction failures are not only costly but also leave a big dent in the user experience of your dapp. Explore how transaction simulations can help alleviate anxiety and improve user experience (UX).

Danilo Danicic
Danilo Danicic
Jan 24, 2023 · 4 min read

In this post

Improving Dapp UX with Transaction Simulations

Transaction failures can happen for various reasons, such as slippage issues or insufficient gas. In fact, more than 900k transactions on the Mainnet were rejected in December 2022 alone.

All these failed transactions cost the senders gas fees. But besides the financial losses, one critical facet of failed transactions often gets overlooked: user frustration and confusion, resulting in a poor user experience.

In this article, we’ll dig deeper into the negative impact of failed transactions on dapp users. We’ll also look into a promising solution that can help alleviate anxiety when sending transactions. By the end of this article, you’ll have a better understanding of how transaction simulations could drive an excellent user experience and help increase user satisfaction.

Failed transactions – a blow to user experience

While the financial losses hit home the hardest, this is not the only negative side effect of failed transactions. At the end of the day, transaction failures also leave a big dent in the users’ experience, degrading confidence in the DeFi ecosystem and negatively impacting adoption.

When transactions fail, users often feel confused and frustrated because they may not understand what exactly happened. And without actionable information on how to solve the issues, users are pushed to take a "fingers-crossed" approach to sending transactions. Ultimately, this can result in a loss of trust in the dapp and drive users to disengage or abandon the platform.

To stay ahead of the curve, modern dapps should proactively work on mitigating the effects of common anxiety triggers for their users. This involves helping both newcomers and experienced users prevent failures and financial losses while providing greater visibility into transaction execution.

Alleviating user anxiety with simulations

Whether you’re running a standard app or a dapp, users expect a seamless and reliable experience. In this context, dapps should offer their users functionality to detect and prevent transaction issues early, before making a commitment.

One possible solution is to introduce a transaction simulation feature as an integral part of the dapp’s UI. Rather than sending transactions on-chain right away, transaction simulations would allow users to preview the transaction’s outcome. Since simulations are carried out in a risk-free environment, there are no financial risks to the user if the transaction fails.

By integrating the ability to simulate and send transactions into a single UI, dapps can proactively address the common anxiety triggers for users and:

  • Provide more visibility and predictability: Simulations can help dapp users better understand transaction costs and prevent undesired outcomes. Empowering users to simulate before sending can also give them a clearer understanding of all aspects of the transaction execution. It also enables them to optimize parameters for better results or pull out of sending the transaction based on feedback gathered from simulations.
  • Prevent unnecessary losses and overspending on transactions: Whether a transaction is successful or not, gas is still consumed. Simulations can help dapp users get a clearer picture of how much gas is needed to process their transactions successfully.
  • Make it easier for newcomers to reap the benefits of DeFi: Newcomers may hesitate to jump on board DeFi out of fear of losing money on failed transactions. Through simulations, dapp users get a forgiving simulated Mainnet environment – a playground for onboarding and trying out the dapp without the risk of losing real money.

For this functionality to work, simulations would need to be executed against accurate Mainnet data to ensure the reliability of results. This would require dapps to run their own node infrastructure, which could increase costs and overhead.

Or they could use a managed solution such as Tenderly’s Transaction Simulator and go to market faster. With over 50 million simulations processed per month, Tenderly is the leading solution in the space offering such capabilities.

Pioneering simulations to enhance UX

Some of the most popular DeFi projects out there have already recognized the benefits of simulations with Tenderly’s Transaction Simulator. They have already exposed this functionality to their users.

As one of the leading players in DeFi, Instadapp was among the early adopters of transaction simulations. The platform integrates with Tenderly’s Simulation API to allow users to simulate different scenarios on a Mainnet fork before deciding to execute transactions on-chain.

This forgiving, sandbox-like environment enables Instadapp users to preview the outcomes of transactions without financial risk. When the users are satisfied with the simulation outcome, they can switch off the simulation mode and continue trading.

Another DeFi product making use of simulations is Safe, which allows users to dry-run transactions before sending them on-chain. Before users sign off on a transaction, they can see what impact it will have and then decide whether or not to authorize it.

All these user-generated simulations coming from Instadapp and Safe go through Tenderly’s Simulation API.

Unpack Tenderly simulations into your dapp

Tenderly executes all simulations against the latest state of the blockchain. This ensures that the simulation results accurately reflect what would happen when the transaction is sent on-chain.

To integrate this functionality into a dapp, there are two possible approaches, depending on specific use cases:

Both solutions provide similar levels of flexibility and reliability. The Simulation API receives the simulation requests, processes them, and returns the results to the dapp. This approach is ideal for internal testing and development.

But going through Tenderly Web3 Gateway brings everything together, providing dapps with a unified platform to dry-run and send transactions.

Tenderly Web3 Gateway allows dapps to simulate and send transactions using a single JSON-RPC link. This significantly removes the barriers and overhead of integrating different services to play nice together.

To make this possible, Tenderly developed a custom RPC endpoint within Web3 Gateway – tenderly_simulateTransactionwhich can be called like any standard eth_ endpoint.

Once the user is satisfied with the simulation results, the dapp can call the eth_sendRawTransaction and enable the user to send the transaction through a single URL.

To illustrate how all this comes together in a real-world scenario, we recently hosted a virtual workshop to show you how to extend the Uniswap UI by integrating transaction simulations. The techniques outlined in this workshop explain the basic concepts, but they could also serve as a great starting point for larger DeFi projects.

Check out the full demo here:

Simulate via Tenderly Web3 Gateway

Get started with simulations in Tenderly Web3 Gateway in three simple steps. Launch Web3 Gateway, grab the Mainnet RPC URL and paste it into your code.

Happy simulating!