Security API

Simulate a transaction with risk analysis

Changed on

/v4/data/security/transaction/simulate

60000 credits per API call

Simulate a transaction against live chain state before signing or broadcasting it. The simulation returns balance movements, execution steps, and a risk assessment covering drainer patterns, suspicious approvals, delegatecalls, MEV exposure, and other threat heuristics.

Input modes — provide either:

  • from (plus optional to, value, data, nonce, fees) — simulate an unsigned transaction, or
  • rawTx — replay a signed, already-mined transaction. The transaction is looked up on-chain, so it must exist; to replay it accurately pass blockNumber = the block before it was mined.

Requests with neither from nor rawTx return 400.

RPC — ethereum-mainnet, bsc-mainnet, polygon-mainnet, and base-mainnet have built-in RPC support. For any other supported chain, pass your own rpcUrl.

Other notes

  • blockNumber and gasLimit are JSON numbers; value, nonce, and the fee fields are decimal or hex strings (values can exceed the safe JavaScript integer range).
  • gasLimit defaults to 30,000,000 — lower it on chains with a smaller block gas limit (e.g. Gnosis).
  • The risk summary (score, level, title, steps, warnings, risks) is returned at the top level of the response.
post/v4/data/security/transaction/simulate

Request

  • Base URL
    https://api.tatum.io
  • URL
    https://api.tatum.io/v4/data/security/transaction/simulate
  • Auth
    API key in header x-api-key

Request body

chain'ethereum-mainnet' | 'bsc-mainnet' | 'polygon-mainnet' | 'optimism-mainnet' | 'arb-one-mainnet' | 'arb-nova-mainnet' | 'base-mainnet' | 'avax-mainnet' | 'celo-mainnet' | 'cro-mainnet' | 'gno-mainnet' | 'xdc-mainnet' | 'unichain-mainnet' | 'sonic-mainnet' | 'berachain-mainnet' required

Chain to simulate on.

fromstring

Sender address. Required unless rawTx is provided.

rawTxstring

Signed transaction hex of an existing on-chain transaction; replaces from/to/value/data/nonce. The transaction is looked up on-chain, so it must reference a real mined transaction.

tostring

Recipient address. Omit for contract creation.

valuestring

Value in wei, as a decimal or hex string. Defaults to 0.

datastring

Calldata hex.

noncestring

Transaction nonce as a decimal or hex string. Fetched from the chain when omitted.

blockNumberinteger

Simulate against this block instead of the latest.

gasLimitinteger

Gas limit. Defaults to 30,000,000 — lower it on chains whose block gas limit is smaller (e.g. Gnosis).

maxFeePerGasstring

EIP-1559 max fee per gas, as a decimal or hex string.

maxPriorityFeePerGasstring

EIP-1559 max priority fee per gas, as a decimal or hex string.

rpcUrlstring

RPC endpoint to simulate against. Required only for chains without a built-in RPC (built-in: ethereum-mainnet, bsc-mainnet, polygon-mainnet, base-mainnet).

format'json' | 'dot' | 'text'

Response format. dot adds a Graphviz dot string of the transfer graph. Defaults to json.

Example request

{
  "chain": "ethereum-mainnet",
  "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "value": "0"
}

Response

OK

successboolean

Whether the simulated transaction executed successfully.

scorenumber

Overall risk score, 0–100. Higher means riskier.

levelstring

Risk level derived from the score.

titlestring

Human-readable summary of the simulated execution.

stepsstring[]

Human-readable execution steps.

warningsstring[]

Human-readable warnings raised during simulation.

gas_usednumber

Gas used by the simulated transaction.

safetyobject

Per-heuristic safety flags (e.g. pure_outflow, suspicious_approvals, fresh_recipient_risk, mev_risk, flash_loan_detected).

Example response

{
  "success": true,
  "score": 45,
  "level": "medium",
  "title": "Transaction executes 1 step(s) with 2 warning(s)",
  "risks": [
    {
      "name": "Suspicious approvals",
      "weight": 25,
      "detected": true,
      "description": "High-value token approvals detected"
    }
  ],
  "gas_used": 55690
}

Changes