Liquid staking quickstart
Stake 1 SUI for vSUI, build the transaction and simulate it before anything is signed.
This script reads the current exchange rate, builds a transaction that stakes 1 SUI and simulates it against mainnet. It never signs, so you can run it with any address that holds at least 1 SUI.
Install the SDK
Install the Sui TypeScript SDK. The examples use ES modules and top-level await.
npm install @mysten/sui@2.39.1Set up the IDs and a client
packageId is the package Move calls go to; stakePool and metadata are the shared objects every stake and unstake call takes. See Token and objects for where each ID comes from.
The gRPC client is used for simulation. sender is the address that will own the SUI and sign later.
Estimate the output
The stats API returns the exchange rate in SUI per vSUI, so 1 SUI buys about 1 / exchangeRate vSUI before fees.
Amounts in transactions are base units: SUI has 9 decimals, so 1 SUI is 1_000_000_000 MIST. The minimum stake is 0.1 SUI.
Build the stake transaction
Split the amount from the gas coin, call stake_pool::stake and transfer the vSUI it returns. Because stake returns the coin to the PTB, you could pass it to another protocol here instead.
Pass the system state as tx.object('0x5'). With @mysten/sui’s gRPC transaction resolver, tx.object.system() can fail to build.
Simulate before signing
simulateTransaction runs the transaction against current chain state without submitting it. A failed simulation returns FailedTransaction with the Move abort in status.error.
Compare the simulated vSUI with the estimate. Then sign and execute the same tx with your wallet adapter or keypair.
import { SuiGrpcClient } from '@mysten/sui/grpc';
import { Transaction } from '@mysten/sui/transactions';
const VOLO = {
packageId: '0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20',
stakePool: '0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5',
metadata: '0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60',
vsuiType: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT',
};
const client = new SuiGrpcClient({
network: 'mainnet',
baseUrl: 'https://fullnode.mainnet.sui.io:443',
});
// The address that will sign. It must hold at least 1 SUI plus gas.
const sender = process.env.SUI_ADDRESS!;
// Read the current exchange rate to estimate the output
const stats = await fetch('https://open-api.naviprotocol.io/api/volo/stats');
const { data } = (await stats.json()) as { data: { exchangeRate: number } };
const amount = 1_000_000_000n; // 1 SUI in MIST
const tx = new Transaction();
tx.setSender(sender);
const [sui] = tx.splitCoins(tx.gas, [amount]);
const [vsui] = tx.moveCall({
target: `${VOLO.packageId}::stake_pool::stake`,
arguments: [tx.object(VOLO.stakePool), tx.object(VOLO.metadata), tx.object('0x5'), sui],
});
tx.transferObjects([vsui], sender);
const result = await client.core.simulateTransaction({
transaction: tx,
include: { balanceChanges: true },
});
if (result.$kind === 'FailedTransaction') {
throw new Error(`Simulation failed: ${result.FailedTransaction.status.error?.message}`);
}
const received = result.Transaction.balanceChanges.find(
(change) => change.address === sender && change.coinType === VOLO.vsuiType,
);
console.log('Estimated vSUI:', Number(amount) / 1e9 / data.exchangeRate);
console.log('Simulated vSUI:', Number(received?.amount ?? 0) / 1e9);Run it
SUI_ADDRESS=0xYOUR_ADDRESS npx tsx stake.tsSample output, verified on December 1, 2026. The estimate uses the API rate and the simulation applies any stake fee:
Estimated vSUI: 0.9342138639054488
Simulated vSUI: 0.934213863The amount is below the 0.1 SUI minimum. Stake at least 100_000_000 MIST.
50001 (EIncompatibleVersion) means the call went to an outdated package; use the latest package from the deployment table. 50002 (EIncompatiblePaused) means the pool is paused; try again later.
The transaction used tx.object.system(). Pass tx.object('0x5') instead.