Tenderly's Optimistic Rollup Network Report is live! 🎉 Explore how optimistic rollups help scale Ethereum ecosystem!

Smart Contracts

How to Use Account Abstraction and Transaction Simulations to Improve Wallet UX

Learn how account abstraction and transaction simulations improve user experience in smart contract wallets. Integrate simulations into your smart wallets and bring more security and control to your users.

Nebojsa Urosevic
Nebojsa Urosevic
Apr 5, 2023 · 4 min read

In this post

How to Use Account Abstraction and Transaction Simulations in Smart Contract Wallets

Smart contract wallets are code-based solutions that allow users to set up their transaction authorization logic and specify custom rules. For instance, wallet users can set transaction limits, require multiple signatures, freeze compromised accounts, and more. However, transactions still need to come from an Externally Owned Account (EOA).

With the account abstraction EIP, smart contract wallets can offer an even better experience to users. Thanks to account abstraction, smart contract wallets are no longer dependent on EOAs to initialize transactions. Users still need private keys for authentication, but they can rely on security measures beyond private-public key pairings.

So, account abstraction opens up new possibilities for wallet users without requiring them to have technical knowledge. It allows smart contract wallets to offer an even safer, more flexible, and even more accessible experience to end users. And this is just the beginning.

What are some benefits of account abstraction for wallet users?

Sending transactions to the blockchain has been a major friction point for users. While the wallet interface can guide individuals throughout the process to some extent, they don’t really know what’s happening behind the scenes.

Account abstraction is a step towards removing this complexity and making a wallet experience more accessible to users. Here are some of the benefits this upgrade brings:

  • Less technical knowledge needed: With a limited understanding of the underlying technology, wallet users can easily authorize incorrect or malicious transactions. Account abstraction removes this complexity and allows users to interact with smart contract wallets intuitively without having to decipher transaction data. It enables them to set up different security measures through wallet settings rather than code.
  • Greater safety: Users don’t have to worry about losing their private keys and, therefore, access to their funds. Account abstraction makes wallets easier to recover through pre-defined safety measures. Plus, users can set up their own security rules.
  • Easier gas payments: Gas payments are also user-friendlier thanks to paymasters and bundlers, two important components of the account abstraction system:

    1. The paymaster mechanism enables users to pay gas in tokens other than ETH, which wasn’t possible prior to account abstraction. The token swap then takes place within the contract itself. A paymaster also allows dapp developers to subsidize users’ gas fees through third-party mechanisms. This brings additional flexibility to wallet users.

    2. The bundler mechanism also makes gas payments more affordable. It tracks the alternative mempool, gathers transactions that meet certain conditions in a bundle, and executes the bundle on-chain. The bundler pays the gas fee for the entire bundle and gets compensated from individual transactions.
  • Better user experience: All of the previous benefits make smart contract wallets easier to use. Without worrying about losing their private keys and with the ability to set up their own security measures, users can enjoy a much better, frictionless experience when using wallets.

Why wallet users should still be able to simulate transactions

Transaction simulations also play an important role in making wallets more accessible to users. Simulating a transaction before submitting it to the blockchain enables a user to preview its execution and effects. And having this insight into a transaction’s execution while it’s still off-chain brings greater confidence and less anxiety among users.

By incorporating simulations into account abstracted wallets, you can empower your users to:

  • Validate the smart wallet logic: Thanks to account abstraction, users don’t need to have the technical knowledge required to understand the logic behind their contract wallets and transactions. However, they should still be able to validate everything executes as expected instead of signing transactions blindly. So, simulate to validate!
  • Reduce security risks: While smart contract wallets are generally safer to use, they can still be a target of an exploit. By validating a contract wallet’s logic through simulations, users can identify potential security issues early on.
  • Gain better insight into tx outcomes: Remember the guy who sold his Bored Ape NFT for $3,000 instead of $30,000? That’s not a small mistake to make, but it’s an easy one. With transaction simulations, users can see tx effects before they actually take place. This insight helps them inform their decisions and understand what would happen if their transactions were executed on-chain.
  • Get greater confidence and an even better experience: Combining account abstracted wallets with transaction simulations brings even more security and predictability to users. With less anxiety, fewer issues, and more flexibility, wallet users can be more confident when managing transactions.

How can developers use simulations in smart contract wallets?

Tenderly enables you to integrate transaction simulations through Simulation RPC or by using Simulation API. While you can use the same RPC URL to also send transactions after simulating them, Simulation API enables you to persist data on Tenderly.

You can choose the method that best suits your contract wallet and then:

  • Build simulations into the wallet interface: Creating contract wallets with built-in transaction simulations is a simple way to allow users to preview transaction outcomes. Using Tenderly’s simulation infrastructure, your users can test their transactions with a click of a button before actually sending them to the blockchain. This allows them to be completely aware of transaction effects or potential risks.
  • Persist and expose simulation data: Use Simulation API to persist data on transaction simulations. You can then expose rich information to contract wallet users, allowing them to inspect transaction execution in greater detail.

    This way, technical users can see exactly what went wrong in the event of failed transactions. And less technical users can get a better understanding of the process too.
  • Make helpful recommendations: You can help your wallet users avoid making an expensive mistake or sending suboptimal transactions on-chain. Integrate transaction simulations and provide your users with valuable input that could save them money.
  • Onboard users with ease: You can run your contract wallet in demo mode using Tenderly’s Simulation API so your users can easily try it out. This can be especially helpful for wallets with more complex custom rules such as requiring multiple signatures. This way, your users can get comfortable with your wallet and start using it with confidence.

Want to see transaction simulations in action? Here's a short tutorial on how to build them into a UI:

Build simulations into your smart  contract wallets & safeguard users’ funds

Allowing users to send and manage their transactions frictionlessly is essential for encouraging the global adoption of blockchain technology. Now, with account abstraction and transaction simulations, we’re another step closer to delivering wallets suitable for mainstream use.

While account abstraction makes wallets less complex and more customizable for end users, transaction simulations give them an additional level of predictability and security. So, set up your free Tenderly account and build safety into your smart contract wallets from the very start.