Simulations Quickstart
This quickstart guide demonstrates how to simulate a single transaction on the Node RPC using a custom RPC method tenderly_simulateTransaction
. See RPC simulation reference. Simulations allow you to precisely verify the transaction’s behavior before sending it to the blockchain.
Simulation RPC is available both on Node RPC and Virtual TestNet RPCs
Get the RPC URL
Log into your Tenderly account and from the left-hand menu click on Node.
Copy the RPC URL of your preferred network. If your network is not supported on the Node, simulate via API instead.
example
https://mainnet.gateway.tenderly.co/${TENDERLY_NODE_ACCESS_KEY}
The access key is automatically appended to the end of the RPC URL.
Send the request
Make a POST
request to the RPC URL.
Your request must include:
- The RPC URL with your access key.
- Call to the RPC method
tenderly_simulateTransaction
. - Transaction parameters such as
from
,to
,gas
,gas price
,value
, anddata
.
Example cURL request
example
curl https://mainnet.gateway.tenderly.co/$TENDERLY_NODE_ACCESS_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 0,
"jsonrpc": "2.0",
"method": "tenderly_simulateTransaction",
"params": [
{
"from": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"gas": "0x0",
"gasPrice": "0x0",
"value": "0x0",
"data": "0xa9059cbb00000000000000000000000020a5814b73ef3537c6e099a0d45c798f4bd6e1d60000000000000000000000000000000000000000000000000000000000000001"
},
"latest"
]
}'
Explore use cases
- Asset and balance changes: Get exact dollar values for all balance and asset changes that will happen.
- Gas estimation: Accurately predict the gas costs before sending the transaction.
- State overrides: Modify blockchain conditions like timestamps and contract data to test different scenarios.
- Preview transaction outcomes: Identify and fix issues that could cause transactions to fail.