sui_executeTransactionBlock{deprecated} - Sui

This method executes a signed transaction block on the SUI network and waits for the results. This is the primary method for submitting transactions, including token transfers, smart contract calls, NFT operations, and staking actions.

This method is deprecated

Parameters

ParameterTypeRequiredDescriptionDefault/Supported Values
tx_bytesstringYesBCS serialized transaction data (Base64 encoded)Valid Base64 transaction bytes
signaturesarrayYesArray of Base64 encoded signaturesValid signature strings
optionsobjectNoResponse content optionsSee TransactionBlockResponseOptions
request_typestringNoExecution wait mode"WaitForEffectsCert" or "WaitForLocalExecution"

Request Example

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "sui_executeTransactionBlock",
  "params": [
    "AAACACB...<base64_tx_bytes>",
    ["AQ7K...<base64_signature>"],
    {
      "showInput": true,
      "showEffects": true,
      "showEvents": true,
      "showObjectChanges": true,
      "showBalanceChanges": true
    },
    "WaitForLocalExecution"
  ],

    }'
javascriptimport axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "sui_executeTransactionBlock",
  "params": [
    "AAACACB...<base64_tx_bytes>",
    ["AQ7K...<base64_signature>"],
    {
      "showInput": true,
      "showEffects": true,
      "showEvents": true,
      "showObjectChanges": true,
      "showBalanceChanges": true
    },
    "WaitForLocalExecution"
  ],
  "id": "getblock.io"
    });

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));
pythonimport requests
import json

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

payload = json.dumps({
    "jsonrpc": "2.0",
     "method": "sui_executeTransactionBlock",
  "params": [
    "AAACACB...<base64_tx_bytes>",
    ["AQ7K...<base64_signature>"],
    {
      "showInput": true,
      "showEffects": true,
      "showEvents": true,
      "showObjectChanges": true,
      "showBalanceChanges": true
    },
    "WaitForLocalExecution"
  ],
"id": "getblock.io"
    })

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
rustuse reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
            "jsonrpc": "2.0",
            "method": "sui_executeTransactionBlock",
          "params": [
            "AAACACB...<base64_tx_bytes>",
            ["AQ7K...<base64_signature>"],
            {
              "showInput": true,
              "showEffects": true,
              "showEvents": true,
              "showObjectChanges": true,
              "showBalanceChanges": true
            },
            "WaitForLocalExecution"
          ],

            "id": "getblock.io"
        }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}

Response

json{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": {
    "digest": "7dp5WtTmtGp83EXYYFMzjBJRFeSgR67AzqMETLrfgeFx",
    "effects": {
      "messageVersion": "v1",
      "status": {"status": "success"},
      "executedEpoch": "100",
      "gasUsed": {
        "computationCost": "1000000",
        "storageCost": "2000000",
        "storageRebate": "500000"
      }
    },
    "events": [],
    "objectChanges": [],
    "balanceChanges": [],
    "confirmedLocalExecution": true
  }
}

Repsonse Parameters

ParameterTypeDescription
result.digeststringUnique transaction digest
result.transactionobjectExecuted transaction data
result.effectsobjectExecution results and gas usage
result.eventsarrayEvents emitted during execution
result.objectChangesarrayObjects created, modified, or deleted
result.balanceChangesarrayBalance changes per address
result.confirmedLocalExecutionbooleanLocal execution confirmation

Use Cases

  1. Token Transfers: Submit signed transactions to transfer SUI or custom tokens between addresses on the network.
  2. Smart Contract Execution: Execute Move function calls on deployed packages, enabling interaction with DeFi protocols and dApps.
  3. NFT Operations: Mint, transfer, or burn NFTs by executing the appropriate transaction blocks.

Error handling

ErrorDescriptionSolution
InvalidSignatureSignature verification failedEnsure the transaction is signed correctly
InsufficientGasGas budget insufficientIncrease gas budget in transaction
InsufficientCoinBalanceNot enough balanceVerify sender has sufficient funds
ObjectNotFoundReferenced object missingCheck object IDs are valid

SDK Integration

example.ts

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

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

const tx = new Transaction();
tx.transferObjects([tx.object('0x...')], tx.pure.address('0x...'));

const result = await client.signAndExecuteTransaction({
  signer: keypair,
  transaction: tx,
  options: { showEffects: true, showEvents: true },
});

console.log(result);

example_sui_rust.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?;
    
    // Build and sign transaction, then execute
    let result = sui.quorum_driver_api()
        .execute_transaction_block(tx_bytes, vec![signature], None, None)
        .await?;
    
    println!("{:?}", result);
    Ok(())
}