Sui Go SDK: Build and Interact with Sui Blockchain Using Golang

·

The Sui Go SDK is a powerful, developer-friendly toolkit designed to streamline interactions with the Sui blockchain using the Go programming language. Built by the SuiVision team, this open-source SDK provides comprehensive access to Sui's RPC methods while introducing developer-centric enhancements for faster, more efficient integration. Whether you're building decentralized applications, wallet services, or blockchain analytics tools, the Sui Go SDK delivers the performance and flexibility you need.

This guide explores everything from setup and core features to practical code examples for reading data, writing transactions, and real-time event subscription—making it your go-to resource for mastering Sui development in Go.


Why Use the Sui Go SDK?

Go (Golang) is widely adopted in backend and infrastructure development due to its concurrency support, fast execution, and clean syntax. With the rise of high-performance blockchains like Sui, developers need robust tools to interface securely and efficiently. The Sui Go SDK bridges that gap by offering:

👉 Discover how to integrate blockchain functionality seamlessly into your Go apps today.


Core Features of the Sui Go SDK

The SDK is engineered to simplify blockchain interaction without sacrificing control or capability. Key features include:

✅ Full RPC Method Coverage

Supports essential modules including:

✅ Custom Request Support

Use SuiCall to directly invoke any Sui RPC method not explicitly wrapped—ideal for early-access or custom node APIs.

✅ Flexible Authentication

Unsigned methods (like balance checks or object queries) can be executed without loading private keys or mnemonic phrases—enhancing security during read operations.

✅ Built-in Transaction Signing

Easily sign and broadcast transactions using SignAndExecuteTransactionBlock, supporting both local and remote execution modes.

✅ Real-Time Data Streaming

Leverage WebSocket subscriptions to monitor:

These capabilities make the Sui Go SDK ideal for backend services, monitoring systems, and real-time dApps.


Getting Started with the Sui Go SDK

Installation

Install the SDK using Go modules:

go get github.com/block-vision/sui-go-sdk

Ensure you’re using a compatible version of Go (1.19+ recommended).

Connect to the Sui Network

Use NewSuiClient with a valid RPC endpoint. For quick testing, leverage free endpoints provided by BlockVision:

package main

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

func main() {
 cli := sui.NewSuiClient("https://sui-testnet-endpoint.blockvision.org")
 fmt.Println("Connected to Sui TestNet")
}

Available endpoints:


Working with Test Tokens: Faucet Integration

During development on DevNet or TestNet, obtain test SUI tokens via the built-in faucet client.

func RequestDevNetSuiFromFaucet() {
 faucetHost, err := sui.GetFaucetHost(constant.SuiDevnet)
 if err != nil {
  fmt.Println("GetFaucetHost err:", err)
  return
 }

 recipient := "0xaf9f4d20c205f26051a7e1758601c4c47a9f99df3f9823f70926c17c80882d36"
 header := map[string]string{}

 err = sui.RequestSuiFromFaucet(faucetHost, recipient, header)
 if err != nil {
  fmt.Println(err.Error())
  return
 }

 fmt.Println("Request DevNet Sui From Faucet success")
}

This feature accelerates testing cycles without manual token requests.


Writing Transactions on Sui

Transfer an Object

Move NFTs or custom assets between addresses:

rsp, err := cli.TransferObject(ctx, models.TransferObjectRequest{
 Signer:     signerAccount.Address,
 ObjectId:   "0x99b5...",
 Gas:        &gasObj,
 GasBudget:  "100000000",
 Recipient:  "0xaf9f...",
})

Then sign and execute:

cli.SignAndExecuteTransactionBlock(ctx, models.SignAndExecuteTransactionBlockRequest{
 TxnMetaData: rsp,
 PriKey:      priKey,
 Options: models.SuiTransactionBlockOptions{
  ShowEffects: true,
 },
 RequestType: "WaitForLocalExecution",
})

Transfer SUI Coins

Send native SUI tokens with minimal configuration:

rsp, err := cli.TransferSui(ctx, models.TransferSuiRequest{
 Signer:       signerAccount.Address,
 SuiObjectId:  "0xc699...",
 GasBudget:    "100000000",
 Recipient:    "0xb7f9...",
 Amount:       "1",
})

Execute Move Smart Contracts

Interact with deployed Move modules using MoveCall:

rsp, err := cli.MoveCall(ctx, models.MoveCallRequest{
 Signer:           signerAccount.Address,
 PackageObjectId:  "0x7d58...",
 Module:           "auction",
 Function:         "start_an_auction",
 Arguments: []interface{}{"0x342e...", "BlockVision"},
 GasBudget:        "100000000",
})

