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

Case Study

How Safe Integrates TX Simulations to Bring Multisig Users Security and Peace of Mind

Organization: Safe


Industry: Decentralized Finance

safe transaction builder

"Our users quite like the Simulator feature. Normally, every second or minute somebody is simulating transactions."

Richard Meissner

Co-Founder, Safe Project

Starting out as a part of Gnosis, Safe quickly evolved into an ecosystem project of its own, created for the community. As a supporter of digital ownership and the Internet of Value, the growing Safe ecosystem believes in giving users full control and self-custody over their assets.

Safe developers empower their users by offering a flexible, composable smart contract account standard. Through a user-friendly decentralized application (dapp), Safe’s users can create multisignature accounts to manage and exchange their assets in an easy and secure way. And a growing ecosystem of builders has built on top of the Safe Protocol to create products for DAO treasury management, group NFT buying and collecting, and more.

The Safe dapp interface allows for streamlined transaction execution through a network of proxy contracts. These contracts interact with the core infrastructure while an indexing service keeps track of user contracts and their interactions. For the Safe team, such infrastructure means monitoring numerous internal transactions while ensuring quick response time, excellent customer service, and uncompromised security.

Empowering users to manage their own transactions

Safe’s smart contract-based account solutions allow users to add multiple wallet owners and set the number of required signatures to approve transactions. By using multisignature wallets, users can get greater control over their assets, prevent unauthorized transactions, and reduce security risks.

Additionally, to facilitate transaction sending, Safe’s developers also enable users to batch multiple transactions and execute them all together. Users just need to fill in the details and then create a single batch of transactions.

gnosis safe transaction builder
Creating transactions in a Safe account

However, this also requires users to inspect everything in detail to ensure that all of the state changes, token transfers, and events would happen as expected. And even when double-checking transactions dozens of times, it’s still possible to miss something and get a reverted transaction.

Integrating transaction simulations for security and peace of mind

To truly enable self-custody and empower their users to manage their own transactions, Safe integrated Tenderly Simulation API. The Safe team exposes transaction simulations to their users through their Transaction Builder app and other parts of their interface.

"Our users quite like the Simulator feature. Normally, every second or minute somebody is simulating transactions”, says Richard Meissner, co-founder of Safe.

Thanks to this integration, Safe’s end users can simulate transactions before sending them on-chain. Their users generate over 18,500 simulations a month, all going through Tenderly API. In return, they get some invaluable benefits:

  • Peace of mind and greater tx execution confidence: Before submitting and executing transactions, Safe’s users can find out whether they’re properly configured or whether they’ll trigger the expected state changes. So, successful simulations give users the confidence to submit their transactions on-chain.
  • Reduced gas costs: Simulating transactions prior to sending them on-chain also gives Safe’s users insight into how much gas they need to pay. This means that they can avoid underpaying or overpaying for transactions. It also means that they can prevent unnecessary costs on reverted transactions.
  • Improved security: By running transaction simulations, Safe’s wallet users can preview tx outcomes and identify potential security risks. They can see whether their transactions possibly have malicious effects and prevent them from hitting the chain.
  • Ease of use: When running transaction simulations, Safe’s users don’t need technical expertise to do so. They just need to fill in transaction details and click the button. This way, they automatically trigger Tenderly’s Simulation API which receives the requests.
  • Immediate response: The Simulation API then returns a response with detailed information within seconds. So, users don’t have to check all the transactions manually, which can be stressful and time-consuming, even for highly technical users.
  • Multiple networks: Since Tenderly supports 30+ EVM-compatible networks, the Safe developers enable simulations for all supported networks that Safe also integrated into their wallets. This includes the Mainnet, Polygon, Optimism, BSC, and others.

Want to see transaction simulations in action? Check out how you can preview transaction outcomes directly from Safe:


Simulating transactions in a Safe multisig with Tenderly

Exposing simulation information to wallet users for greater transparency

To provide further transparency and deepen users’ understanding, Safe enables its users to get detailed information about their transaction simulations. With just a click, Safe’s users can open simulated transactions on Tenderly, where they can closely inspect them.

Specifically, when running a simulation in a Safe account, you can dive into different details:

  • The tokens you will receive or transfer
  • The contracts your transactions involve
  • Whether the expected state changes were triggered
  • What events were emitted during the simulation
  • How much gas your transactions spend per function call

This way, even users without technical expertise can explore the simulation information to understand better what is happening with their transactions. On the other hand, users from a technical background also benefit from such in-depth information since they can analyze their transactions for additional insight.

The limitations of console debuggers were noticeable when the Safe team had to debug failed transactions. The insight was often quite limited since internal transactions aren’t visible in the standard overview on Etherscan. So, the team needed to comb through execution traces on Etherscan and deal with poor blockchain data visibility.

As part of their current issue resolution flow, the Safe development team now uses Transaction Simulator to re-simulate failed user transactions and understand what went wrong. This way, they’re able to pinpoint the exact cause of a problem.

“When it comes to debugging executed transactions and simulating transactions against existing contracts, everybody I know now uses Tenderly”, says Meissner.

Thanks to in-depth transaction information, Safe engineers can better help their customers since they now have a deeper understanding of what their users are doing. And they’re able to offer their users better customer service with excellent response time.

Building safe, transparent, and user-friendly wallets efficiently

The Safe ecosystem has brought its users more than just full control over their assets by integrating with Tenderly. Throughout their development process, as well as in live production, Safe engineers have enhanced productivity without compromising quality and customer satisfaction.

Instead of dealing with lengthy setups and debugging, the Safe team has time to really focus on building the ecosystem and user-friendly wallets.

While console debuggers were useful for the Safe engineering team, they often didn't provide the information depth the Safe team needed. So, they started using Visual Debugger and Gas Profiler for in-depth, yet visually more accessible trace information. They also started using Transaction Simulator and Forks to validate bug fixes or test complex transaction scenarios in a more forgiving Fork environment.

Additionally, with a Tenderly environment pre-configured for more than 30+ networks, they eliminated the lengthy local setup process. Consequently, Safe engineers have been able to speed up their development by 80%.

For more insight into how you can use transaction simulations, you can also explore:

To start experimenting yourself, set up your Tenderly account in just a few clicks and give Transaction Simulator a try.

But as Richard Meissner explains:

“It's good to start simple, just simulate a simple transaction. But Tenderly is a lot more than that. Looking into the more power features is definitely helpful and will benefit Web3 developers down the road quite heavily.”

The journey with Tenderly doesn’t stop here for the Safe team. In the next phase of improving their development and testing process and user experience, Safe engineers plan to expand the scope of integration.

Toward the end of the development phase, the Safe engineers need to test their whole setup and more complex scenarios. For this purpose, they use Tenderly Forks because they allow them to test against the existing Mainnet production states.

In this case, the Safe development team simulates transactions on a Fork and even shares the results across the team to cross-check everything. Plus, they’re also able to integrate a Fork into their HardHat environment as needed by using the Fork RPC.

They’re also yet to take full advantage of Alerting, Web3 Actions, and Analytics and are actively exploring additional benefits of the full-stack Tenderly infrastructure.

The Safe team also uses Tenderly Alerting to monitor their own DAOs. Using real-time alerts, they can monitor the flow of submitting proposals, keep track of all relevant interactions, and prevent invalid proposals from being executed. In this case, Tenderly acts as a security layer that the Safe team enforces.

For instance, the Safe team receives an alert whenever specified events are triggered so they can respond appropriately to critical events. They receive alert notifications to their email, Discord, and Telegram.