simulateTransaction
Submit a trial contract invocation to simulate how it would be executed by the network. This endpoint calculates the effective transaction data, required authorizations, and minimal resource fee. It provides a way to test and analyze the potential outcomes of a transaction without actually submitting it to the network.
This method will use 10
Compute Units.
Reference: Here
Parameters
transaction (string)
(required) The transaction to be simulated (serialized in base64)
Returns
minResourceFee string (optional) - Stringified number - Recommended minimum resource fee to add when submitting the transaction. This fee is to be added on top of the Stellar network fee. Not present in case of error.
cost
object (optional) - Information about instructions used, etc. Not present in case of error.results
array[object] (optional) - This array will only have one element: the result for the Host Function invocation. Only present on successful simulation (i.e. no error) ofInvokeHostFunction
operations.transactionData
string (optional) - Serialized base64 string - The recommended Soroban Transaction Data to use when submitting the simulated transaction. This data contains the refundable fee and resource usage information such as the ledger footprint and IO access data (serialized in a base64 string). Not present in case of error.events
array (optional) - Array of serialized base64 strings - Array of the events emitted during the contract invocation. The events are ordered by their emission time. (an array of serialized base64 strings). Only present when simulating ofInvokeHostFunction
operations, note that it can be present on error, providing extra context about what failed.restorePreamble (object) (optional) - It can only be present on sucessful simulation (i.e. no error) of
InvokeHostFunction
operations. If present, it indicates that the simulation detected expired ledger entries which need to be restored before the submission of theInvokeHostFunction
operation. TheminResourceFee
andtransactionData
fields should be used to submit a transaction containing aRestoreFootprint
operationlatestLedger
(string) - A Stringified number - Current latest closed ledger (LCL) observed by the node when this response was generated. Always present.error
string (optional) - This field will include details about why the invoke host function call failed. Only present if the transaction simulation failed.
Last updated