Transaction Simulation

Simulates a transaction

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.

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
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
  }
}

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"
}
'

Last updated

Was this helpful?