# Non-Validator Node Setup

This section will guide you through setting up a Non-Validator Node on W Chain.

### **Step 1: Prepare the System** <a href="#step-1-prepare-the-system" id="step-1-prepare-the-system"></a>

Before starting, ensure your system meets the minimum requirements for running a node:

* vCPUs: 2 or more
* Memory: At least 8GB
* Disk Space: At least 200 GB (SSD or NVMe recommended for optimal performance)
* Operating System: Ubuntu 20.04, 22.04, or 24.04
* Internet Connection: A broadband connection with at least 5Mbps upload/download speed.

It's possible to run a node from a local dedicated server, but it's recommended to run it on a professional cloud providers such as AWS, Digital Ocean, Azure or GCP.

### **Step 2: Install Dependencies** <a href="#step-2-install-dependencies" id="step-2-install-dependencies"></a>

Make sure you have up-to-date version of Ubuntu, Git and NPM installed.

```bash
sudo apt update && sudo apt upgrade -y
```

```bash
sudo apt install git -y && sudo apt install npm -y
```

{% hint style="info" %}
Some system may have different package manager, here we use <mark style="color:yellow;">apt</mark>, the most commonly used
{% endhint %}

### Step 3: Prepare Directory

```bash
cd ~
mkdir w-chain
cd w-chain
```

### Step 4: Download files from latest Release

