Introducing Virtual TestNets! ⚡ Test and stage dapps on real-time production data. Get started

Smart Contracts

How to Secure Multisig Wallets With Transaction Simulations

Learn more about the benefits of integrating transaction simulations into multisignature wallets. Find out how to introduce simulations using Tenderly’s Simulation RPC or Simulation API and see how Safe does it.

Milica Lukic
Milica Lukic
Feb 21, 2023 · 6 min read

In this post

How to Secure Multisig Wallets With Transaction Simulations

As smart contracts that require multiple signatures for transaction execution, multisig wallets have become a widely used security feature, especially among DeFi companies and DAOs. However, although they offer a high level of security and minimize the risk of unauthorized transactions, they’re not without challenges.

Multisig transactions can be complex for stakeholders who don’t come from a technical background. Even multisig owners who have technical experience often don’t have enough time to go over transactions in detail. So, an exploit can easily go unnoticed and multisig owners can approve a malicious act without even knowing it.

But what if you could see if that complex chain of transactions will execute as expected? What if you could show what would happen to anyone involved in the process? And what if you could, wait for it…, simulate complex transactions in a simple and straightforward way?

Why use transaction simulations in a multisig?

Simulating transactions and viewing their outcomes prior to submitting them on-chain helps avoid financial losses caused by failed, incorrect, or malicious transactions. This further helps eliminate anxiety and frustration among multisig users. And Tenderly enables Web3 developers to offer these and many other benefits by integrating Transaction Simulator into their multisig wallets.

By introducing Transaction Simulator, Web3 engineers can build multisig wallets that prioritize users and the safety of their funds. With Tenderly’s Simulation Bundles, multisig users can simulate a bundle of sequential transactions by clicking a single button. In return, they get results for each transaction in the bundle so they can see exactly how they execute.

The benefits of simulating transactions in a multisig

So, integrating this soon-to-be essential functionality into a multisig brings essential benefits:

  • Preventing errors and eliminating risks: By simulating multisig transactions, you can instantly see if they execute as expected. And if you uncover a bug, you can take action before your transactions even hit the blockchain (at which point, it’s time for risk mitigation, not prevention).
  • Reducing costs: By detecting bugs in code or mistakes in transaction parameters, you avoid paying gas fees for failed transactions. Plus, by using the tenderly_simulateBundle request, a multisig can show exactly how much gas each transaction in a bundle will spend and, therefore, the entire bundle. What does this mean? No underpaying for gas either!
  • Increasing security: A rogue individual or company employee can submit a malicious transaction with a faulty description to a multisig. However, by clicking a simple “simulate transaction” button, you can see the effects of the transaction you’re approving. This way, you can avoid accidentally authorizing a malicious act.
  • Improving user experience: By removing anxiety and guesswork for multisig users, transaction simulations can help establish trust and improve users’ overall experience when using a multisignature wallet.

    Plus, users with less technical knowledge and experience can be more confident when approving transactions. And the simplicity of using a multisig, or any other dapp for that matter, can be a decisive factor for users when choosing their provider.
  • Simplifying and securing the decision-making process: By using simulations when voting on governance proposals, voters can see the effects of a proposal before passing their votes to a multisig. Additionally, stakeholders who don’t have a technical background can better understand the proposal execution by seeing the simulation on Tenderly.
  • Increasing trust in the blockchain: Finally, simulating multisig transactions can help build trust in the industry. With minimized risks and greater transparency, users will keep coming back to dapps that prioritize security, as well as the blockchain in general.

Who benefits from simulations in a multisig?

So, yes, there are invaluable benefits to integrating this simple (on the user-facing side at least) functionality into multisig wallets. But then a question arises – who benefits from this integration?

