# Installation Instructions for Windows

### Recommended Method: Using WSL 2

Why WSL 2?

* Compatibility: Avoids Windows-specific issues with Node.js and networking.
* Efficiency: Leverages Linux’s lightweight environment for optimal performance.

Setting Up WSL 2

1. Enable WSL:
   * Open PowerShell as Administrator and run:

     ```powershell
     wsl --install
     ```
   * Restart your system if prompted.
2. Install a Linux Distribution:
   * Download Ubuntu from the Microsoft Store and follow the setup prompts.
3. Set WSL 2 as Default:
   * In PowerShell, run:

     ```powershell
     wsl --set-default-version 2
     ```

Installing Node.js 23+ in WSL 2

1. Install Node.js 23+:
   * Launch the WSL 2 terminal (e.g., Ubuntu) and install Node.js:

     ```bash
     curl -fsSL https://deb.nodesource.com/setup_23.x | sudo -E bash -
     sudo apt-get install -y nodejs
     ```
   * Verify the installation:

     ```bash
     node -v
     ```

     Expected output should be v23.x.x or higher. If issues occur, update the package list:

     ```bash
     sudo apt-get update
     ```
2. Download or Clone the Project:
   * Option 1: Download as ZIP:
     * Open your web browser and download the project from: <https://github.com/ShadowNetworkXYZ/validator/releases/tag/v1.0.1>
     * Extract the .zip file. Inside, you’ll find a validator folder containing validator.js, package.json, and .env.
     * Move the validator folder to your desired location (e.g., C:\Users\YourName\Projects).
     * Open the WSL 2 terminal and navigate to the folder:

       ```bash
       cd /mnt/c/Users/YourName/Projects/validator
       ```
   * Option 2: Clone with Git:
     * In the WSL 2 terminal, clone the repository:bash

       ```bash
       git clone https://github.com/ShadowNetworkXYZ/validator.git
       ```
     * Navigate to the cloned directory:

       ```bash
       cd validator
       ```
3. Configure Environment Variables:
   * Copy the example environment file to create a custom configuration:

     ```bash
     cp .env.example .env
     ```
   * Edit .env with a text editor to set required variables. Since you’re using WSL 2, we recommend nano, a user-friendly terminal editor. Follow these steps to edit the file:
     * Install nano (if not already installed):
       * In the WSL 2 terminal (e.g., Ubuntu), run:

         ```bash
         sudo apt-get update
         sudo apt-get install nano
         ```
       * This updates the package list and installs nano. You may be prompted to enter your password.
     * Open the .env file in nano:
       * Navigate to the validator folder if not already there:

         ```bash
         cd /mnt/c/Users/YourName/Projects/validator
         ```
       * Open the file with:

         ```bash
         nano .env
         ```
       * The file will open in the terminal, displaying its contents. The base file looks like this:

         ```
         PRIVATE_KEY=
         LOG_FILE=shadow-validator.log
         RPC=https://rpc.shadow-network.xyz
         ```
     * Edit the PRIVATE\_KEY:
       * Use the arrow keys to move the cursor to the line PRIVATE\_KEY=.
       * To paste a PRIVATE\_KEY value from your clipboard (e.g., copied from your EVM wallet):
         * Ensure the value is copied to your Windows clipboard (e.g., from MetaMask or a text file).
         * In the WSL 2 terminal, press Ctrl + Shift + V or right-click to paste the text into nano. This transfers the clipboard content from Windows to the WSL environment.
         * Adjust the cursor if needed to place the value after PRIVATE\_KEY= (e.g., PRIVATE\_KEY=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef), ensuring no extra spaces.
       * Alternatively, you can type the value manually if preferred.
       * Leave LOG\_FILE=shadow-validator.log and RPC=<https://rpc.shadow-network.xyz> unchanged, as they are preconfigured.
   * Security Note: Keep your PRIVATE\_KEY confidential and never share it. Ensure your .env file is not uploaded to public repositories.
   * Verification: You can reopen the file to check:

     ```bash
     nano .env
     ```

     Confirm the PRIVATE\_KEY is correctly set before proceeding.
4. Install Dependencies:
   * Run the following command to install all necessary Node.js packages:

     ```bash
     npm install
     ```
5. Launch the Node:
   * Start the validator script with:

     ```bash
     node validator
     ```
6. Verify Operation:
   * Check the terminal output for synchronization status, errors, or logs to ensure the node is running correctly.

### Alternative Method: Direct Windows Installation

Installing Node.js 23+ on Windows

1. Install Node.js 23+:
   * Download the Node.js 23.x installer from [nodejs.org](https://nodejs.org/dist/v23.x.x/node-v23.x.x-x64.msi).
   * Run the installer, ensuring the option to install npm is selected.
   * Verify the installation:
     * Open Command Prompt and run:cmd

       ```
       node -v
       ```
     * Expected output should be v23.x.x or higher. If not, reinstall or use nvm-windows:
       * Download nvm-setup.zip from [github.com/coreybutler/nvm-windows](https://github.com/coreybutler/nvm-windows/releases).
       * Extract and run the setup, then install Node.js 23:

         ```
         nvm install 23
         nvm use 23
         ```
2. Download or Clone the Project:
   * Option 1: Download as ZIP:
     * Open your web browser and download the project from: <https://github.com/ShadowNetworkXYZ/validator/releases/tag/v1.0.1>
     * Extract the .zip file. Inside, you’ll find files validator.js, package.json, and .env.example.
     * Move the validator folder to your desired location (e.g., C:\Users\YourName\Projects).
     * Open Command Prompt and navigate to the folder:

       ```
       cd C:\Users\YourName\Projects\validator
       ```
   * Option 2: Clone with Git:
     * Open Command Prompt and clone the repository:

       ```
       git clone git@github.com:ShadowNetworkXYZ/validator.git
       ```
     * Navigate to the cloned directory:

       ```
       cd validator
       ```
3. Configure Environment Variables:
   * Copy the example environment file to create a custom configuration:

     ```
     copy .env.example .env
     ```
   * Edit .env with a text editor (e.g., Notepad or VS Code) to set required variables, such as PRIVATE\_KEY, as per the project documentation.
4. Install Dependencies:
   * Run the following command to install all necessary Node.js packages:

     ```
     npm install
     ```
5. Launch the Node:
   * Start the validator script with:

     ```
     node validator
     ```
6. Verify Operation:
   * Check the Command Prompt output for synchronization status, errors, or logs to ensure the node is running correctly.

### Troubleshooting

* Node.js Version: Verify with node -v. If below 23, reinstall using the steps above or switch to nvm-windows.
* Permissions: If the script fails, run Command Prompt as Administrator or adjust permissions with PowerShell

  ```powershell
  icacls validator /grant Users:F
  ```
* Environment Variables: If the node fails to start, ensure .env contains all required fields.
* WSL 2 Issues: If WSL setup fails, ensure virtualization is enabled in your BIOS and Windows Features.
* ZIP Extraction: If the .zip file doesn’t extract properly, use a tool like 7-Zip or WinRAR.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shadow-network.xyz/installation-instructions-for-windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
