Blockfence API Docs
Back to Homepage
  • Welcome to Blockfence API
  • Quick Start
  • Reference
    • API Reference
      • Enrichment
        • Transaction Simulation
        • Address Enrichment
        • Domain Enrichment
        • AI Interpreter
      • Analysis
        • Address Analysis
        • Domain Analysis
        • Transaction Analysis
      • Monitoring
        • Subscribe to Address Events
        • Subscribe to Domain Events
      • Investigation
        • Domain To Addresses
        • Address to Domains
        • Similar Smart Contracts
        • Domain to Linked Domains
        • Domain to Internal Pages
        • Investigate a URL
  • Terms & Policy
    • API License Agreement
    • Terms & Conditions
    • Privacy Policy
Powered by GitBook
On this page

Was this helpful?

  1. Reference
  2. API Reference
  3. Enrichment

Transaction Simulation

Simulates a transaction

Last updated 1 year ago

Was this helpful?

Supported Networks

  • Ethereum: chain_id: "0x1"

  • BSC: chain_id: "0x38"

  • Avalanche: chain_id: "0xa86a"

  • Polygon: chain_id: "0x89"

  • Optimism: chain_id: "0xa"

  • Arbitrum: chain_id: "0xa4b1"

All requests require an API key. Add "x-api-key" to your request header as shown in the example below.

Don't have an API key? Contact us to get one.

Request Body Parameters

Parameter Name
Parameter Type
Comments

chain_id

hex string

Chain ID (e.g. "0x1" for mainnet)

from

hex string

From address

to

hex string

To address

value

hex string

Value

data

hex string

Data

Usage Example

curl https://api.blockfence.io/api/v2/transaction_simulation -X POST -H "Content-Type: application/json" -H "x-api-key: <YOUR API KEY>" -d '
{
    "chain_id": "0x1",
    "from": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
    "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
    "value": "0x38d7ea4c68000",
    "data": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000064e7451300000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000057a626a2e9a17d7a00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000000000000000"
}
'
{
    "outgoing_transaction": {
        "from": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
        "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
        "amount": 0.001,
        "name": "Ethereum",
        "symbol": "ETH",
        "amount_in_usd": 1.67211
    },
    "incoming_transaction": {
        "from": "0xd35efae4097d005720608eaf37e42a5936c94b44",
        "to": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
        "amount": 6.631566909008928,
        "name": "1inch Network",
        "symbol": "1INCH",
        "amount_in_usd": 1.6745502233276626
    },
    "outgoing_gas": {
        "amount": 124050,
        "symbol": "GWEI",
        "amount_in_usd": 3.5223761149458537
    }
}
post

Simulates a transaction

Body
chain_idstring · hexOptionalExample: 0x1
fromstring · hexOptionalExample: 0xc014f9d89b194dde14554a65d4e009260f44de3f
tostring · hexOptionalExample: 0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad
valuestring · hexOptionalExample: 0x38d7ea4c68000
datastring · hexOptionalExample: 0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000064e7451300000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000057a626a2e9a17d7a00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000000000000000
Responses
200
Successful operation
application/json
403
Forbidden
500
Internal Server Error
post
POST /api/v2/transaction_simulation HTTP/1.1
Host: api.blockfence.io
Content-Type: application/json
Accept: */*
Content-Length: 1446

{
  "chain_id": "0x1",
  "from": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
  "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
  "value": "0x38d7ea4c68000",
  "data": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000064e7451300000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000057a626a2e9a17d7a00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000000000000000"
}
{
  "outgoing_transaction": {
    "from": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
    "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
    "amount": 0.001,
    "name": "Ethereum",
    "symbol": "ETH",
    "amount_in_usd": 1.67211
  },
  "incoming_transaction": {
    "from": "0xc014f9d89b194dde14554a65d4e009260f44de3f",
    "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
    "amount": 0.001,
    "name": "Ethereum",
    "symbol": "ETH",
    "amount_in_usd": 1.67211
  },
  "outgoing_gas": {
    "amount": 124050,
    "symbol": "GWEI",
    "amount_in_usd": 3.5223761149458537
  }
}