For the complete documentation index, see llms.txt. This page is also available as Markdown.

TransactionExecutionService/SimulateTransaction - SUI

Example code for the TransactionExecutionService/SimulateTransaction gRPC method. Complete guide on how to use TransactionExecutionService/SimulateTransacti gRPC method in GetBlock Web3 documentation.

Dry-runs a transaction without committing it. Returns the same effects shape as ExecuteTransaction but doesn't broadcast — use this for accurate gas estimation, pre-flight error detection, and to preview the effects of a transaction before signing.

Service: sui.rpc.v2.TransactionExecutionService Proto file: sui/rpc/v2/transaction_execution_service.proto Full method path: sui.rpc.v2.TransactionExecutionService/SimulateTransaction

Request Fields

Field
Type
Required
Description

transaction

Transaction

Yes

BCS-encoded transaction body (unsigned is acceptable for simulation)

read_mask

FieldMask

No

Field paths to include in the response

Request Example

# Clone the official proto files first (one-time setup):
#   git clone https://github.com/MystenLabs/sui-apis.git && cd sui-apis

grpcurl \
  -import-path proto \
  -proto sui/rpc/v2/transaction_execution_service.proto \
  -H "x-grpc-web: 1" \
  -d '{
    "transaction": {
        "bcs": "AQAA..."
    },
    "read_mask": {
        "paths": [
            "effects.status",
            "effects.gas_used",
            "events"
        ]
    }
}' \
  go.getblock.io:443/<ACCESS-TOKEN> \
  sui.rpc.v2.TransactionExecutionService/SimulateTransaction

Response Example

Responses are encoded in Protocol Buffers binary format on the wire. The example below shows the protobuf JSON encoding for readability.

Response Fields

Field
Type
Description

transaction.effects.status

ExecutionStatus

Would-execute status — success: true or error

transaction.effects.gas_used

GasCostSummary

Would-be gas cost — the most accurate gas estimate available

transaction.events

repeated Event

Events that would be emitted on execution

Use Cases

  • Accurate gas estimation before broadcast

  • Pre-flight validation in wallet UIs — preview what a transaction will do

  • Detecting transactions that would revert without burning gas

  • Off-chain simulation for analytics and audit

Error Handling

gRPC uses status codes rather than JSON-RPC numeric error codes. The most relevant for this method:

Status Code
Numeric
Cause

UNAUTHENTICATED

16

Missing or invalid <ACCESS-TOKEN> in the URL path

INVALID_ARGUMENT

3

Request fields are missing, malformed, or fail validation

UNAVAILABLE

14

Node is overloaded or temporarily unable to handle the request — retry with backoff

DEADLINE_EXCEEDED

4

Request did not complete within the timeout window

RESOURCE_EXHAUSTED

8

Rate limit exceeded for your plan

INVALID_ARGUMENT

3

Malformed transaction bytes

SDK Integration

Was this helpful?