# LayerEdge - Light Node Setup Guide

By [specweb3](https://paragraph.com/@specweb3) · 2025-03-20

---

Below is the step-by-step installation of the node with comments in English:

* * *

### **Step 1: Clone the Light Node Repository**

    git clone https://github.com/Layer-Edge/light-node.git
    cd light-node
    

> **Comment**: First, clone the repository containing the node's source code. Then navigate to the `light-node` directory to proceed with the setup.

* * *

### **Step 2: Install Required Dependencies**

Ensure the following dependencies are installed:

1.  **Go**: Version 1.18 or higher
    
    > **Comment**: Go is used to build and run the node. Check the version using the command `go version`.
    
2.  **Rust**: Version 1.81.0 or higher
    
    > **Comment**: Rust is required for working with the Risc0 Toolchain. Check the version using the command `rustc --version`.
    
3.  **Risc0 Toolchain**: If not installed, run:
    
        curl -L https://risczero.com/install | bash && rzup install
        
    
    > **Comment**: This utility is used for working with Zero-Knowledge Proofs (ZK Proofs).
    
4.  **LayerEdge gRPC Endpoint**: Ensure you have access to a LayerEdge node for communication via gRPC.
    

* * *

### **Step 3: Configure Environment Variables**

Create a `.env` file in the root directory of the project and add the following variables:

    GRPC_URL=34.31.74.109:9090
    CONTRACT_ADDR=cosmos1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqt56709
    ZK_PROVER_URL=http://127.0.0.1:3001
    # Alternatively:
    ZK_PROVER_URL=https://layeredge.mintair.xyz/
    API_REQUEST_TIMEOUT=100
    POINTS_API=https://light-node.layeredge.io
    PRIVATE_KEY='cli-node-private-key'
    

> **Comment**:
> 
> *   `GRPC_URL`: The address of the LayerEdge gRPC server.
>     
> *   `CONTRACT_ADDR`: The smart contract address in the Cosmos network.
>     
> *   `ZK_PROVER_URL`: The URL of the service for generating ZK proofs.
>     
> *   `API_REQUEST_TIMEOUT`: API request timeout.
>     
> *   `POINTS_API`: URL for retrieving points data.
>     
> *   `PRIVATE_KEY`: Your CLI node's private key.
>     

> **Important**: Ensure that `ZK_PROVER_URL` matches the address where the Merkle service is running.

* * *

### **Step 4: Start the Merkle Service**

Before running the Light Node, start the Merkle service:

    cd risc0-merkle-service
    cargo build && cargo run
    

> **Comment**: This service handles Merkle trees. Wait for the service to fully initialize before proceeding to the next step.

* * *

### **Step 5: Build and Run the LayerEdge Light Node**

In a new terminal, navigate to the root directory of the project and execute:

    go build
    ./light-node
    

> **Comment**:
> 
> *   The `go build` command compiles the node executable.
>     
> *   `./light-node` starts the node. Ensure it is successfully connected to the Merkle service.
>     

* * *

### **Connecting CLI Node to LayerEdge Dashboard**

#### 1\. Fetch Points via CLI

Use the following URL to fetch points:

    https://light-node.layeredge.io/api/cli-node/points/{walletAddress}
    

> **Comment**: Replace `{walletAddress}` with your CLI wallet address.

#### 2\. Connect to the Dashboard

1.  Navigate to [dashboard.layeredge.io](https://dashboard.layeredge.io).
    
2.  Connect your wallet.
    
3.  Link your CLI node's public key to the wallet.
    

> **Important**:
> 
> *   One CLI wallet can only be linked to one dashboard wallet.
>     
> *   Linking is mandatory, even if the CLI and dashboard wallets are identical.
>     

* * *

### **Dashboard Monitoring Features**

The dashboard provides the following features:

*   Node status (Active/Inactive).
    
*   Points tracking and detailed analytics.
    
*   Logs and performance monitoring.
    

* * *

### **Logging and Monitoring**

The node provides logs for:

*   Merkle tree discovery.
    
*   ZK proof generation and verification.
    
*   Data submission status.
    
*   Performance optimizations (e.g., tree sleep state).
    

> **Comment**: Use the logs to diagnose issues.

* * *

### **Security Best Practices**

1.  Store keys, mnemonics, and AUTHKEY offline.
    
2.  Configure a firewall and secure SSH connections.
    
3.  Regularly update the node from official LayerEdge sources.
    

* * *

### **Troubleshooting Common Issues**

1.  **Issue**: gRPC connection is inactive.**Solution**: Verify gRPC settings (`GRPC_URL`).
    
2.  **Issue**: Risc0 Prover service is not running.**Solution**: Restart the service and check the logs.
    
3.  **Issue**: Incorrect wallet or signature configurations.**Solution**: Double-check the wallet address and environment variables.
    

> **Comment**: For more precise diagnostics, use the node logs.

* * *

PS. HELP

Yes, you need to specify the **Cosmos wallet address** and **private key** for the Light Node to function correctly. Let's break this down in detail:

* * *

### 1\. **Cosmos Wallet Address**

*   **Why is it needed?**
    
    *   The wallet address is used for:
        
        *   Identifying your node in the network.
            
        *   Linking your CLI node to the Dashboard for status and points tracking.
            
        *   Receiving rewards (if provided by the project).
            
*   **Where to get the wallet address?**
    
    *   If you already have a Cosmos wallet (e.g., created via `keplr`, `cosmos-sdk`, or another tool), use its address.
        
    *   If you don’t have a wallet, you can create one using the following command:
        
            echo "your_mnemonic_phrase" | cosmos-cashd keys add <wallet_name> --recover
            
        
        > **Comment**: Replace `your_mnemonic_phrase` with your mnemonic phrase if you have one.
        
    *   After creating the wallet, you will receive an address in the format `cosmos1...`.
        

* * *

### 2\. **Private Key**

*   **Why is it needed?**
    
    *   The private key is used to sign transactions and interact with the network. Without it, your node won't be able to perform operations such as sending data, confirming transactions, or generating ZK proofs.
        
*   **Where to get the private key?**
    
    *   If you created the wallet via `keplr` or another tool, you can export the private key from that application.
        
    *   If you created the wallet via the command line (e.g., `cosmos-cashd`), you can retrieve the private key using:
        
            cosmos-cashd keys export <wallet_name>
            
        
        > **Comment**: This command will output an encrypted private key. Decrypt it if necessary.
        
*   **How to add the private key to** `.env`?
    
    *   In the `.env` file, locate the line:
        
            PRIVATE_KEY='cli-node-private-key'
            
        
        *   Replace `cli-node-private-key` with your actual private key.
            

* * *

### 3\. **Important Notes**

*   **Security:**
    
    *   Never share your private key with anyone.
        
    *   Store it in a secure location (e.g., offline).
        
    *   If you are using a `.env` file, ensure it is protected from unauthorized access.
        
*   **Linking with Dashboard:**
    
    *   After launching the node, you can link it to the Dashboard using your wallet’s public address (`cosmos1...`).
        
    *   The private key is not required for the Dashboard but is essential for the node to operate.
        

* * *

### 4\. **Example** `.env` Configuration

Suppose you have:

*   Wallet address: `cosmos1abcde...`
    
*   Private key: `my_private_key_123...`
    

Your `.env` file will look like this:

    GRPC_URL=34.31.74.109:9090
    CONTRACT_ADDR=cosmos1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqt56709
    ZK_PROVER_URL=http://127.0.0.1:3001
    API_REQUEST_TIMEOUT=100
    POINTS_API=https://light-node.layeredge.io
    PRIVATE_KEY='my_private_key_123...'
    

* * *

### 5\. **What to Do Next?**

1.  Ensure that you have correctly specified the wallet address and private key.
    
2.  Start the Merkle service:
    
        cd risc0-merkle-service
        cargo build && cargo run
        
    
3.  Start the node:
    
        go build
        ./light-node
        
    
4.  Check the logs to ensure the node is running correctly.
    

* * *

Now you are ready to launch and configure your LayerEdge node!

---

*Originally published on [specweb3](https://paragraph.com/@specweb3/layeredge-light-node-setup-guide)*
