> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sui tooling

> Sui blockchain development tools guide. Use TypeScript SDK, Rust SDK, Python pysui, Go SDK, and JSON-RPC API for building Sui applications with Chainstack.

Get started with a [reliable Sui RPC endpoint](https://chainstack.com/build-better-with-sui/) to use the tools below.

## JSON-RPC API

Interact with your Sui node using the [Sui JSON-RPC API](https://docs.sui.io/sui-api-ref).

Use your Chainstack Sui RPC endpoint to make API calls. Example to get the latest checkpoint:

<CodeGroup>
  ```bash cURL theme={"system"}
  curl --request POST \
    --url YOUR_CHAINSTACK_ENDPOINT \
    --header 'Content-Type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "sui_getLatestCheckpointSequenceNumber",
      "params": []
    }'
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch('YOUR_CHAINSTACK_ENDPOINT', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 1,
      method: 'sui_getLatestCheckpointSequenceNumber',
      params: []
    })
  });

  const data = await response.json();
  console.log(data.result);
  ```

  ```python Python theme={"system"}
  import requests

  payload = {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "sui_getLatestCheckpointSequenceNumber",
      "params": []
  }

  response = requests.post('YOUR_CHAINSTACK_ENDPOINT', json=payload)
  print(response.json()['result'])
  ```
</CodeGroup>

## gRPC API

Sui nodes on Chainstack support gRPC for high-performance access. gRPC uses HTTP/2 and Protocol Buffers for efficient binary serialization, making it ideal for streaming data and high-throughput applications.

### Endpoint format

Your Sui gRPC endpoint is available at:

```
sui-mainnet.core.chainstack.com:443
sui-testnet.core.chainstack.com:443
```

### Authentication

gRPC endpoints use x-token authentication. Pass your token in the request metadata:

* **x-token** — your authentication token from the Chainstack console

### Usage examples

<CodeGroup>
  ```bash grpcurl theme={"system"}
  grpcurl -H "x-token: YOUR_X_TOKEN" \
    sui-mainnet.core.chainstack.com:443 \
    list
  ```

  ```python Python theme={"system"}
  import grpc

  # Create channel with TLS
  channel = grpc.secure_channel(
      'sui-mainnet.core.chainstack.com:443',
      grpc.ssl_channel_credentials()
  )

  # Add x-token to metadata for all calls
  metadata = [('x-token', 'YOUR_X_TOKEN')]

  # Use the channel with your gRPC stubs
  # Example: stub = SuiServiceStub(channel)
  # response = stub.SomeMethod(request, metadata=metadata)
  ```

  ```javascript Node.js theme={"system"}
  const grpc = require('@grpc/grpc-js');

  // Create credentials with TLS
  const credentials = grpc.credentials.createSsl();

  // Create channel
  const channel = new grpc.Channel(
    'sui-mainnet.core.chainstack.com:443',
    credentials
  );

  // Add x-token to metadata for calls
  const metadata = new grpc.Metadata();
  metadata.add('x-token', 'YOUR_X_TOKEN');

  // Use with your gRPC client
  ```

  ```go Go theme={"system"}
  package main

  import (
      "google.golang.org/grpc"
      "google.golang.org/grpc/credentials"
      "google.golang.org/grpc/metadata"
      "context"
  )

  func main() {
      // Create TLS credentials
      creds := credentials.NewTLS(nil)

      // Connect to gRPC endpoint
      conn, err := grpc.Dial(
          "sui-mainnet.core.chainstack.com:443",
          grpc.WithTransportCredentials(creds),
      )
      if err != nil {
          panic(err)
      }
      defer conn.Close()

      // Add x-token to context
      ctx := metadata.AppendToOutgoingContext(
          context.Background(),
          "x-token", "YOUR_X_TOKEN",
      )

      // Use ctx with your gRPC calls
  }
  ```
</CodeGroup>

<Info>
  Find your gRPC endpoint and x-token in the Chainstack console under your Sui node's **Access and credentials** section.
</Info>

## Sui TypeScript SDK

The [Sui TypeScript SDK](https://github.com/MystenLabs/sui/tree/main/sdk/typescript) is the official SDK for building Sui applications.

### Installation

```bash theme={"system"}
npm install @mysten/sui.js
```

### Basic usage

<CodeGroup>
  ```typescript Connection theme={"system"}
  import { SuiClient, getFullnodeUrl } from '@mysten/sui.js/client';

  // Connect to your Chainstack node
  const client = new SuiClient({
    url: 'YOUR_CHAINSTACK_ENDPOINT'
  });

  // Get latest checkpoint
  const checkpoint = await client.getLatestCheckpointSequenceNumber();
  console.log('Latest checkpoint:', checkpoint);
  ```

  ```typescript Query Objects theme={"system"}
  import { SuiClient } from '@mysten/sui.js/client';

  const client = new SuiClient({
    url: 'YOUR_CHAINSTACK_ENDPOINT'
  });

  // Get objects owned by an address
  const objects = await client.getOwnedObjects({
    owner: '0x...',
    options: {
      showType: true,
      showContent: true,
    }
  });
  ```

  ```typescript Send Transaction theme={"system"}
  import { SuiClient } from '@mysten/sui.js/client';
  import { TransactionBlock } from '@mysten/sui.js/transactions';
  import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519';

  const client = new SuiClient({
    url: 'YOUR_CHAINSTACK_ENDPOINT'
  });

  const keypair = Ed25519Keypair.generate();
  const tx = new TransactionBlock();

  // Add transaction commands
  tx.transferObjects([objectId], recipient);

  // Sign and execute
  const result = await client.signAndExecuteTransactionBlock({
    signer: keypair,
    transactionBlock: tx,
  });
  ```
</CodeGroup>

## Sui Rust SDK

The [Sui Rust SDK](https://github.com/MystenLabs/sui/tree/main/crates/sui-sdk) provides comprehensive Rust bindings for Sui.

### Installation

Add to your `Cargo.toml`:

```toml theme={"system"}
sui-sdk = { git = "https://github.com/mystenlabs/sui", package = "sui-sdk" }
tokio = { version = "1.2", features = ["full"] }
anyhow = "1.0" 
```

### Basic usage

```rust theme={"system"}
use sui_sdk::SuiClientBuilder;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let sui = SuiClientBuilder::default()
        .build("YOUR_CHAINSTACK_ENDPOINT")
        .await?;
    
    let checkpoint = sui.read_api().get_latest_checkpoint_sequence_number().await?;
    println!("Latest checkpoint: {}", checkpoint);
    
    Ok(())
}
```

## Python SDK (pysui)

[pysui](https://github.com/FrankC01/pysui) is a community-maintained Python SDK for Sui.

### Installation

```bash theme={"system"}
pip install pysui
```

### Basic usage

```python theme={"system"}
from pysui import SuiConfig, SyncClient

# Configure client with your Chainstack endpoint
config = SuiConfig.custom_config(
    rpc_url="YOUR_CHAINSTACK_ENDPOINT"
)

client = SyncClient(config)

# Get latest checkpoint
checkpoint = client.get_latest_checkpoint_sequence_number()
print(f"Latest checkpoint: {checkpoint.result_data}")
```

## Go SDK

The [Sui Go SDK](https://github.com/block-vision/sui-go-sdk) provides Go language bindings for Sui.

### Installation

```bash theme={"system"}
go get github.com/block-vision/sui-go-sdk
```

### Basic usage

```go theme={"system"}
package main

import (
    "context"
    "fmt"
    "github.com/block-vision/sui-go-sdk/sui"
)

func main() {
    client := sui.NewSuiClient("YOUR_CHAINSTACK_ENDPOINT")
    
    ctx := context.Background()
    checkpoint, err := client.SuiGetLatestCheckpointSequenceNumber(ctx)
    if err != nil {
        panic(err)
    }
    
    fmt.Printf("Latest checkpoint: %s\n", checkpoint)
}
```
