sui_devInspectTransactionBlock{deprecated} - Sui

This method runs a transaction in dev-inspect mode for testing and development purposes. Unlike dryRunTransactionBlock, this method, it doesn't require gas payment and can simulate transactions from any sender address. It's primarily used for debugging and testing Move function calls.

This method is deprecated

Parameters

ParameterTypeRequiredDescription
sender_addressSuiAddressYesThe simulated sender's address
tx_bytesBase64YesBCS encoded TransactionKind
gas_priceBigInt_for_uint64NoGas price for cost calculation
epochBigInt_for_uint64NoEpoch to simulate execution in

Returns

FieldTypeDescription
effectsobjectSimulated execution effects
resultsarrayReturn values from Move calls
eventsarrayEvents that would be emitted

Request Example

bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "sui_devInspectTransactionBlock",
  "params": [
    "0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961",
    "AAACACB...<base64_tx_bytes>",
    null,
    null
  ]
}'

example.js

javascriptconst axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'sui_devInspectTransactionBlock',
  params: [
    '0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961',
    'AAACACB...<base64_tx_bytes>',
    null,
    null
  ]
};

axios.post(url, payload, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

example.py

pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = {
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "sui_devInspectTransactionBlock",
    "params": [
        "0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961",
        "AAACACB...<base64_tx_bytes>",
        None,
        None
    ]
}

response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print(response.json())

main.rs

rustuse 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_devInspectTransactionBlock",
        "params": [
            "0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961",
            "AAACACB...<base64_tx_bytes>",
            null,
            null
        ]
    });

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&payload)
        .send()
        .await?;

    let result: serde_json::Value = response.json().await?;
    println!("{:#?}", result);
    
    Ok(())
}

Response Example

json{
  "jsonrpc": "2.0",
  "result": {
    "effects": {
      "messageVersion": "v1",
      "status": {
        "status": "success"
      },
      "gasUsed": {
        "computationCost": "1000000",
        "storageCost": "2000000",
        "storageRebate": "500000"
      }
    },
    "results": [
      {
        "returnValues": [],
        "mutableReferenceOutputs": []
      }
    ],
    "events": []
  },
  "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
effectsobjectSimulated execution effects and gas costs
resultsarrayReturn values from Move function calls
eventsarrayEvents that would be emitted

Use Cases

  • Test Move function calls without gas
  • Debug smart contract logic
  • Simulate transactions from any address
  • Inspect return values from functions
  • Development and testing workflows

Error Handling

Error CodeDescription
-32602Invalid params - malformed input
-32603Internal error - simulation failed
MoveAbortMove execution aborted

SDK Integration

example.ts

typescriptimport { SuiClient } from '@mysten/sui/client';
import { Transaction } from '@mysten/sui/transactions';

const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });

const tx = new Transaction();
// ... build transaction

const result = await client.devInspectTransactionBlock({
  sender: '0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961',
  transactionBlock: tx,
});

console.log(result);

main.rs

rustuse sui_sdk::SuiClientBuilder;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let sui = SuiClientBuilder::default()
        .build("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .await?;
    
    let sender = "0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961".parse()?;
    // let tx_bytes = ...
    let result = sui.read_api().dev_inspect_transaction_block(sender, tx_bytes, None, None).await?;
    
    println!("{:?}", result);
    Ok(())
}