sui_getTransactionBlock - Sui

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

This method retrieves detailed information about a transaction block for a specified digest on the SUI network, including inputs, effects, events, object changes, and balance changes.

Parameters

Parameter
Type
Required
Description
Default/Supported Values

digest

string

Yes

The transaction digest (Base58 encoded hash)

Valid transaction digest string

options

object

No

Options specifying which data to include

See TransactionBlockResponseOptions

TransactionBlockResponseOptions

Field
Type
Default
Description

showInput

boolean

false

Include transaction input data

showRawInput

boolean

false

Include raw transaction bytes

showEffects

boolean

false

Include execution effects

showEvents

boolean

false

Include emitted events

showObjectChanges

boolean

false

Include object modifications

showBalanceChanges

boolean

false

Include balance changes

Request Example

curl --location --request POST https://go.getblock.io/<ACCESS-TOKEN>/ \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "method": "sui_getTransactionBlock",
  "params": [
    "5PLgmQye6rraDYqpV3npV6H1cUXoJZgJh1dPCyRa3WCv",
    {
      "showInput": true,
      "showEffects": true,
      "showEvents": true,
      "showObjectChanges": true,
      "showBalanceChanges": true
    }
  ],
  "id": "getblock.io"
}'

Response

Repsonse Parameters

Parameter
Type
Description

result.digest

string

Transaction digest (unique identifier)

result.transaction

object

Transaction input data including sender and gas info

result.effects

object

Execution results, status, and gas usage

result.events

array

Events emitted during execution

result.objectChanges

array

Objects created, mutated, or deleted

result.balanceChanges

array

Balance changes per affected address

result.timestampMs

string

Transaction timestamp in milliseconds

result.checkpoint

string

Checkpoint sequence number


Use Cases

  1. Transaction Verification: Verify transaction execution status and results, confirming successful completion or diagnosing failures in dApp workflows.

  2. Block Explorer Development: Build block explorer functionality by displaying comprehensive transaction details, including inputs, effects, and state changes.

  3. Event Monitoring: Track smart contract events emitted during transaction execution for real-time monitoring and notifications.

Error Handling

Code
Description
Solution

-32700

The transaction digest is malformed

Ensure the digest is a valid Base58 encoded string

-32602

Transaction not found

Verify the digest is correct and the transaction exists

Network Sync

Node not fully synced

Wait for node synchronization or try another endpoint

SDK Integration

Last updated

Was this helpful?