BlockSec Documents
  • 🚩About BlockSec
  • BlockSec Anti-MEV RPC
    • Bundle API
  • 🦅BlockSec Phalcon
    • Phalcon
    • Explorer
      • Quick Start
      • Debugger
      • Simulator
      • APIs
    • Security Incident List
  • 🕵️MetaSleuth
    • Overview
    • Phishing Attack
    • Avoid Being a Phishing Victim
  • Transaction Insights
    • Transaction Simulation API
  • ⚒️MetaSuites
    • Overview
    • Fund Flow Graph
    • User Experience Enhancement
    • User-security Features
      • Approval Diagnosis
      • Address Labels and Compliance Score
    • Developer-Friendly Features
  • 🙌Community
    • Contacts
Powered by GitBook
On this page
Export as PDF
  1. Transaction Insights

Transaction Simulation API

Understand a transactoin before signing it

PreviousAvoid Being a Phishing VictimNextOverview

Last updated 1 month ago

See exactly what a transaction will do—before it’s signed. Our API runs a full on‑chain simulation and returns clear, USD‑denominated balance changes, so users of custodial platform such as Cobo and Fireblocks can approve or reject transfers with confidence.

Why it matters

  • Pre‑sign insights – Know the outcome of any transaction in advance.

  • Seamless integration – A lightweight REST endpoint that drops straight into your existing workflow.

  • Actionable data – Balance deltas presented in familiar USD terms.

Supported chains Ethereum · BNB Smart Chain · Base · Optimism · Polygon

Get started Request an API key at contact@blocksec.com and start simulating in minutes.

Balance Change

  • Balance Change
  • POSTRaw Transaction Simulation
  • POSTCustom Transaction Simulation

Raw Transaction Simulation

post

Simulate raw transaction and get balance changes

Header parameters
API-KeystringRequired
Body
blockNumberinteger · uint64Required

The block number on which the transaction simulation is based. If this value is 0, transaction simulation will be based on the latest block.

transactionstringRequired

Raw transaction hex string

Example: 0xf8a91f85017ad70c7582881994c02aaa39b223fe8d0a0e5c4f27ead9083c756cc280b844a9059cbb000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa9604500000000000000000000000000000000000000000000000000005af3107a400025a0bbfc1f56c70c58f623a36639f9dd01db632af5bdc1106c16906f6c13b17765cea07a34be3f43332eddbcb9ac8a3b1e261eda25c007283a645d68a8380b19e6602f
Responses
200
Simulation result
application/json
post
POST /simulation/v1/raw/balancechange HTTP/1.1
Host: api.blocksec.com
API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 378

{
  "blockNumber": 0,
  "transaction": "0xf8a91f85017ad70c7582881994c02aaa39b223fe8d0a0e5c4f27ead9083c756cc280b844a9059cbb000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa9604500000000000000000000000000000000000000000000000000005af3107a400025a0bbfc1f56c70c58f623a36639f9dd01db632af5bdc1106c16906f6c13b17765cea07a34be3f43332eddbcb9ac8a3b1e261eda25c007283a645d68a8380b19e6602f"
}
200

Simulation result

{
  "code": 0,
  "message": "success",
  "data": {
    "status": true,
    "blockNumber": 22467376,
    "txnHash": "0x5466e564db157b73cbd8dd1d688631a3afcf99a35c372009d8c298441fa8d9e0",
    "sender": "0x989e7947a9d9210eec3a41dcf5f536bb1d7726f6",
    "receiver": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "timestamp": "2025-05-12T13:03:23Z",
    "callData": "0xa9059cbb000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa9604500000000000000000000000000000000000000000000000000005af3107a4000",
    "gasLimit": 34841,
    "gasPrice": "6355881077",
    "gasUsed": 34482,
    "baseFee": "6029791982",
    "transactionFee": "219163491297114",
    "nonce": 31,
    "value": "0",
    "errorInfo": "",
    "viewLink": "https://app.blocksec.com/explorer/tx/eth/0x5466e564db157b73cbd8dd1d688631a3afcf99a35c372009d8c298441fa8d9e0?event=simulator",
    "balanceChanges": [
      {
        "account": "0x989e7947a9d9210eec3a41dcf5f536bb1d7726f6",
        "assets": [
          {
            "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "tokenId": "",
            "rawAmount": "100000000000000",
            "amount": "0.0001",
            "value": "0.255386",
            "iconUrl": "https://assets.blocksec.com/icon/f1cb2d02c471d545bbc7722daf3277fd852d98e63d118771af7047bd8256c516.png",
            "isERC721": false,
            "isERC1155": false,
            "sign": false
          }
        ]
      },
      {
        "account": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
        "assets": [
          {
            "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "tokenId": "",
            "rawAmount": "100000000000000",
            "amount": "0.0001",
            "value": "0.255386",
            "iconUrl": "https://assets.blocksec.com/icon/f1cb2d02c471d545bbc7722daf3277fd852d98e63d118771af7047bd8256c516.png",
            "isERC721": false,
            "isERC1155": false,
            "sign": true
          }
        ]
      }
    ]
  }
}

Custom Transaction Simulation

post

Simulate custom transaction parameters and get balance changes

Header parameters
API-KeystringRequired
Body
chainIdinteger · uint64Required

Chain ID for the transaction

blockNumberinteger · uint64Optional

The block number on which the transaction simulation is based. If this value is 0, transaction simulation will be based on the latest block.

Responses
200
Simulation result
application/json
post
POST /simulation/v1/custom/balancechange HTTP/1.1
Host: api.blocksec.com
API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 240

{
  "chainId": 1,
  "blockNumber": 0,
  "transaction": {
    "sender": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "receiver": "0x761A8482CE9EBa5baCBc20CDd869D4AA00275F8f",
    "gasLimit": 21000,
    "gasPrice": "20634341671000",
    "value": "9000000000000000",
    "input": "0x"
  }
}
200

Simulation result

{
  "code": 0,
  "message": "",
  "data": {
    "status": true,
    "blockNumber": 22467282,
    "txnHash": "0x80407f7f2c695c82847bdbdecac4070274523bcbc0b9fa3493afb06ee7709813",
    "sender": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "receiver": "0x761a8482ce9eba5bacbc20cdd869d4aa00275f8f",
    "timestamp": "2025-05-12T12:44:35Z",
    "callData": "0x",
    "gasLimit": 21000,
    "gasPrice": "20634341671000",
    "gasUsed": 21000,
    "baseFee": "7094316180",
    "transactionFee": "433321175091000000",
    "nonce": 1555,
    "value": "9000000000000000",
    "errorInfo": "",
    "viewLink": "https://app.blocksec.com/explorer/tx/eth/0x80407f7f2c695c82847bdbdecac4070274523bcbc0b9fa3493afb06ee7709813?event=simulator",
    "balanceChanges": [
      {
        "account": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
        "assets": [
          {
            "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            "tokenId": "",
            "rawAmount": "9000000000000000",
            "amount": "0.009",
            "value": "22.94604",
            "iconUrl": "https://assets.blocksec.com/image/1663669189317-3.png",
            "isERC721": false,
            "isERC1155": false,
            "sign": false
          }
        ]
      },
      {
        "account": "0x761a8482ce9eba5bacbc20cdd869d4aa00275f8f",
        "assets": [
          {
            "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            "tokenId": "",
            "rawAmount": "9000000000000000",
            "amount": "0.009",
            "value": "22.94604",
            "iconUrl": "https://assets.blocksec.com/image/1663669189317-3.png",
            "isERC721": false,
            "isERC1155": false,
            "sign": true
          }
        ]
      }
    ]
  }
}