SimulateTransaction - Sui

SimulateTransaction. Simulates a transaction without submitting it.

SimulateTransaction - sui [Value: 20CU]
Simulates a transaction without submitting it. Returns effects, command outputs and a suggested gas price, and can select gas.
gRPC: sui.rpc.v2.TransactionExecutionService/SimulateTransaction
Use cases

Use cases

  • Estimate gas before sending
  • Preview effects and balance changes
  • Read Move function return values
Constraints

Constraints

  • Does not change chain state
  • Signatures are not required
  • Gas selection ignored if checks disabled
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
grpcurl \
  -H "x-drpc-key: {API-KEY}" \
  -H "x-drpc-chain: sui" \
  -d '{
  "transaction": {
    "bcs": { "value": "<BASE64_TRANSACTION_DATA_BCS>" }
  },
  "read_mask": "transaction.effects.status,transaction.effects.gasUsed,transaction.balanceChanges",
  "do_gas_selection": true
}' \
  grpc.drpc.live:443 \
  sui.rpc.v2.TransactionExecutionService/SimulateTransaction
Copy
Response
200
{
  "transaction": {
    "effects": {
      "status": { "success": true },
      "gas_used": {
        "computation_cost": "750000",
        "storage_cost": "1976000",
        "storage_rebate": "978120",
        "non_refundable_storage_fee": "9880"
      }
    },
    "balance_changes": [
      {
        "address": "0x94096a6a54129234237759c66e6ef1037224fb3102a0ae29d33b490281c8e4d5",
        "coin_type": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
        "amount": "-1001747880"
      },
      {
        "address": "0x3c1f0e7a2b4d6c8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e",
        "coin_type": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
        "amount": "1000000000"
      }
    ]
  },
  "suggested_gas_price": "500"
}
Copy

Request params

Parametersobject
object
transactionobject
Required. The transaction to simulate.
read_maskstring
Optional. google.protobuf.FieldMask with the fields of the response to return, as comma-separated paths (for example `transaction.effects.status`). If omitted, all fields are returned.
checksstring
Optional. Whether checks are `ENABLED` (default) or `DISABLED` while executing the transaction.
do_gas_selectionboolean
Optional. Perform gas selection based on a budget estimation and include the selected gas payment and budget in the response. Ignored when `checks` is `DISABLED`.

Response

200
Simulates a transaction without submitting it. Returns effects, command outputs and a suggested gas price, and can select gas.

Response params

object
transactionobject
The simulated transaction with its effects. Only fields included in `read_mask` are populated.
object
digeststring
The transaction digest.
transactionobject
The transaction itself: `bcs`, `digest`, `version`, `kind`, `sender`, `gas_payment`, `expiration`.
signaturesarray_of_objects
User signatures authorizing the transaction.
effectsobject
Transaction effects.
object
statusobject
Execution status: `success`, and `error` if it failed.
epochstring
Epoch in which the transaction was executed.
gas_usedobject
Gas used by the transaction: `computation_cost`, `storage_cost`, `storage_rebate`, `non_refundable_storage_fee`.
changed_objectsarray_of_objects
Objects whose state was changed by the transaction.
gas_objectobject
Information about the gas object. Not set for system transactions that do not require gas.
dependenciesarray_of_strings
Digests of transactions this one depends on.
eventsobject
Events emitted by the transaction (`digest`, `events`). May be empty if the transaction emitted no events.
checkpointstring
Sequence number of the checkpoint that includes the transaction.
timestampstring
Unix timestamp of the checkpoint that includes the transaction (RFC 3339 in JSON).
balance_changesarray_of_objects
Balance changes per address and coin type (`address`, `coin_type`, `amount`).
objectsobject
Objects referenced as inputs or produced as outputs by the transaction.
transaction_indexstring
Position of the transaction within its checkpoint.
command_outputsarray_of_objects
Per-command outputs: `return_values` and `mutated_by_ref`, each with `argument`, `value` (BCS) and `json`.
suggested_gas_pricestring
Suggested gas price above the reference gas price, to improve inclusion under congestion.