Skip to main content

starknet_simulateTransaction

Simulates the transaction and returns the transaction trace for the v0.3 RPC version

Simulates the transaction and returns the transaction trace for the v0.3 RPC version

The starknet_simulateTransaction command allows you to simulate the execution of a single transaction on the StarkNet network and receive the simulation results.

Parameters

  • transactions: The transaction you want to simulate, including the recipient's address, data, nonce, and signature.
  • block_id: The block tag specifying the block to be used for simulation.
  • simulation_flags: A set of flags used for simulation (E.g. "SKIP_VALIDATE" or "SKIP_EXECUTE")

Returns

The result of the simulated transaction, including various simulation-specific data.

Example Request and Result for starknet_simulateTransaction

Request

curl https://starknet-mainnet.blastapi.io/<project-id> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_simulateTransaction",
"params": {
"transactions": {
"to": "0xCONTRACT_ADDRESS",
"data": "0xTRANSACTION_DATA",
"nonce": "0xNONCE",
"signature": "0xSIGNATURE"
},
"block_id": "latest",
"simulation_flags": ["flag1", "flag2"]
},
"id": 1
}'

Result

{
"result": [
{
"transaction_trace": {
// Trace details for the transaction
},
"fee_estimation": {
// Fee estimation for the transaction
}
}
],
"id": 1
}