# Masternode Guide

#### **Prerequisites**

Before you begin, ensure you have the following:

1. **Collateral**: A minimum of **2,000 SE** (depending on the reward phase).
2. **VPS or Dedicated Server**:
   * **CPU**: Minimum 1x 1GHz (Recommended: 2x 2GHz)
   * **RAM**: Minimum 1GB (Recommended: 2GB)
   * **Disk Space**: Minimum 8GB (Recommended: 16GB)
3. **Selenium Wallet**:
   * Download the wallet from [Selenium Wallet](https://github.com/seleniumofficial/Selenium/releases).

### **Step 1: Prepare Your VPS**

#### **1. Rent a VPS**

* Rent a VPS from a provider like DigitalOcean, Vultr, or Linode.
* Recommended OS: **Ubuntu 20.04 or 22.04**.

#### **2. Access Your VPS**

* Connect to your VPS via SSH:

  ```bash
  root@<your_vps_ip>
  ```

  Replace `<your_vps_ip>` with your server's public IP address.

#### **3. Update the Server**

* Run these commands to update your server:

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

#### **4. Install Dependencies**

* Install the necessary tools:

  ```bash
  sudo apt install -y curl wget unzip ufw
  ```

***

### **Step 2: Set Up Your Wallet**

#### **1. Generate Collateral Address**

* Open your wallet and navigate to **Tools > Debug Console**.
* Run the following command to generate a new address:

  ```bash
  getnewaddress
  ```
* Send the required collateral (`1500 SE)` to this address.

#### **2. Create a Fee Address**

* Generate a separate address for transaction fees:

  ```bash
  getnewaddress
  ```
* Send a small amount (`1 SE`) to this address.

#### 3. Create Addresses for: Owner, Voting, Rewards

* Generate 3 separate addresses for each:

  ```
  getnewaddress
  ```
* Save these 3 addresses.

***

### **Step 3: Generate Masternode Outputs**

#### **1. Wait for Confirmations**

* Ensure your collateral transaction has at least 4 confirmations.

#### **2. Get the Outputs**

* Run the following command in the debug console:

  ```json
  masternode outputs
  ```
* Example output:

  ```json
  {
    "618599438df959fc0647ad1895808ba0fef96282bf24eb177134cb0c329c8d41": "1"
  }
  ```
* Note the **Transaction ID** and **Output Index**.

***

### **Step 4: Generate a BLS Key Pair**

Run the following command in the debug console to generate a BLS key pair:

```bash
bls generate
```

#### **Example Output**:

```json
{
  "secret": "5120ef8b654b7b7a459e19cc3ef3f845ba891404853fa317f348635b347e12ef",
  "public": "098254992464a87643d228e69554fda8f5feb52e9605b9cef2fe73eb3a063f12c8f03a6fa4f07e26a1e9e9875e1c5c91"
}
```

* Save the **public key and private key** for later use.

***

### **Step 5: Register Your Masternode**

#### **Prepare the ProRegTx**

Use the following command to prepare your ProRegTx transaction:

```bash
protx register_prepare <Transaction ID> <Output Index> <VPS IP:Port> <Owner Address> <Public BLS Key> <Voting Address> <0> <Reward Address> <Fee Address>
```

Example output:

```bash
9c76272b7ef2a7456c84158424eb138bd3636b09aa2beae973bbed921f1f7868
```

***

### **Step 6: Configure the VPS**

#### **1. Download and Install Daemon**

* Download the Selenium daemon from GitHub:

  ```bash
  wget https://github.com/seleniumofficial/Selenium/releases/download/v1.0.0/selenium-1.0.0-Ubuntu-Daemon.tar.gz
  ```
* Extract and install:

  ```bash
  tar -xzvf selenium-1.0.0-Ubuntu-Daemon.tar.gz
  sudo mv seleniumd selenium-cli /usr/local/bin
  ```

#### **2. Create a Data Directory**

* Create a directory for the masternode data:

  ```bash
  mkdir $HOME/.selenium
  ```

#### **3. Configure the Masternode**

* Create the `selenium.conf` file:

  ```bash
  nano $HOME/.selenium/selenium.conf
  ```
* Add the following details:

  ```makefile
  rpcbind=127.0.0.1
  rpcallowip=127.0.0.1
  listen=1
  server=1
  daemon=1
  maxconnections=125
  masternode=1
  masternodeblsprivkey=<BLS Secret Key>
  externalip=<Your VPS IP>
  ```

Save the file and exit (`Ctrl + X`, then `Y`).

#### **4. Start the Masternode**

Run the daemon:

```bash
./seleniumd
```

Verify the status:

```bash
./selenium-cli masternode status
```

***

##
