Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions zq2/docs/staking/delegatedstaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
id: staking/delegatedstaking
title: Overview
---

<!-- markdownlint-disable MD013 MD051 -->

# Delegated Staking

This documentation provides the contracts and scripts required to create a staking pool where users can delegate their ZILs. The staking mechanism supports two variants:

---

## Staking Variants

### 1. **Liquid Variant**

- Users receive a **non-rebasing Liquid Staking Token (LST)** upon delegation.
- The LST can be sent to the validator's contract to withdraw the staked amount plus the corresponding share of validator rewards.

### 2. **Non-Liquid Variant**

- Users can withdraw their share of the rewards regularly without withdrawing the staked amount.

---

## Steps for Delegated Staking

### 1. **Install an RPC Node**

Set up and configure a compatible RPC node to interact with the blockchain.
Refer to the [Node Installation Guide](../nodes/node.md) for details.

---

### 2. **Deploy the Staking Contract**

Choose a staking variant (Liquid or Non-Liquid) and deploy the appropriate contract.
Refer to the [Contract Deployment Guide](https://github.com/Zilliqa/delegated_staking#contract-deployment).

---

### 3. **Manage Commission**

Set and adjust the commission rates for the staking pool as needed.
Detailed instructions are available in the [Manage Commission Guide](https://github.com/Zilliqa/delegated_staking#contract-configuration).

---

### 4. **Validator Activation or Migration**

- **Activation**: Deposit **10M ZIL tokens** to activate the staking node as a validator.
- **Migration**: If the node is already a PoS node, activate it to participate in the staking pool.
Refer to the [Validator Activation or Migration Guide](https://github.com/Zilliqa/delegated_staking#validator-activation-or-migration) for more details.

---

### 5. **Stake and Unstake**

Enable users to:

- Delegate (stake) ZILs to your validator.
- Withdraw (unstake) their ZILs as needed, based on the selected staking variant.
Refer to [staking-unstaking](https://github.com/Zilliqa/delegated_staking?tab=readme-ov-file#staking-and-unstaking) section

---

### 6. **Withdrawing or Staking Rewards**

- Allow users to withdraw their rewards.
- Alternatively, let them reinvest the rewards back into the staking pool.
Refer to the [Rewards Withdrawal Guide](https://github.com/Zilliqa/delegated_staking?tab=readme-ov-file#withdrawing-or-staking-rewards) section.

---
35 changes: 35 additions & 0 deletions zq2/docs/staking/delegators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: staking/delegators
title: Delegators
---

<!-- markdownlint-disable -->

## Migrating Stake from ZQ1 SSN List Contract to ZQ2 Staking

Follow the steps below to migrate your stake from the ZQ1 SSN List contract to the new ZQ2 staking mechanism.

---

### 1. Withdrawing Stake from ZQ1

- Log in to the [Old Zillion](#link-here) portal.
- Claim all rewards and withdraw the complete staked amount.
- The withdrawn amount will be instantly unstaked and credited to your wallet.

---

### 2. Transferring ZILs to an EVM-Compatible Address

- To restake your ZILs, transfer them to an EVM-compatible wallet such as MetaMask, Coinbase, or other supported wallets.

---

### 3. Moving Stake to ZQ2 Staking

- Use the [New Zillion](#link-here) portal to delegate your stake.
- Select one of the PoS nodes to participate in the staking pool.

---

By following these steps, users can seamlessly transition their stake to the new Zilliqa 2.0 staking system.
50 changes: 50 additions & 0 deletions zq2/docs/staking/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
id: staking/functions
title: Staking Functions
---

# Essential Functions for Node Operators

This section outlines the core functions that node operators need to manage staking, delegation, and rewards.

---

## **1. Staking & Unstaking**

| **Function** | **Contract** | **Description** |
| ------------------------- | ---------------------------- | ------------------------- |
| `stake()` | Liquid/Non-Liquid Delegation | Delegate ZILs for staking |
| `unstake(uint256 shares)` | Liquid/Non-Liquid Delegation | Unstake ZILs |
| `claim()` | Liquid/Non-Liquid Delegation | Withdraw unstaked ZILs |

---

## **2. Validator Deposit & Migration**

| **Function** | **Contract** | **Description** |
| ----------------------------------- | -------------- | ------------------------------------------ |
| `depositFirst(bytes, bytes, bytes)` | BaseDelegation | First-time node deposit |
| `depositLater(bytes, bytes, bytes)` | BaseDelegation | Top-up stake for validator |
| `migrate(bytes)` | BaseDelegation | Migrate existing validator to staking pool |

---

## **3. Commission Management**

| **Function** | **Contract** | **Description** |
| --------------------------------- | -------------- | ---------------------------- |
| `setCommissionNumerator(uint256)` | BaseDelegation | Set commission percentage |
| `collectCommission()` | BaseDelegation | Withdraw commission earnings |

---

## **4. Querying Staking Information**

| **Function** | **Contract** | **Description** |
| --------------------- | --------------------- | ---------------------------------------- |
| `getStake()` | BaseDelegation | Returns total stake in the contract |
| `getRewards()` | BaseDelegation | Returns claimable rewards |
| `getDelegatedStake()` | Non-Liquid Delegation | Returns the user's current staked amount |
| `getPrice()` | Liquid Delegation | Returns ZIL equivalent for 1 LST token |

---
38 changes: 38 additions & 0 deletions zq2/docs/staking/nodeoperators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: staking/nodeoperators
title: Staking node operators
---

<!-- markdownlint-disable -->

## Transitioning to Zilliqa 2.0 Staking for Exchanges

Currently, exchanges have integrated Zilliqa 1.0 staking on their platforms. With the launch of Zilliqa 2.0, the Zilliqa 1.0 staking protocol will become inoperational. Exchanges will need to transition to the new EVM-based staking mechanism to ensure seamless staking functionality.

Below are the steps exchanges must follow to adopt the new Zilliqa 2.0 delegated staking mechanism.

---

## Overview of Zilliqa 2.0 Staking

Exchanges or wallets running validator nodes will validate transactions and earn both block rewards and staking commissions. Users delegating ZILs to these validator nodes will earn staking rewards. Depending on the staking variant supported by the validator, users can either:

- Claim their rewards at any time.
- Receive rewards when they unstake their liquid staking tokens.

For technical implementation details, refer to the [Zilliqa 2.0 Whitepaper](#whitepaper-link) and [Node Documentation](#node-docs-link).

---

## Steps to Transition

### 1. Withdrawing Stake from Zilliqa 1.0

- Claim all rewards and withdraw the staked amount delegated to your SSN.
- This can be done via [Old Zillion](https://stake.zilliqa.com) or your in-house implementation mechanism.

### 2. Implementing the New EVM-Based Delegated Staking

- Integrate the new EVM-based delegated staking mechanism as outlined in the [Delegated Staking Documentation](../staking/delegatedstaking.md).

---
48 changes: 48 additions & 0 deletions zq2/docs/staking/staking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
id: staking
title: Staking Migration Guide
---

<!-- markdownlint-disable -->

## Staking Migration Guide

Zilliqa 1.0 (ZQ1) is transitioning to the new Zilliqa 2.0 (ZQ2) platform, introducing significant changes to the staking process. Delegators and operators must adapt their systems to support the updated delegated staking mechanism on the new blockchain network. This document outlines the steps exchanges and users need to follow to ensure a smooth transition.

---

## Affected Parties

1. **External Staked Users**
Users who are currently staking in Zilliqa through one of the SSN nodes.

2. **Exchanges and Wallet Providers**
Platforms offering staking services for the Zilliqa blockchain.

---

## Key Changes

### 1. ZQ1 Staking Termination

- The ZQ1 staking mechanism (SSN List contract) will no longer earn rewards after the transition to ZQ2.

### 2. Stake Withdrawal

- Users and exchanges/wallet providers must withdraw their stake from the SSN List contract using [Old Zillion](https://stake.zilliqa.com).
- They must move their stake to the new EVM-based delegated staking mechanism.

### 3. New Delegated Staking Implementation

- Exchanges and wallet providers must implement the new delegated staking model.
- Users can stake using the [New Zillion](#link-goes-here) portal, selecting one of the staking nodes to transfer their stake.

### 4. Technical Reference

- The new staking model is detailed in the GitHub repository:
[Delegated Staking Repository](https://github.com/Zilliqa/delegated_staking).

### 5. Additional Resources

- **For External Users**: Refer to the [User Guide](../staking/users.md).
- **For Exchanges/Wallet Providers**: Refer to the [Exchanges Guide](../staking/exchange.md).
7 changes: 7 additions & 0 deletions zq2/mkdocs.in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ nav:
- Nodes: nodes/node.md
- Checkpoints: nodes/checkpoint.md
- Node FAQ: nodes/nodefaq.md
- Staking Migration:
- staking/staking.md
- Delegators: staking/delegators.md
- Node operators: staking/nodeoperators.md
- Delegated Staking:
- staking/delegatedstaking.md
- Essential Functions: staking/functions.md
- Tools and SDKs: sdk.md
- $use_zq2_from
- $APIs
Expand Down
Loading