# Sui (SUI)

## Validators

{% tabs %}
{% tab title="Mainnet" %}

<table><thead><tr><th width="93" align="center">Name</th><th align="center">Address</th></tr></thead><tbody><tr><td align="center">Kiln</td><td align="center"><a href="https://suiscan.xyz/mainnet/validator/0x92c7bf9914897e8878e559c19a6cffd22e6a569a6dd4d26f8e82e0f2ad1873d6/info">Kiln Sui Validator</a></td></tr></tbody></table>
{% endtab %}

{% tab title="Testnet" %}

<table><thead><tr><th width="146" align="center">Name</th><th align="center">Address</th></tr></thead><tbody><tr><td align="center">Kiln</td><td align="center"><a href="https://suiscan.xyz/testnet/validator/0x2079cb58f32c868deb0f4f20f509b7f034c7bea84c964cb1316f77fc987445b8/info">Kiln Testnet Validator</a></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Staking mechanics

<table><thead><tr><th width="351">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Stake activation time</strong></td><td>1 epoch (1 day)</td></tr><tr><td><strong>Stake lock-up time</strong> </td><td>1 epoch (1 day)</td></tr><tr><td><strong>Re-delegating activation time</strong></td><td>1 epoch (1 day)</td></tr><tr><td><strong>Rewards frequency</strong></td><td>First rewards: 1 epoch after stake is active (1 day)<br><br>Rewards frequency: beginning of every epoch (1 day).<br><br>Last rewards: last rewards earned before unstaking.</td></tr><tr><td><strong>Auto-compounding</strong></td><td>Yes</td></tr><tr><td><strong>Self-bond</strong></td><td>None</td></tr><tr><td><strong>Active set</strong></td><td><a href="https://docs.sui.io/guides/operator/validator-config">30M</a></td></tr><tr><td><strong>Slashing</strong></td><td>No automated slashing currently implemented in the protocol. Rewards (not stake) can be slashed via validator vote</td></tr><tr><td><strong>Relationship between validator stake balance and rewards</strong></td><td>Linear. The more stake balance there is on the validator, the more rewards it will earn.</td></tr></tbody></table>

## **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:

```ts
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](https://github.com/MystenLabs/sui/blob/3457cd316ba7d4b83a1a4dbcceba393ab4792cb0/crates/sui-framework/packages/sui-system/sources/sui_system.move#L224).
* You can also refer to the [Sui wallet app](https://github.com/MystenLabs/sui/blob/3457cd316ba7d4b83a1a4dbcceba393ab4792cb0/apps/wallet/src/ui/app/staking/stake/utils/transaction.ts#L11) for an example of how it calls these functions in its code.

### **Step 2: Unstake SUI**

```ts
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.
