sui_dryRunTransactionBlock - Sui

Example code for the sui_dryRunTransactionBlock JSON-RPC method. Complete guide on how to use sui_dryRunTransactionBlock JSON-RPC in GetBlock Web3 documentation.

This method performs a dry run of a transaction block without committing it to the blockchain. This simulates transaction execution to predict effects, gas costs, and potential errors before actual submission. It's essential for transaction validation, gas estimation, and debugging.

Parameters

Parameter
Type
Required
Description

tx_bytes

Base64

Yes

BCS serialized transaction data bytes

Returns

Field
Type
Description

effects

object

Simulated execution effects

events

array

Events that would be emitted

objectChanges

array

Objects that would be modified

balanceChanges

array

Balance changes that would occur

input

object

Parsed transaction input

Request Example

curl
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "sui_dryRunTransactionBlock",
  "params": ["AAACACB...<base64_tx_bytes>"]
}'

Response Example

Response Parameters

Parameter
Type
Description

effects

object

Simulated transaction effects and gas usage

events

array

Events that would be emitted

objectChanges

array

Objects that would be created/modified/deleted

balanceChanges

array

Balance changes for each affected address

input

object

Parsed transaction input data

Use Cases

  • Estimate gas costs before submission

  • Validate transaction parameters

  • Debug failed transaction logic

  • Preview object and balance changes

  • Test smart contract interactions safely

Error Handling

Error Code
Description

-32602

Invalid params - malformed transaction bytes

-32603

Internal error - simulation failed

MoveAbort

Move execution aborted with error code

InsufficientGas

Gas budget would be insufficient

SDK Integration

Last updated

Was this helpful?