Sui (SUI)

Validators

NameAddress

Kiln

Staking mechanics

ParameterValue

Stake activation time

1 epoch (1 day)

Stake lock-up time

1 epoch (1 day)

Re-delegating activation time

1 epoch (1 day)

Rewards frequency

First rewards: 1 epoch after stake is active (1 day) Rewards frequency: beginning of every epoch (1 day). Last rewards: last rewards earned before unstaking.

Auto-compounding

Yes

Self-bond

None

Active set

Slashing

No automated slashing currently implemented in the protocol.

Relationship between validator stake balance and rewards

Linear. The more stake balance there is on the validator, the more rewards it will earn.

How to Stake SUI Using the Mysten Labs SDK

Prerequisites

  • Node.js and npm installed.

  • SUI wallet with SUI tokens (testnet/mainnet).

  • Basic knowledge of TypeScript and web3.

The Sui blockchain has built-in functions for staking and unstaking in its Move modules. These functions can be directly called through the Mysten SDK's moveCall method. Below is an example of how to stake SUI to a validator using the Move function request_add_stake

Step 1: Staking SUI

To stake SUI to a validator:

import { SuiClient, TransactionBlock } from '@mysten/sui';

const stakeSui = async (validatorAddress: string, amount: number) => {
  const client = new SuiClient({ network: 'testnet' });

  const tx = new TransactionBlock();
  tx.moveCall({
    target: '0x2::sui_system::request_add_stake',
    arguments: [validatorAddress, amount.toString()],
  });

  const response = await client.signAndExecuteTransaction(tx);
  console.log('Stake Transaction Response:', response);
};
  • Reference: The staking logic is defined in Sui's Move smart contract, which can be found here.

  • You can also refer to the Sui wallet app for an example of how it calls these functions in its code.

Step 2: Unstake SUI

const unstakeSui = async (stakeId: string) => {
  const tx = new TransactionBlock();
  tx.moveCall({
    target: '0x2::sui_system::request_remove_stake',
    arguments: [stakeId],
  });

  const response = await client.signAndExecuteTransaction(tx);
  console.log('Unstake Transaction Response:', response);
};

Step 3: Testing

  • Run your dApp and ensure you have enough SUI for staking and gas fees.

  • Monitor the transaction on Sui Explorer for confirmation.

Last updated