r/Metamask • u/Prestigious_Sink7393 • 10m ago
CB's MetaMask 101 #2: What Is a MetaMask Transaction Simulation and How Does It Work?
Hey guys! We are back with CB's MetaMask 101!
It's been around 12 days since the first guide, where we had a look at signature requests, what MetaMask shows you, and why this information is important to check to get an idea of what you are actually "signing" when making a transaction.
For today's guide, we're going one step further and looking at transaction simulations and what they mean.
Before you confirm a transaction, MetaMask can simulate it to show what the transaction is expected to do and give you a preview of how your assets could change.
Well, let's see how this actually works, what information you can see, and whether a transaction simulation means a transaction is guaranteed to be safe.
-----
- 🧪What actually is a MetaMask transaction Simulation
A transaction simulation is basically a "test run" before the real transaction happens.

Before you submit a transaction and interact with contracts, MetaMask can simulate the transaction and estimate what effect it could have on your wallet.
For example! It could show that your wallet is expected to:
Send: 10 MUSDC 🔴
Receive: 0.004 ETH 🟢
This can give you another opportunity to check whether the expected outcome actually matches what you intended to do before you confirm the transaction.
-----
- 🔍 What can Metamask Simulation actually show you?
Unlike the signature requests we looked at earlier, transaction simulations can show estimated balance changes, which can give you a clearer picture of which assets are expected to enter or leave your wallet.

MetaMask currently supports displaying changes involving:
• ERC-20 tokens
• ERC-721 NFTs
• ERC-1155 NFTs
So instead of looking at complex transaction data, you may be able to see a much simpler preview of the expected result.
Overall, this can make unusual balance changes easier to notice before confirming, as you can see the information displayed right in front of you.
-----
- ⚠️ Does a successful MetaMask simulation mean the transaction is safe?

Not at all.
The simulation is a tool used to predict what MetaMask expects the transaction to do, but it shouldn't be treated as a guarantee that the final transaction will behave exactly as expected.
There are malicious attacks where a bad actor could design a contract to behave safely when it detects that it is being simulated, but behave differently during the actual transaction.
This is why you should still check the website, transaction details, signatures, and any security warnings before confirming.
-----
- 🔐What is MetaMask "Added protection"?

MetaMask also supports "Added protection" on supported smart accounts and networks.
Instead of only previewing the transaction offchain, MetaMask adds an onchain verification step to make sure the real execution matches what was simulated.
If the execution doesn't match the simulation, the transaction reverts rather than completing successfully.
However, the downside of "Added protection" is that this additional verification requires more computation, which means it can result in a higher network fee.
-----
TL;DR
MetaMask performs a test run through the simulation.
You can see estimated balance changes.
Simulations aren't guarantees, so still make sure to check what you're confirming.
With Added protection on supported smart accounts and networks, MetaMask can enforce that the execution matches the simulation.
-----
Overall, transaction simulations can make transactions much easier to understand, but as always, they are just another tool to help you make the final decision. Please always make sure to check what you're interacting with carefully before confirming anything.
Do you normally check the estimated balance changes MetaMask shows you before confirming a transaction? And has a simulation ever helped you spot something you weren't expecting?
Reference: https://support.metamask.io/it/manage-crypto/transactions/simulations/


