# Mainnet Node Setup

This guide provides a step-by-step process for using the qubetics\_ubuntu\_node.sh script to set up and run a Qubetics node. Please follow the instructions carefully to ensure a successful setup.

### Prerequisites

#### System Requirements

* **Operating System:** Ubuntu 22.04
* **Memory:** At least 16GB RAM
* **Storage:** Minimum 500GB available disk space
* **CPU:** 8-core minimum
* **Network:** Stable internet connection

#### Tools and Dependencies

Ensure the following tools are installed:

* Go _( by running the install\_go.sh script )_
* Jq
* Bash
* wget
* unzip
* build-essential

All of these installations are already covered in the qubetics-mainnet-script.sh script.

### Step 1: Prepare Your Environment

1. **Run as Root or with Sudo Privileges:** Ensure the script is executed with root privileges. If not, you may encounter permission issues.

```bash
sudo su
```

&#x20;2\. **Clone the Repo:** Clone the repository and change into the directory. This script supports both Ubuntu (22.04, 24.04) and macOS (14, 15).&#x20;

```bash
git clone https://github.com/Qubetics/qubetics-mainnetnode-script
cd qubetics-mainnetnode-script
```

### Step 2: Execute the Script

{% hint style="info" %}
Check if Go is installed, and if not, then run this script \
./install-go.sh&#x20;
{% endhint %}

#### Approach 1: Run the Full Node Script

Use this prompt for faster synchronization if you prefer not to run an archived node. By running this script, you don't need to follow the steps <mark style="color:$primary;">**(3, 4, & 5 mentioned in the archived node section)**</mark>.

```
./qubetics_fast_sync.sh
```

#### -OR-

#### Approach 2: Run the Archived Node Script

Execute the script to install the required components and set up the node on Ubuntu.

```bash
./qubetics_ubuntu_node.sh
```

Execute the script to install the required components and set up the node on a Mac.

```
./qubetics_mac_node.sh
```

* The script prompts for the node name; please provide it.
* The script prompts the user to **set up a password for the keyring** so that the keys are stored securely.
* Set a secure **numeric/alphanumeric password** and provide it whenever prompted.

#### Key Configuration Prompts

* If a previous node configuration exists, you will be prompted to overwrite it. Choose y to overwrite or n to retain the existing setup.
* Save the generated keys and mnemonics securely when prompted. These are essential for accessing your node.

### Step 3: Verify Installation

1. **Validate Genesis:** Ensure the Genesis file is properly configured.

```bash
qubeticsd validate-genesis --home /data/.tmp-qubeticsd
```

2. **Display Node Information:** After setup, the script displays important node details:

* Tendermint Public Key
* Bech32 Address
* Node ID

Record these details for future reference.

### Step 4: Start the Node

The script automatically sets up and starts the node as a system service.

Manage the Node Service

* **Start the Service:**

```bash
sudo systemctl start qubeticschain.service
```

* **Check the Service Status:**

```bash
sudo systemctl status qubeticschain.service
```

* **Enable the Service to Start on Boot:**

```bash
sudo systemctl enable qubeticschain.service
```

### Step 5

The chain will get upgraded once it reaches the height of 175,000. Clone the repository and change into the directory.

```
git clone https://github.com/Qubetics/qubetics-mainnet-upgrade 
```

Now run the below command

```
cd qubetics-mainnet-upgrade/
./upgrade_qubetics_node.sh
```

### Additional Configurations

#### Update Configurations

The script automatically modifies configuration files located in /data/.tmp-qubeticsd/config/

* **Timeout Settings:** Adjusted for optimal performance.
* **Gas Prices:** Set to 0.7 TICS (approx).
* **Networking:** Configured to listen on all interfaces (0.0.0.0).

#### Persistent Peers

The script includes default persistent peers to facilitate P2P communication. To add or modify peers, edit the config.toml file.

```bash
nano /data/.tmp-qubeticsd/config/config.toml
```

### Troubleshooting

#### Common Issues

1. **Dependency Errors:** Ensure all dependencies (e.g., jq, go) are installed before running the script.

```bash
sudo apt-get install -y jq build-essential wget unzip
```

2. **Service Not Starting:** Check logs for detailed error messages.

```bash
sudo journalctl -u qubeticschain.service -f
```

3. **Genesis File Validation Failed:** Verify the Genesis file contents and ensure they match the required network configuration.
4. **Permission Denied:** Please verify that you have completed all the required steps and granted the necessary permissions to the script using the **chmod** command.

### Maintenance

#### Restart the Node

```bash
sudo systemctl restart qubeticschain.service
```

#### Stop the Node

```bash
sudo systemctl stop qubeticschain.service
```

Qubetics nodes work best on Linux and macOS. While you can technically run a node on Windows, it’s not recommended for production use. Most validators and node operators prefer Ubuntu or other Linux systems because they are stable, secure, and fully compatible with the Cosmos SDK. MacOS is fine for local development, but isn’t used for production nodes.\
Running a node on Windows comes with several challenges:

* **Limited Compatibility:** Qubetics node uses Cosmos SDK tools and scripts. These are designed only for Linux/macOS.
* **Performance Issues:** Windows handles processes and networking differently, which can lead to instability.
* **Dependency Problems:** Setting up the Qubetics node on Windows requires extra steps, like using WSL2 (Windows Subsystem for Linux 2).
* **No Systemd Support:** Systemd, a tool commonly used to manage Qubetics nodes on Linux, isn’t natively supported on Windows.

**For the best experience:**

* Use Linux (Ubuntu 22.04 LTS is recommended) for development, testnets, and production.
* macOS is okay for local testing.
* If you’re on Windows, use WSL2 (Windows Subsystem for Linux 2) instead of running the node natively.
