Links
Comment on page

Transaction Simulation

Securely verify transactions in a real chain environment
Transaction Simulator can be self-hosted, if needed
Forget about network latency between node and app, add more security based on blockchain design and architecture, and get the same benefits as the SaaS version.
The transaction simulation mechanism allows you to execute the code in the EVM using the real state (you can specify either the latest block or any other). The transaction will not be recorded in the blockchain, but you will receive all the necessary data about its execution - such as detailed logs on diff state.
The simulation is implemented by calling the debug_traceCall method using the simulatorTransaction tracer.
Supported and Planned Chains
  • BNB Chain
  • Ethereum
  • Polygon

Query

Run in Postman
cURL Example
curl --location --request POST 'https://bsc-mainnet.rpcfast.com?api_key=*****' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":1,
"jsonrpc":"2.0",
"method":"debug_traceCall",
"params": [
{
"from": "0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199",
"to": "0xC469e7aE4aD962c30c7111dc580B4adbc7E914DD",
"gas": "0x38ec9",
"data": "0xa9059cbb000000000000000000000000c469e7ae4ad962c30c7111dc580b4adbc7e914dd0000000000000000000000000000000000000000000000000000000000000001"
},
"latest",
{
"tracer": "simulatorTransaction"
}
]
}'
The method accepts 3 parameters:
  1. 1.
    Object with truncation details
    1. 1.
      from - Address from
    2. 2.
      to - Address tp
    3. 3.
      gas - Gas limit in hex
    4. 4.
      data - Transaction Payload
  2. 2.
    Block hash or latest
  3. 3.
    Tracer specify (required parameter)

Response

Example response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"post": {
"0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199": {
"balance": 7191999784037716435034,
"nonce": 14
},
"0xc469e7ae4ad962c30c7111dc580b4adbc7e914dd": {
"storage": {
"0x673de83553dc3a2c0f59aa7193de392a4530feb73b9d6cd4fcef68802b8195c1": "0x0000000000000000000000000000000000000000000000000000000005f5e0fe",
"0xfb05fe32b3c70ddd1ab6d1436c8058b66823efba374c166903d3ad4780ae2cd4": "0x0000000000000000000000000000000000000000000000000000000000000002"
}
}
},
"pre": {
"0x8626f6940e2eb28930efb4cef49b2d1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dHJhbnNmZXIgYW1vdW50IGV4Y2VlZHMgYmBEggFSZWFsYW5jZWDQG2BkggFSYIQBYQMJVltgAWABYKAbA4SBFmAAgYFSYCCBgVJgQICDIIeHA5BVk4cWgINSkYSQIIBUhwGQVZJRhYFSkJJ/3fJSrRviyJtpwrBo/DeNqpUrp/FjxKEWKPVaTfUjs++RAWBAUYCRA5CjYQTwVltgAGAggINSg1GAgoUBUmAAW4GBEBVhBsdXhYEBgwFRhYIBYEABUoIBYQarVluBgREVYQbZV2AAYECDhwEBUltQYB8BYB8ZFpKQkgFgQAGTklBQUFZbgDVgAWABYKAbA4EWgRRhBwZXYACA/VuRkFBWW2AAgGBAg4UDEhVhBx5XYACA/VthByeDYQbvVluUYCCTkJMBNZNQUFBWW2AAgGAAYGCEhgMSFWEHSldgAID9W2EHU4RhBu9WW5JQYQdhYCCFAWEG71ZbkVBgQIQBNZBQklCSUJJWW2AAYCCChAMSFWEHg1dgAID9W2EHjIJhBu9WW5OSUFBQVltgAIBgQIOFAxIVYQemV2AAgP1bYQevg2EG71ZbkVBhB71gIIQBYQbvVluQUJJQkpBQVltgAYGBHJCCFoBhB9pXYH+CFpFQW2AgghCBFBVhB/tXY05Ie3Fg4BtgAFJgImAEUmAkYAD9W1CRkFBWW2AAghmCERVhCCJXY05Ie3Fg4BtgAFJgEWAEUmAkYAD9W1ABkFb+omRpcGZzWCISIN/3g3zscdx9/uBeALp4Q8HlzBa50EKOxmo1laAX5JjUZHNvbGNDAAgJADM=",
"nonce": 1,
"storage": {
"0x673de83553dc3a2c0f59aa7193de392a4530feb73b9d6cd4fcef68802b8195c1": "0x0000000000000000000000000000000000000000000000000000000005f5e0ff",
"0xfb05fe32b3c70ddd1ab6d1436c8058b66823efba374c166903d3ad4780ae2cd4": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
}
},
"call": {
"from": "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199",
"gas": 211589,
"gasUsed": 34306,
"to": "0xc469e7ae4ad962c30c7111dc580b4adbc7e914dd",
"logs": [
{
"address": "0xc469e7ae4ad962c30c7111dc580b4adbc7e914dd",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008626f6940e2eb28930efb4cef49b2d1f2c9c1199",
"0x000000000000000000000000c469e7ae4ad962c30c7111dc580b4adbc7e914dd"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
],
"value": 0
}
}
}
Response resultobject contain few objects:
  • call - transaction execution results
    • from - Address from
    • to - Address to (can be contract address for contract operaions)
    • gas - gas limit for transaction defined by user
    • gasUsed - real gas usage value
    • value - eth value
    • logs - execution logs
      • address - contract address
      • topics - event optics
      • data - log payload
  • pre / post - State before/after transaction(s) execution
    • <address> - address, used in transaction
      • balance - balance in Wei
      • nonce - nonce
      • code - hex-encoded bytecode
      • storage - storage slots of the contract

