simulateTransaction

Simulates a transaction to preview its effects.

This is essential for Soroban transactions to:

  • Calculate resource requirements (CPU, memory, storage)

  • Determine authorization entries needed

  • Estimate resource fees

  • Preview contract invocation results

The transaction should contain exactly one operation of type:

  • InvokeHostFunctionOperation

  • ExtendFootprintTTLOperation

  • RestoreFootprintOperation

Any existing footprint in the transaction is ignored during simulation.

Example

val simulation = server.simulateTransaction(transaction)
if (simulation.error != null) {
println("Simulation failed: ${simulation.error}")
} else {
println("Min resource fee: ${simulation.minResourceFee}")
println("Results: ${simulation.results}")
}

Return

Simulation results including costs, footprint, and results

Parameters

transaction

The transaction to simulate

resourceConfig

Optional resource configuration for additional headroom

authMode

Optional authorization mode (ENFORCE, RECORD, RECORD_ALLOW_NONROOT)

See also

Throws

If the RPC request fails