To initiate a Node, you need the latest binary and genesis.json. It always available at [W Chain's Github Repository for W chain Node](https://github.com/w-chain-team/node/releases/latest).

You need to select the suitable binary based on your Operating System and **architecture**. You can contact your Cloud Computing Provider if you are not sure about yours.

In this guide, we will use the most common one: Linux (amd64), as it's widely used in AWS EC2 instances.

#### Download BInary File

<mark style="color:yellow;">In this example we are using v.1.0.6</mark>

{% hint style="info" %}
You can download the latest binary file using `wget` or `curl`
{% endhint %}

```bash
curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/w-chain-node_v1.0.6_linux_amd64.tar.gz
```

After the download complete, print your directory contents to get the downloaded file name:

```bash
ls -lh
```

The file name will be in this format: "w-chain-node\_" + `version tag` + `system` + "\_" + `architecture` + ".tar.gz". Extract the file:

```bash
tar -xzf w-chain-node_v1.0.6_linux_amd64.tar.gz
```

Rename the file (Optional, but important for better UX):

```bash
mv w-chain-node-linux-amd64 w-chain-node
```

#### Download <mark style="color:yellow;">`genesis.json`</mark>

```bash
curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/genesis.json
```

You don't need to change anything from this genesis.json, just make sure it exists in the same directory with your binary file.

### Step 5: Verify Files

Make sure both binary file and genesis.json is correctly downloaded and in stored in same directory.&#x20;

Turn the binary file into executable:

```bash
chmod +x w-chain-node
```

Verify the version:

```bash
./w-chain-node version
```

`[VERSION INFO]`\
`Release version = 1.0.6`

### Step 6: Initialize Keys and Blockchain Data Directories

This command will initialize data directory and validator keys:

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

```bash
./w-chain-node secrets init --data-dir main-chain --insecure
```

{% endtab %}

{% tab title="Testnet" %}

```bash
./w-chain-node secrets init --data-dir test-chain --insecure
```

{% endtab %}
{% endtabs %}

### Step 7: Create Server Config

The node is basically a server that will run 24/7, responding to queries and persisting blocks to database. Instead of passing the configs as flags to `server` command, it's strongly recommended to store the server configs in a json/yaml file.

Run this command (in <mark style="color:purple;">`/w-chain`</mark> directory) to generate server config template:

```bash
./w-chain-node server export --type json
ls -lh
```

You will see a file, <mark style="color:yellow;">`default-config.json`</mark> created.

Now, we will edit this config file to adjust with your actual server configuration.&#x20;

{% hint style="info" %}
You can use any supported text editor, in this example we use `nano`.
{% endhint %}

```bash
sudo nano default-config.json
```

{% hint style="warning" %}
This config below assuming you are following previous steps convention on directory creation. It also recommended to use absolute path, which can be different from system to system (usually /home/user/w-chain)
{% endhint %}

#### <mark style="color:yellow;">`genesis.json`</mark> location

```json
"chain_config": "/home/ubuntu/w-chain/genesis.json",
```

#### Path to Data Directory

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

```json
"data_dir": "/home/ubuntu/w-chain/main-chain", 
```

{% endtab %}

{% tab title="Testnet" %}

```json
"data_dir": "/home/ubuntu/w-chain/main-chain", 
```

{% endtab %}
{% endtabs %}

#### Ports

```json
"grpc_addr": "127.0.0.1:9632", 
"jsonrpc_addr": "0.0.0.0:8545", 
```

{% hint style="warning" %}
NAT Address is your server/instance's Public IP
{% endhint %}

```json
"network": {
    ...
    "libp2p_addr": "0.0.0.0:1478", 
    "nat_addr": "12.34.567.890",
    ...
}
```

#### Minimum Gas Price accepted and Seal flag

{% hint style="info" %}
For Non-Validator Node, **Seal must be false**.\
Per v1.0.6 Min Gas Price in W Chain Network is 8 Gwei
{% endhint %}

```json
"price_limit": 800000000000,
"seal": false
```

### Step 8: Utilizing Blockchain Backup File

Joining a blockchain network will require a new node to sync with other existing nodes, this can take days even weeks, depends on how long the network already running so far. We have prepared backup files to jump start the process for you.&#x20;

{% hint style="info" %}
This backup file will be updated from time to time to ensure new node operators will have closer starting point to sync their new nodes to W Chain Network
{% endhint %}

```bash
# In the ./w-chain directory
cd main-chain
```

#### Download and unpack Trie

```sh
curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/trie.tar.gz
```

```sh
tar -xzf trie.tar.gz && rm trie.tar.gz
```

#### Download and unpack Blockchain

```sh
curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/blockchain.tar.gz
```

```sh
tar -xzf blockchain.tar.gz && rm blockchain.tar.gz
```

{% hint style="info" %}
Downloading and unpacking the Blockchain backup file will take some time, depends on your internet connection speed and Storage I/O rate
{% endhint %}

After this step, you should have 2 new directories (<mark style="color:blue;">`blockchain`</mark> and <mark style="color:blue;">`trie`</mark>), in addition to the existing <mark style="color:blue;">`consensus`</mark> and <mark style="color:blue;">`libp2p`</mark>.

#### Aligning permission and directory ownership

```sh
pwd
```

This will print your current working directory (i.e. `/home/ubuntu/w-chain/main-chain`), **copy it.**

```sh
ls -ld /w-chain/main-chain
```

you will see something like this:

```
drwxr-x--- 6 ubuntu ubuntu 4096 Apr 12 14:08 /data/w-chain/main-chain
```

based on the example above, we can see the user and user group is <mark style="color:yellow;">`ubuntu:ubuntu`</mark> (this may vary, depends on your system). Now, that we know the user and user group, we can align the permission:

```sh
sudo chown -R ubuntu:ubuntu /home/ubuntu/w-chain/main-chain
```

Now, your blockchain data is ready!

### Step 9: Create a System Service

To keep your Node instance running as a background service, you need to define the service. Run this on your terminal (inside your server/instance).

```bash
sudo nano /etc/systemd/system/w-chain-node.service
```

The text editor will open a blank page. Copy-paste the texts below into it:

```
[Unit]
Description=W Chain Validator Node
After=network.target
StartLimitIntervalSec=1

[Service]
Type=simple
User=ubuntu
ExecStart=/home/ubuntu/w-chain/w-chain-node server --config /home/ubuntu/w-chain/default-config.json

[Install]
WantedBy=multi-user.target
```

Then save and exit the text editor.

{% hint style="warning" %}
Once again, this is assuming you are following the directory and filename convention from previous steps. Your system may have different absolute path and different user, please adjust as needed.
{% endhint %}

### Step 10: Enable and Run the Node Service

After installing new service, you have to reload the service daemon and enable the service.

```bash
sudo systemctl daemon-reload
sudo systemctl enable w-chain-node.service
```

Then start the service:

```bash
sudo systemctl start w-chain-node.service
```

**Congratulations**! Your node is now running and will start to catch up with the network, this may take few days, depends on the block-height and the I/O performance of your node.

### Important Commands to Maintain and Monitor Your Node

#### Service

{% tabs %}
{% tab title="Start Service" %}

```bash
sudo systemctl start w-chain-node.service
```

{% endtab %}

{% tab title="Stop Service" %}

```bash
sudo systemctl stop w-chain-node.service
```

{% endtab %}

{% tab title="Restart Service" %}

```bash
sudo systemctl restart w-chain-node.service
```

{% endtab %}
{% endtabs %}

#### Logging

{% tabs %}
{% tab title="Show Log" %}

```bash
journalctl -u w-chain-node
```

{% endtab %}

{% tab title="Live Log Print" %}

```bash
journalctl -u w-chain-node -f
```

{% endtab %}
{% endtabs %}