Perfect for dApp backends managing auctions, staking, or game logic.

Merge SUI Coins

Optimize gas usage by merging small coins:

rsp, err := cli.MergeCoins(ctx, models.MergeCoinsRequest{
 Signer:      signerAccount.Address,
 PrimaryCoin: "0x180f...",
 CoinToMerge: "0x3b46...",
 GasBudget:   "100000000",
})

Reading Data from the Sui Blockchain

Get All Balances for an Address

Fetch all coin types owned by a wallet:

rsp, err := cli.SuiXGetAllBalance(ctx, models.SuiXGetAllBalanceRequest{
 Owner: "0xb7f9...",
})

Retrieve Coin Metadata

Get details like symbol, decimals, and name:

rsp, err := cli.SuiXGetCoinMetadata(ctx, models.SuiXGetCoinMetadataRequest{
 CoinType: "0xf7a0...::busd::BUSD",
})

List Owned Objects

Query all objects (NFTs, tokens, etc.) under an address:

rsp, err := cli.SuiXGetOwnedObjects(ctx, models.SuiXGetOwnedObjectsRequest{
 Address: "0xb7f9...",
 Limit:   5,
})

Fetch Object or Transaction Details

Inspect individual objects or transaction blocks:

cli.SuiGetObject(ctx, models.SuiGetObjectRequest{
 ObjectId: "0xeeb9...",
})

cli.SuiGetTransactionBlock(ctx, models.SuiGetTransactionBlockRequest{
 Digest: "CeVpDXKKU3Gs89efej9pKiYYQyTzifE2BDxWwquUaUht",
})

Supports batch fetching with SuiMultiGetTransactionBlocks.

Query Checkpoints and Events

Monitor chain progress and filter events:

cli.SuiGetCheckpoints(ctx, models.SuiGetCheckpointsRequest{
 Limit:            10,
 DescendingOrder: true,
})

cli.SuiXQueryEvents(ctx, models.SuiXQueryEventsRequest{
 SuiEventFilter: models.EventFilterByMoveEventType{
  MoveEventType: "0x3::validator::StakingRequestEvent",
 },
})

Real-Time Subscriptions via WebSocket

Stay updated with live blockchain activity.

Subscribe to Events

Listen to all events or filter by type:

err := cli.SubscribeEvent(ctx, models.SuiXSubscribeEventsRequest{
 SuiEventFilter: map[string]interface{}{"All": []string{}},
}, receiveMsgCh)

Subscribe to Transactions

Track transactions from specific senders:

err := cli.SubscribeTransaction(ctx, models.SuiXSubscribeTransactionsRequest{
 TransactionFilter: models.TransactionFilterByFromAddress{
  FromAddress: "0x...",
 },
}, receiveMsgCh)

Ideal for fraud detection, wallet sync engines, and market-making bots.

👉 Supercharge your real-time blockchain applications with advanced tools.


Frequently Asked Questions (FAQ)

Q: Is the Sui Go SDK open source?
A: Yes. The SDK is fully open source under the Apache 2.0 license and hosted on GitHub for public contribution and review.

Q: Can I use this SDK in production environments?
A: Absolutely. The SDK supports MainNet endpoints and is suitable for production-grade applications requiring high reliability and performance.

Q: Does it support wallet integration?
A: Yes. You can import accounts via mnemonic phrases using the signer package and securely manage private keys in memory.

Q: How do I handle errors when calling RPC methods?
A: Always check the returned error value. The SDK follows Go idioms—non-nil error means failure. Use structured logging to capture response details.

Q: Where can I find full API documentation?
A: Comprehensive reference docs are available at pkg.go.dev.

Q: Are there example projects available?
A: Yes. Visit the SDK Examples repository for working code snippets covering common use cases.


Final Thoughts

The Sui Go SDK empowers Golang developers to build scalable, secure, and performant applications on one of the fastest-growing blockchains. With intuitive APIs, real-time capabilities, and strong community backing, it’s a critical tool for modern Web3 infrastructure.

Whether you’re building a node service, analytics dashboard, or DeFi backend, this SDK lowers the barrier to entry while maximizing control.

👉 Start building smarter blockchain solutions now—unlock the full potential of decentralized tech.

Keywords integrated naturally throughout content:
sui go sdk, golang blockchain development, sui blockchain, sui rpc client, web3 go library, move call sui, sui transaction, websocket subscription sui