Skip to main content
You visit a “token claim” site. The transaction looks normal—just a contract interaction. You approve it without a second thought. 48 hours later, your entire wallet is drained through a permit signature you didn’t understand. Transaction simulation would have caught it. This guide shows you how to build that last line of defense.

Why Transaction Simulation Matters

Last Line of Defense

Users trust your app to protect them—make that trust count

Permit Protection

Catch EIP-712 signatures that can drain wallets without transactions

Approval Awareness

Show users their existing exposure before they add more
Why developers choose Webacy:
  • Pre-signing simulation — Show users exactly what will happen before they approve
  • EIP-712 signature analysis — Decode and risk-score permit/signature requests
  • Approval risk detection — Identify dangerous existing approvals
  • Recipient verification — Catch address poisoning before users confirm
  • Multi-chain support — Same APIs for ETH, Polygon, Arbitrum, Base, and more

Prerequisites

Before implementing transaction simulation, ensure you have:
  • A Webacy API key (sign up here)
  • Basic familiarity with REST APIs or the Webacy SDK
  • Your application’s transaction signing flow identified for integration

Pre-Signing Protection

The moment before a user signs a transaction is your last chance to protect them.

Transaction Simulation

Simulate every transaction before it gets signed. The endpoint is POST /scan/{fromAddress}/transactions, where fromAddress is the signer, and it takes the serialized unsigned transaction (raw), not the to/data/value fields. Every EVM library produces it as a 0x hex string: ethers Transaction.from({...}).unsignedSerialized, viem serializeTransaction(...), web3.js bytesToHex(tx.serialize()) (its serialize() returns bytes). A 66-character tx hash is also accepted for a transaction that is already mined.
What to show users:
The chain can be passed either as chain in the body (1, 56, 137, 10, 42161, 8453, or "sol" for Solana) or as the ?chain= query (eth, bsc, pol, opt, arb, base, or sol); the query wins when both are present. tx.from must match the fromAddress in the path.
An empty simulation array is inconclusive, not safe. It means the simulation produced no asset movement and the calldata named no recipient or spender to score — a call that reverts, a contract call with no transfer, or a degraded simulation read. Treat it as unknown and ask the user to verify the address, never as a green light. A party whose overallRisk / high / medium are missing (only address present) could not be scored in time — same rule.
Supported chain IDs: 1 (ETH), 56 (BSC), 137 (Polygon), 10 (Optimism), 42161 (Arbitrum), 8453 (Base); Solana via chain=sol, see below

Solana Transaction Simulation

The same endpoint scans Solana transactions. Pass chain=sol (as the ?chain=sol query or "chain": "sol" in the body) and send the transaction as standard base64 in tx.raw:
  • Legacy, v0 and version 1 transactions are accepted, up to 1232 bytes (4096 bytes for a version 1 transaction).
  • The transaction does not need to be signed. Serialize it without requiring signatures (@solana/web3.js 1.x: tx.serialize({ requireAllSignatures: false }).toString('base64') for a Transaction, Buffer.from(tx.serialize()).toString('base64') for a VersionedTransaction). Signatures are never checked.
  • fromAddress must be one of the transaction’s required signers, usually the wallet that is about to sign.
The transaction is simulated against current mainnet state. Every SOL and token balance change it makes is scored, and so is every delegate approval or authority change that hands control of the signer’s funds to someone else. Many Solana drainers work this way: they move nothing when the victim signs, they take ownership of the victim’s token accounts instead.
This response is for a transaction that hands ownership of a token account to another address. Only that change is shown, and the risk profiles are cut down to their counts:
Solana-specific fields: A transaction that hands the signer’s funds or accounts to another address (an APPROVE or CALL change) usually reads at least Risk, even when that address has no history. A scan that could not verify or fully score the transaction is never Benign.
unverified: true is inconclusive, not safe. The simulation failed (simulationReverted: true, with revertReason when known), or the transaction neither moves a balance nor hands over control of an account. simulation is then empty and riskScore is never Benign.
Solana scans have no signed descriptor; read riskScore instead. Omit block and operation for Solana: any value, 0 included, returns 400, as does a signer whose balance cannot pay for the transaction. A scored, verified result is cached for 60 seconds per transaction and signer; pass refreshCache=true to rescan.

EIP-712 Permit Signature Verification

Permit signatures are one of the most dangerous attack vectors. A single signature can authorize unlimited token spending without any on-chain transaction.
The Silent Drain: Unlike regular transactions, permit signatures don’t show up on block explorers until the attacker uses them. A user can sign a permit and see nothing happen—until days later when everything is gone.
Key red flags to surface:
Only Ethereum mainnet is supported for EIP-712 scans: data.domain.chainId must be 1 (or pass ?chain=eth). msg.from must match the fromAddress in the path. Pass the dApp origin as domain to get simulation.domainRisk.

Approval Risk Management

Users often have approvals they’ve forgotten about. Help them understand their exposure.

Current Approval Scanning

Show users their existing approvals before they add more.

Dangerous Approval Detection

Flag approvals that could be used to drain the wallet.

Recipient Verification

Before a user sends funds, verify the recipient address isn’t part of an attack.

Address Poisoning Check

Risk Profiling

Get a quick risk assessment of any recipient.

Complete Integration Workflow

Pre-Signing Check Flow

Approval Health Check Flow

Full TypeScript Implementation


Example Addresses for Testing

Permit Phishing

Address Poisoning

Known Drainers

Clean Addresses (for comparison)


API Quick Reference


Next Steps

Get Your API Key

Start protecting your users

API Reference

Complete endpoint documentation

Install the SDK

TypeScript SDK for integration

Address Poisoning

Learn more about this attack vector