We’re glad you asked! Everyone benefits from transaction simulations, including:

  • Web3 devs who are able to build better, user-friendlier multisignature wallets that users will keep coming back to. Plus, Tenderly offers several simulation methods, providing Web3 developers with flexibility depending on the requirements of their projects.
  • Individual users who want to have greater control over their assets through multisigs and gain a better understanding of what’s going on with their transactions.
  • Companies and corporations that want to prevent unauthorized transactions of company assets and eliminate risks that could cost them and their clients.
  • Governance voters who want to bring security and predictability to the voting process. Simulations enable them to preview proposal outcomes and verify their impact before passing the proposal.
  • A wider blockchain community that’s still evolving and gaining trust in the technology. Transaction simulations bring predictability and security to the blockchain, eliminating hesitation and anxiety among less technical users.

How to secure your multisig with transaction simulations

Okay, so far, we’ve been discussing the user-facing side and what simulations mean for multisig owners. But what’s happening in the background? How do you actually integrate simulations into a multisig wallet?

With Tenderly, you can choose between two options:

1. Simulation RPC: This method allows you to simulate transactions through Tenderly Web3 Gateway, a super fast production node. By integrating Simulation RPC into your multisig wallet, you can use it for more than just transaction simulations.

You can use the same RPC to send transactions after simulating them, as well as submit read calls and check balances. Plus, you can offer the same information to multisig wallet users.

2. Simulation API: Integrating Tenderly Transaction Simulator through API brings you greater flexibility with the endpoint and enables you to persist simulation data on Tenderly. And with the simulation data persisted, you can expose it to multisig users.

This way, if multisig owners want to look into executed transactions in greater detail, they can open them on Tenderly. There, they can take a look at the changes simulated transactions made, emitted events, state changes, and other information about their execution.

Simulations in a bundle

Both Simulation API and Simulation RPC support simulation bundles that consist of transaction arrays. Being able to simulate an entire bundle of transactions is particularly useful in multisigs since they involve multiple transactions. Multisigs require passing the first transaction (the one you wish to execute), the required number of signatures for its execution, and the execution of the first transaction.

With a single tenderly_simulateBundle request, you can test this entire flow. Both Simulation API and RPC will run the execution of these simulations against a simulated Tenderly blockchain environment. Once you run the simulation, you will receive the results for each transaction in the bundle so you can analyze their execution. And on the user-facing side, multisig owners just need to click one button – simulate. ⏯️

How Safe integrates multisig transaction simulations

One of the key players in DeFi is already familiar with the advantages of integrating simulations into multisig wallets – Safe. Safe offers multisignature wallet solutions to both individuals and companies.

By creating a safe on their platform, you’re actually creating a proxy contract that executes your multisig transactions. You’re able to add as many multisig owners as you’d like and set the required number of signatures for the execution of transactions.

Once your wallet is up and running, head over to Transaction Builder to start sending transactions. Fill in the required details for each transaction you want to send. Once done, click Create Batch so you can execute all transactions at once.

Filling in tx details in Safe’s Transaction Builder

However, before actually executing your transaction batch, Safe allows you to preview the outcome by clicking Simulate. This will send a request to Tenderly’s Simulation API that runs your transactions against a simulated blockchain environment.

Simulating a transaction batch in Safe’s Transaction Builder

Almost instantly, you’ll receive the results of your simulated transactions. So, instead of blindly sending these transactions, you can see exactly what would happen and cancel the execution should anything go wrong.

Failed transaction simulation in Safe’s Transaction Builder

Finally, since Safe uses Simulation API, they’re persisting the data of simulated transactions and can show it to their users. So, you can open failed transactions on Tenderly and examine exactly what went wrong.

Examining a failed tx simulation on Tenderly

Here’s also a short video of simulating transactions in a Safe multisig:

0:00
/

Simulate then sign a multisig with high security by design

Transaction simulations are on their way to becoming a must-have feature in multisig wallets. Given the numerous benefits they offer and the level of security they bring, simulations will soon become the new standard for establishing greater control over multisig assets.

By integrating with Tenderly’s Transaction Simulator, you can start building next-gen multisigs now. With Tenderly’s support, you can remove the complexity and anxiety associated with the execution of multisig transactions and build a multisig wallet your users will keep coming back to. Set up an account with Tenderly and start today!