Skip to main content

simulateTransaction RPC Method

Submit a trial contract invocation to simulate network execution, calculating data, authorizations, and resource fees, for testing and analyzing transaction outcomes without actual network submission.

Updated on
Feb 21, 2024

simulateTransaction RPC Method

Parameters

transaction
string
REQUIRED
The transaction to be simulated (serialized in base64)

Returns

result
object
An object containing the following fields:
transactionData
string
The data to use when submitting the simulated transaction. It is not present in the case of error
events
array
An array of the events emitted during the contract invocation
minResourceFee
string
The minimum resource fee to add when submitting the transaction
results
array
The result for the Host Function invocation which contains the following fields:
auth
string
An array of serialized base64 strings representing per-address authorizations recorded during the simulation of this Host Function call
xdr
string
The return value of the Host Function call
cost
object
An object which contains the information about the instructions used
cpuInsns
string
The total cpu instructions consumed by this transaction
memBytes
string
The total memory bytes allocated by this transaction
restorePreamble
object
If present, it signifies the detection of expired ledger entries that require restoration before submitting the InvokeHostFunction operation
latestLedger
string
The current latest closed ledger (LCL) observed by the node when this response was generated
Request
1
curl --location 'https://docs-demo.stellar-mainnet.quiknode.pro/' \
2
--header 'Content-Type: application/json' \
3
--data '{
4
"jsonrpc": "2.0",
5
"id": 8675309,
6
"method": "simulateTransaction",
7
"params": {
8
"transaction": "YOUR_TRANSACTION"
9
}
10
}'
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free