Multiple transactions simulation

Sometimes it is necessary to execute several transactions in a row, taking into account the changes made to the state by each transaction. For this, we have developed debug_traceCallMulti method.
It works almost exactly like debug_traceCall, only instead of a single object, it accepts an array of objects of the same format.
cURL Example
curl --location --request POST 'https://bsc-mainnet.rpcfast.com?api_key=***' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":1,
"jsonrpc":"2.0",
"method":"debug_traceCallMulti",
"params": [
[
{"from": "0xdfcec744c8417d2a0ef72fe520438dd20f368369", "to": "0xf508fcd89b8bd15579dc79a6827cb4686a3592c8", "gas": "0x38ec9", "data": "0xa0712d680000000000000000000000000000000000000000000000001a4ca49dff654641"},
{"from": "0xdfcec744c8417d2a0ef72fe520438dd20f368369", "to": "0xf508fcd89b8bd15579dc79a6827cb4686a3592c8", "gas": "0x38ec9", "data": "0xa0712d680000000000000000000000000000000000000000000000001a4ca49dff654641"}
],
"latest",
{
"tracer": "simulatorTransaction"
}
]
}'
The response will also be an array of data, in the same order in which the objects were arranged in the request:
{
"jsonrpc": "2.0",
"id": 1,
"result": [...]
}

Example requests

Block timestamp override

curl --location 'https://bsc-mainnet.rpcfast.com?api_key=***' \
--header 'Content-Type: application/json' \
--data '{
"id":1,
"jsonrpc":"2.0",
"method":"debug_traceCall",
"params": [
{"from": "0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199", "to": "0x62DB6c1678Ca81ea0d946EA3dd75b4F71421A2aE", "gas": "0x38ec9", "data": "0xa9059cbb00000000000000000000000062db6c1678ca81ea0d946ea3dd75b4f71421a2ae0000000000000000000000000000000000000000000000000000000000000001"},
"latest",
{
"tracer": "simulatorTransaction",
"blockOverrides": {
"time": 1692185198
}
}
]
}'

Block number override

curl --location 'https://bsc-mainnet.rpcfast.com?api_key=***' \
--header 'Content-Type: application/json' \
--data '{
"id":1,
"jsonrpc":"2.0",
"method":"debug_traceCall",
"params": [
{"from": "0x3f349bBaFEc1551819B8be1EfEA2fC46cA749aA1", "to": "0x0000000000000000000000000000000000001000", "gas": "0x38ec9", "data": "0xf340fa010000000000000000000000003f349bbafec1551819b8be1efea2fc46ca749aa1"},
"latest",
{
"tracer": "simulatorTransaction",
"blockOverrides": {
"number": "0x1d9a583"
}
}
]
}'

Coinbase address override

curl --location 'https://bsc-mainnet.rpcfast.com?api_key=***' \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "debug_traceCall",
"params": [
{
"from": "0x26EeDf987b1d7e160EFC252878A2C0980BD91504",
"to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"gas": "0xec724",
"gasPrice": "0x63782218b",
"value": "0x5af3107a4000",
"data": "0xd0e30db0"
},
"latest",
{
"tracer": "simulatorTransaction",
"blockoverrides": {
"coinbase":"0xaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef"
}
}
]
}'
Last modified 3mo ago