Sui

Mysten / SUI

Mysten (Sui) can be accessed with the following coin types:

EnvironmentCoin TypeFaucet
Sui Productionsui
Sui Testnettsuihttps://docs.sui.io/guides/developer/getting-started/get-coins

Overview

Mysten is a protocol created by former Meta employees. The native currency of the Mysten protocol is Sui. It is an object based protocol, almost UTXO like. We support MPC transactions on SUI.

Explorer

https://suiexplorer.com/

Generating Wallets

To create an Sui wallet using BitGoJS:

1 2 3 4 5 6 7 8 9 10 11 12 13 bitgo .coin('tsui') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', multisigType: 'tss', enterprise: '234578765432' }) .then(function (wallet) { // print the new wallet console.dir(wallet); });

To create a Sui wallet using the platform API:

1 2 3 4 5 6 7 8 9 LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" MULTISIG="tss" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\", \"multisigType\": \"$MULTISIG\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/tsui/wallet/generate

Staking

For Mysten there is a minimum requirement to stake 1 SUI. After initiating the staking request, there's a warmup period of 1 epoch, and a cooldown period of 1 epoch when you decide to unstake. When deciding to unstake, you must unstake the entire SUI object.

Rewards are automatically compounded.

Receive addresses

SUI has no minimum balance for receive addresses.

In order to create a receive address:

1 2 3 4 5 6 7 8 9 10 11 bitgo .coin('tsui') .wallets() .getWallet({ id: '585c51a5df8380e0e3082e46' }) .then(function (wallet) { return wallet.createAddress(); }) .then(function (newAddress) { // print new address details console.dir(newAddress); });
1 2 3 4 5 WALLET=585c51a5df8380e0e3082e46 curl -X POST \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/tsui/wallet/$WALLET/address

Transactions

SUI uses overall object modeling, which is similar to the UTXO model. With SUI, storage is centered around objects. Transactions take objects as input and output new or mutated objects.

You can make use of sendMany() to send transactions. It's also important to note that while SUI does support batch transactions, these cannot be run sequentially. For the batch transactions, you'll need to wait for each to be confirmed on chain before submitting another. If you want to run a series of transactions, it's better to use sendMany.

When sending SUI, you'll need to account for the fact that the base unit of SUI has 9 decimal places (1 SUI = 1000000000 MYST).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 const recipients = [{ address: 'sui-address-1', amount: '10000000000', }, { address: 'sui-address-2', amount: '200000000000', }]; bitgo.authenticateWithAccessToken({ accessToken }); bitgo.unlock({otp: '000000'}) const wallet = await bitgo.coin(coin).wallets().getWallet({ id: walletId }); const response = await wallet.sendMany({ recipients, passphrase, type: 'transfer' });

Gas fees

A SUI transaction must pay a gas fee. SUI's Gas Pricing Mechanism ensures that any transaction pays fees according to both computational and storage costs.

A gas budget must be submitted with a SUI transaction. Gas budgets provide a limit to the amount of gas fees a user will pay. For more, see Gas in Sui.

Estimate Gas Fees in Sui

The gas fee is variable and differs from transaction to transaction. There's no way to get a precise fee estimate before a transaction. The fee estimate is composed of 3 components: computation cost, storage cost, and storage rebate. While the computation cost remains relatively constant, the storage cost and storage rebate can vary significantly.

Sui also has a concept of negative gas fees. If you overpay for a transaction, the excess gas fees are returned to you. This system promotes users to optimize storage usage on the blockchain, promoting cost efficiency and contributing to the efficient operation of the Sui network. However, this also makes predicting transaction fees more challenging.

Pre-build a transaction and generate an unsigned hex that you can use to obtain a fee estimate by running this script. This script, when run, will log a transaction hex. You can then pass this value to BitGo's API to receive a fee estimate.

Running the script

First, run yarn install from the root directory of the repository.

Then change into the examples/ts/sui directory and use npx ts-node to run it:

1 2 cd examples/ts/sui/ npx ts-node get-transaction-hex.ts

Note

  • Ensure your wallet ID and passphrase are correct.
  • Replace placeholder values with actual data from your BitGo account.

Expected Output

The output should be as follows:

1 2 Required tx param: AAACAAgQJwAAAAAAAAAgWi8a831WVBkJYTbreVK3NAIGZI%2BhQCuftQI4dx1DSicCAgABAQAAAQECAAABAQDojrUgsPIyDtSTV6rS54xejLr67f2B%2B%2F159oq6evGnEwHu2GGYi3WJarkc27zGeL7%2FDmtIWy6IKEI5Uy6sGolMV1LgwAAAAAAAII2Sh%2FcsCB2AGmMSpi%2Bu65igNCuTAeYQ1ionZjpcAkBv6I61ILDyMg7Uk1eq0ueMXoy6%2Bu39gfv9efaKunrxpxPoAwAAAAAAAKSIIQAAAAAAAA%3D%3D

Copy this value and use it as a parameter in this URL:

1 https://app.bitgo-test.com/api/v2/tsui/tx/fee?tx=<tx-value>

The fee estimate result should look like this:

1 2 3 4 5 6 { "feeEstimate": "3954120", "computationCost": "1000000", "storageCost": "1976000", "storageRebate": "978120" }