Skip to main content

starknet_simulateTransactions

Simulates multiple transactions and returns the transactions trace for the v0.4 RPC version

Simulates multiple transactions and returns the transactions trace for the v0.4 RPC version

The starknet_simulateTransactions command allows you to simulate the execution of multiple transactions on the StarkNet network and receive simulation results for each transaction.

Parameters

  • transactions: A list of transactions to be simulated. Each transaction should include 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

An array of results, each containing the simulation result for a specific transaction.

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_simulateTransactions",
"params": {
"transactions": [
{
"to": "0xCONTRACT_ADDRESS_1",
"data": "0xTRANSACTION_DATA_1",
"nonce": "0xNONCE_1",
"signature": "0xSIGNATURE_1"
},
{
"to": "0xCONTRACT_ADDRESS_2",
"data": "0xTRANSACTION_DATA_2",
"nonce": "0xNONCE_2",
"signature": "0xSIGNATURE_2"
}
],
"block_id": "latest",
"simulation_flags": ["flag1", "flag2"]
},
"id": 1
}'

Result

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