TriportRPC

simulateTransaction

Stellar / https://triport.io/rpc/stellar

Minimum tier: Free

Stellar method guide

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

simulateTransaction parameters
NameTypeRequiredDescription
transactionstringYesIn order for the RPC server to successfully simulate a Stellar transaction, the provided transaction must contain only a single operation of the type `invokeHostFunction`.
resourceConfigobjectNoContains configuration for how resources will be calculated when simulating transactions.
xdrFormatstringNoLets 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.
authModestringNoSpecifies 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

simulateTransaction return value
FieldType
simulateTransactionResultobject

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

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Stellar.
  3. Clusters: mainnet.
  4. 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.