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
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
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"
}'use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "sui_getTransactionBlock",
"params": [
"5PLgmQye6rraDYqpV3npV6H1cUXoJZgJh1dPCyRa3WCv",
{
"showInput": true,
"showEffects": true,
"showEvents": true
}
]
});
let response = client
.post("https://go.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&payload)
.send()
.await?;
println!("Response: {:?}", response.text().await?);
Ok(())
}Response
Repsonse Parameters
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
Transaction Verification: Verify transaction execution status and results, confirming successful completion or diagnosing failures in dApp workflows.
Block Explorer Development: Build block explorer functionality by displaying comprehensive transaction details, including inputs, effects, and state changes.
Event Monitoring: Track smart contract events emitted during transaction execution for real-time monitoring and notifications.
Error Handling
-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?