Simplify ERC-4337 Transaction Signing

Simplify ERC-4337 Transaction Signing

Author: Alchemy Team

Reviewed by Brady Werkheiser

Published on November 28, 20232 min read

We’re thrilled to announce the launch of UserOp Simulation. Transaction simulation has helped make web3 safer and more user-friendly. Today, we’re excited to bring that capability to ERC-4337 UserOps for smart accounts.

By simulating a UserOp, you can predict the expected outcome and display it in a human readable format. The UserOp Simulation API returns all asset changes, approval changes, and onchain reversions.

Developers can use Account Kit to add UserOp Simulation with a single line of code today!

Ready to learn more? Let’s dive in!

Back in January, Transaction Simulation made transaction signing less opaque, by giving users full visibility into the expected outcome of their transactions.

Without simulation, users would sign transactions blindly and trust that the app was initiating the intended transaction.

‍The suite of Transaction Simulation APIs solved this problem for EOA wallet users by greatly simplifying the user experience for signing a transaction. It also helped keep users safe by making malicious transactions more obvious

But a new type of wallet is taking the ecosystem by storm: ERC-4337 smart accounts.

ERC-4337 smart accounts have taken off this year with over 1.3M accounts deployed onchain.  Smart accounts are the best way to build web2 UX in a web3 app, and simulation is a critical component.

The trick is that smart accounts don’t send transactions like a normal EOA wallet. Instead, they send User Operations – a meta transaction defined by the ERC-4337 standard.

Today, we’re releasing the first ERC-4337 UserOp Simulation API to help developers build mainstream checkout experiences for users.

🔶 Unlock transparency, clearly displaying to users the expected outcomes of their UserOps.

🔶 View results in a format that is ABI decoded, human readable, and inclusive of all relevant metadata.

🔶 Use Account Kit to integrate UserOp Simulation with just one line of code.

🔶 Access improved security and avoid submitting UserOps that are predicted to fail.

UserOp Simulation is the newest addition to a suite of APIs and tools, built to make using SCAs easy.

There are two ways that Account Kit supports UserOperation simulation:

  1. Use the withAlchemyUserOpSimulation middleware to simulate every UserOp before sending.

  2. Use the simulateUserOperationAssetChanges method to simulate UserOps selectively, an alternative to always running simulation.

Alchemy's Account Kit is a complete toolkit for developers to embed smart accounts in your app with social login, gas abstraction, batch transactions, and more. Here's everything that's included:

Account Kit product suite
Account Kit product suite

🟧 aa-sdk: a flexible library to integrate, deploy, and use smart accounts

🟧 Light Account: a gas-optimized ERC-4337 smart contract account

🟧 Signers: integrations with your favorite social login and passkey providers

🟧 Gas Manager APIs: a programmable API to sponsor gas fees in your app

🟧 Bundler APIs: built in Rust to achieve high performance and high-reliability

🟧 Custom Webhooks: notify users when their user operations complete

Start simulating ERC-4337 UserOps today! Get started with Account Kit and learn how to Simulate UserOps. Or call the API directly using withAlchemyUserOpSimulation and simulate every UserOp before sending.

Section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key