I want to implement Gasless Stablecoin Transfers functionality using golang. Are there any relevant examples?
Hey @aoliao_40259,
The protocol-native “Gasless Stablecoin Transfers” feature is not supported yet from Golang.
If you want to understand this better and contribute to a Go-sdk repo this TL:DR on the implementation may help you.
This new protocol-level feature is built on Address Balances. A P2P transfer of an allowlisted stablecoin executes with no SUI gas at all. Under the hood the PTB calls 0x2::balance::send_funds<T> (with siblings withdrawal_split / redeem_funds), sets gasPrice = 0 and gasBudget = 0 with an empty gasPayment, writes no objects, and the coin type has to be on the allowlist governed by get_gasless_allowed_token_types (currently USDC, USDSUI, SUI_USDE, USDY, FDUSD, AUSD, USDB; min transfer 0.01). The catch for you: the eligibility auto-detection and the tx.balance({ type, balance }) input live in the @mysten/sui TypeScript SDK, which sets the gas fields for you over the gRPC/GraphQL transports. You can check the sui docs for more info.
The thing to know first: this is not a Coin transfer. send_funds<T>(balance: Balance<T>, recipient) consumes a Balance<T> withdrawn from your address balance, supplied through a new PTB input kind, FundsWithdrawal in sui-types (it’s what tx.balance() produces in TS). That input type is the new part, and the Go SDKs only encode the old Pure / Object inputs, so they can’t build the call:
- block-vision/sui-go-sdk has no
FundsWithdrawal/ address-balance input variant and nosend_fundshelper (itsCallArgenum is only Pure/Object/UnresolvedPure/UnresolvedObject), and the normalExecutepath requires a non-emptygasPayment(GasData.IsAllSet()), so you can’t submit the empty-payment shape cleanly either.
Alternative while Go SDK support catches up
Sponsored transactions (the route that works from Go)
If your real goal is “the user pays no gas on a stablecoin transfer,” sponsored transactions are the mature, fully-supported path and they work cleanly from Go. It’s a dual-signed tx where GasData.owner (your backend sponsor) differs from the sender: the sponsor sets the gas owner, supplies the gas payment, and signs; both signatures get submitted. Works for any tx, including a plain Coin<USDC> transfer.
- block-vision/sui-go-sdk has first-class sponsorship and a runnable example: build the PTB (
SplitCoins/TransferObjectsof the USDC coin), thenSetSponsoredSigner(backend),SetGasOwner(sponsor),SetGasPayment(sponsor’s SUI coin), andExecute()submits both signatures. Seeexamples/ptb/main.go, funcsponsoredTransaction. The only repo here with a ready-to-run sponsored example.
If you want to go deeper, the sponsored example to start from is examples/ptb/main.go in block-vision/sui-go-sdk. You can find this link in awesome-sui github repo
Yes, you can implement gasless stablecoin transfers using the Go SDK. The core requirement is using verified functions; essentially, only transactions composed of these specific functions qualify as gasless (e.g., 0x2::balance::send_funds<T> or balance::redeem_funds)…etc. You can find the full list of verified functions here.
You can find detailed implementation guidelines in the Sui Documentation. For your golang usage, I recommend using the BlockVision Sui Go SDK.
One important thing to keep in mind is your gas configuration. When interacting with gRPC, you primarily handle the transaction and the SDK/RPC handles the rest. However, with JSON-RPC, you may need to manually set the gas price to