> For the complete documentation index, see [llms.txt](https://docs.xspaceprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xspaceprotocol.io/getting-started/developer-docs/validator-setup.md).

# Validator Setup

#### **Staking and Validator Setup**

The XSPACE Protocol uses **Delegated Proof-of-Stake 2.0 (DPoS 2.0)** to secure the network and achieve high scalability. Validators play a crucial role in maintaining the blockchain, while delegators contribute to network security by staking **GLXYC tokens**. This guide explains how to set up a validator node and delegate GLXYC tokens.

***

### **Setting Up a Validator Node**

#### **Requirements**

To become a validator, ensure your system meets the following requirements:

**Hardware Requirements**

* **Processor:** Quad-Core 2.0 GHz or higher.
* **Memory:** 16 GB RAM or more.
* **Storage:** SSD with at least 500 GB of free space.
* **Network:** Reliable internet connection with a minimum upload/download speed of 100 Mbps.

**Software Requirements**

* **Operating System:** Linux (Ubuntu 20.04 recommended), macOS, or Windows.
* **Docker:** Required for running the validator node in a containerized environment.
* **XSPACE Validator Software:** Available for download from the XSPACE repository.

***

#### **Step 1: Install Docker**

Install Docker to run the validator node in a containerized setup.

1. **Install Docker on Linux (Ubuntu):**

   ```bash
   sudo apt update
   sudo apt install -y docker.io
   sudo systemctl start docker
   sudo systemctl enable docker
   ```
2. **Verify Docker Installation:**

   ```bash
   docker --version
   ```

***

#### **Step 2: Download the Validator Node Software**

Download the XSPACE Validator software from the official repository:

* Repository: <https://xspaceprotocol.io/validator>

**Clone the Validator Node Repository:**

```bash
git clone https://github.com/xspaceprotocol/validator-node.git
cd validator-node
```

***

#### **Step 3: Configure the Node**

1. **Generate a Validator Key Pair:**\
   Use the provided key generator script to create your validator keys.

   ```bash
   ./generate-keys.sh
   ```

   * Save the output **private key** and **public key** securely.
2. **Update the Configuration File:**\
   Edit the `config.yaml` file to include your validator details:

   ```yaml
   validator:
       public_key: "YOUR_PUBLIC_KEY"
       staking_address: "YOUR_WALLET_ADDRESS"
       network: "testnet" # Use "mainnet" for production
   ```

***

#### **Step 4: Start the Validator Node**

1. **Build the Docker Image:**

   ```bash
   docker build -t xspace-validator .
   ```
2. **Run the Validator Node:**

   ```bash
   docker run -d --name xspace-validator -p 30303:30303 -p 8545:8545 xspace-validator
   ```
3. **Monitor Logs:**\
   Verify that the node is running correctly:

   ```bash
   docker logs xspace-validator -f
   ```

***

#### **Step 5: Stake GLXYC to Activate Validator**

Validators must stake a minimum of **10,000 GLXYC** to participate in block production.

1. **Stake Tokens:**\
   Use the XSPACE CLI or wallet to stake GLXYC tokens:

   ```bash
   xspace-cli stake --amount 10000 --from "YOUR_WALLET_ADDRESS"
   ```
2. **Confirm Validator Status:**\
   Verify that your validator is active:

   ```bash
   xspace-cli validator status --address "YOUR_WALLET_ADDRESS"
   ```

***

### **Delegating GLXYC Tokens**

Delegators participate in network security by delegating their GLXYC tokens to validators. In return, they earn a share of the staking rewards.

***

#### **Step 1: Choose a Validator**

Delegators must choose a validator to delegate their tokens. Use the **XSPACE Explorer** to find a list of active validators:\
[https://explorer.xspaceprotocol.io](https://explorer.xspaceprotocol.io/)

Key metrics to consider:

* **Uptime:** Percentage of time the validator has been active.
* **Commission Rate:** Fee charged by the validator on staking rewards.
* **Staked Amount:** Total GLXYC staked with the validator.

***

#### **Step 2: Delegate Tokens**

Use the XSPACE CLI or wallet to delegate tokens to a chosen validator.

**Delegation via CLI:**

1. Delegate tokens:

   ```bash
   xspace-cli delegate --validator "VALIDATOR_ADDRESS" --amount 500 --from "YOUR_WALLET_ADDRESS"
   ```
2. Confirm delegation:

   ```bash
   xspace-cli delegation status --address "YOUR_WALLET_ADDRESS"
   ```

**Delegation via Wallet:**

1. Open your wallet (e.g., Metamask) and connect to the XSPACE network.
2. Navigate to the **Staking Dashboard**:\
   [https://staking.xspaceprotocol.io](https://staking.xspaceprotocol.io/)
3. Select a validator and specify the amount of GLXYC to delegate.
4. Confirm the transaction and monitor your rewards.

***

### **Earning Staking Rewards**

#### **Reward Distribution**

* **Validators:** Earn rewards based on the total GLXYC they have staked and their uptime.
* **Delegators:** Receive rewards proportional to their staked amount after the validator’s commission fee is deducted.

#### **Claiming Rewards**

Staking rewards can be claimed periodically using the XSPACE CLI or wallet.

**Claim Rewards via CLI:**

```bash
xspace-cli rewards claim --from "YOUR_WALLET_ADDRESS"
```

**Claim Rewards via Wallet:**

1. Log in to your wallet.
2. Go to the **Staking Dashboard** and click **Claim Rewards**.

***

### **Monitoring and Managing Stakes**

#### **Monitoring Validator Performance**

Validators and delegators can monitor performance metrics using the XSPACE Explorer:

* Uptime
* Commission rate
* Total staked amount

#### **Unstaking Tokens**

To withdraw staked tokens, an **unstaking period** of 7 days applies.

**Unstake via CLI:**

```bash
xspace-cli unstake --amount 500 --from "YOUR_WALLET_ADDRESS"
```

**Unstake via Wallet:**

1. Go to the **Staking Dashboard**.
2. Select **Unstake** and specify the amount.

***

#### **Validator Responsibilities**

Validators must maintain high uptime and performance to avoid slashing penalties:

* **Uptime Requirement:** Maintain uptime above 95%.
* **Penalties:** Downtime or malicious behavior may result in slashing of staked GLXYC.

***

This comprehensive guide ensures you can confidently set up and manage validator nodes or delegate tokens within the XSPACE ecosystem, contributing to network security and earning rewards.
