simulateTransaction
Stellar / https://triport.io/rpc/stellar
Minimum tier: Free
Last updated:
Evaluates a base64-encoded transaction envelope without submitting it and can calculate transaction data, authorizations, resource fees, events, state changes, and restore data.
Use it before a Soroban invocation or for a read-only contract call. The result is advisory input to a separate submission workflow.
sendTransaction is unavailable on this API. Optional result fields may be absent, and result.error is an execution outcome rather than a transport error.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| transaction | string | Yes | In order for the RPC server to successfully simulate a Stellar transaction, the provided transaction must contain only a single operation of the type `invokeHostFunction`. |
| resourceConfig | object | No | Contains configuration for how resources will be calculated when simulating transactions. |
| xdrFormat | string | No | Lets the user choose the format in which the response should be returned - either as unpacked JSON or as base64-encoded XDR strings. Note that you should not rely on any schema for the JSON, as it will change when the underlying XDR changes. |
| authMode | string | No | Specifies the authorization mode to use when simulating the transaction. The options are 'enforce' (default, enforces all authorization checks), 'record' (records authorization without enforcement), and 'record_allow_nonroot' (records authorization while allowing non-root invocations). |
Returns
| Field | Type |
|---|---|
| simulateTransactionResult | object |
Examples
curl https://triport.io/rpc/stellar \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"jsonrpc":"2.0","id":1,"method":"simulateTransaction","params":["<transaction>","<resourceConfig>","<xdrFormat>","<authMode>"]}'const res = await fetch("https://triport.io/rpc/stellar", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"<transaction>",
"<resourceConfig>",
"<xdrFormat>",
"<authMode>"
]
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/rpc/stellar",
headers={"Authorization": "Bearer <api-key>"},
json={"jsonrpc":"2.0","id":1,"method":"simulateTransaction","params":["<transaction>","<resourceConfig>","<xdrFormat>","<authMode>"]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: Stellar.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does simulateTransaction do?
- Submits a trial contract invocation transaction through Stellar Soroban JSON-RPC.
- How many credits does simulateTransaction cost?
- simulateTransaction costs 1 credit(s) per call on Triport by default.
- Is simulateTransaction available over WebSocket?
- simulateTransaction is an HTTP JSON-RPC method.