Aller au contenu principal

What are transaction simulations?

When you're about to transact, MetaMask will try to predict the estimated balance changes to your account, allowing you to get a better understanding of the outcome of the transaction you're about to submit. You may see a preview of what will happen; for example, how much ETH you'll receive or which tokens will move.

MetaMask mobile transaction added protection toggle

A transaction simulation is a test run of your transaction. These standard simulations are an added safety feature that is enabled by default. You can manage this toggle within 'Settings' > 'Security & Privacy'.

When simulations are conducted offchain only (as almost all transaction simulations today), they are vulnerable to sophisticated phishing attacks like red-pill attacks (see below for more). In order for simulations to truly be helpful, they must be enforced onchain. MetaMask smart accounts on Extension support this added protection by default. Learn about smart accounts here.

Networks supported for onchain simulations

Ethereum, Optimism, BNB, Polygon, Monad, HyperEVM, Sei, Tempo, MegaETH, Robinhood, Arc, Base, Arbitrum, Avalanche, and Linea.

Added protection: how enforced simulations keep you safe

Standard (offchain) simulations are helpful, but they rely on the assumption that contracts behave the same way in simulation and onchain execution.

Unfortunately, that's not always the case. MetaMask developed an environment to counteract sophisticated phishing attacks through enforced (onchain) simulations, available by default when interacting with a non-trusted contracted.

With enforced simulations enabled:

  • The transaction is simulated before signing
  • The same simulation conditions are enforced onchain
  • If the real execution does not match the simulation, the transaction automatically reverts.

This means that what you see in the confirmation screen is guaranteed to match what happens onchain because if it doesn't, the transaction does not go through. Your funds are protected (you only pay the network fee).

What are "red pill" attacks?

Red pill attacks are a sophisticated scam technique that creates a false sense of safety where malicious contracts behave differently during simulation vs. real execution.

Standard transaction simulations that happen offchain run in a controlled environment (like a preview) and do not execute on the blockchain. Malicious contracts can detect this environment and respond differently:

  • A contract detects it is being simulated
  • During simulation, it behaves harmlessly (example: shows "You will receive 0.1 ETH")
  • But once executed onchain, it switches behavior and instead drains your funds after you approve the transaction.

The preview looks legitimate, but the real transaction is malicious. This tricks both users who see a safe preview and wallet providers that rely on the controlled environment to warn users.

Enforced simulations prevent this entirely by ensuring that if onchain behavior does NOT match the simulated behavior, the transaction fails.

Why does gas increase when 'Added protection' is enabled?

You may notice a higher network fee when 'Added protection' is checked in the transaction confirmation screen. This is expected as enforced simulations add an onchain verification step. This:

  • Re-checks that execution matches the simulation
  • Adds additional computation to the transaction
  • Uses more gas as a result.

That additional gas cost is effectively paying for strong protection against advanced scams and guaranteed execution integrity to prevent wallet-draining attacks.

If a mismatch is detected, the transaction reverts, meaning your funds stay safe and you only lose the network (gas) fee.

remarque

MetaMask does not collect any fee when this feature is enabled; you are only paying the network fee for the transaction to go through.

When should I use 'Added protection'?

Remember, standard simulations are not guaranteed to match what happens onchain. Only enforced simulations, or 'Added protection', does this. In general, a good rule of thumb is to use extra caution and check that 'Added protection' box when:

  • Interacting with new or unknown dapps
  • Signing complex transactions
  • Moving significant amounts of funds.

What kind of transactions are supported?

At this time, transaction simulations are available for contract interactions, and you will be able to see balance changes that involve ERC-20 tokens, as well as ERC-721 and ERC-1155 NFTs being transferred in and out of your account.

remarque

Enabling the estimated balance changes feature involves using a centralized MetaMask server to simulate the transaction and obtain necessary data. Leave this feature disabled if you do not want transaction data and/or IP address exposed. Note that disabling this feature also disables 'Added protection'.

Was this helpful?