# Masternode Setup With A  Script

This guide is for setting up a TWINS masternode on a Ubuntu 16.04/18.04 64-bit server (VPS) and will be controlled from the **local wallet** on your computer. The wallet on the VPS that runs your masternode will be referred to as the **remote wallet.**

#### **Requirements**

1. One million TWINS
2. A personal computer -  this will run the **local wallet**, hold your 1,000,000 TWINS collateral and can be turned on and off without affecting the masternode.
3. A VPS server running Ubuntu 16.04/18.04 - this computer will be on 24/7 and runs the **remote wallet and masternode**)
4. A static IP address for your VPS.

### Local wallet installation

1. Download, install and sync the TWINS wallet on your local computer. Wallet links can be found [here](https://win.win/#download).
2. In this **local wallet**, go to Tools > Debug console and type the following command: **`masternode genkey`** \
   This command will generate your Masternode Private Key. Save this key e.g. on Notepad as we will be using it later.

![](https://cdn-images-1.medium.com/max/1600/1*VVF1D-5XWThP0iuluFm1ZQ.png)

3\. Now enter the following command into the console: \
\&#xNAN;**`getaccountaddress YourMasternodeAddressName`** \
This will create a wallet address and name for your masternode. Save it as we will need it later.

4\. **Send 1,000,000 TWINS to the address** generated in the previous step. IMPORTANT: In the Amount box, type in EXACTLY 1,000,000. This transaction tells the blockchain that the address you are sending it to is a masternode. If you type in more or less than one million TWINS, or attempt to split the payment into two transactions, it will be invalid for a masternode. When you press the Send button the wallet will calculate the proper transaction fee. Click Yes in the dialog box that follows and proceed to the next step.

5\. Using your **local wallet**, wait for the first confirmation and then enter the debug console (Tools > Debug Console) and type the following command:**`masternode outputs`** This will display the transaction id followed by the output index (this is the proof of transaction of sending 1,000,000 TWINS). Save this to a notepad as well.

6\. In the local wallet’s toolbar, click **Tools > Open Masternode Configuration File** to open *masternode.conf* and add the following line:

**`<MN alias> <unique IP address>:37817 <your MN private key> <transaction ID (txhash)> <output index 0 or 1 (outputidx)>`**

Save the file and **restart the wallet.**

```
Example as per above format:
MN1 67.234.12.34:37817 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0
```

Example masternode.conf file

![](https://cdn-images-1.medium.com/max/1600/1*YuZAGDZSCbyOgNFv8aqelA.png)

### VPS remote wallet installation

To install the **remote wallet** first you will log into your VPS using the SSH client. After logging in, type the following commands into your VPS terminal.

1\. Download the MN installation script

**`wget https://win.win/mn.sh`**

2\. Run the MN installation script

**`bash mn.sh`**

3\. Follow the instructions

### Starting your Masternode

When the transaction has received **16 confirmations,** the masternode is eligible to start.\
In the Masternodes tab, right-click on the masternode and choose **Start alias.**

![](https://cdn-images-1.medium.com/max/1600/1*oTls8o8I2_2EcMmSZBziQA.png)

### **How to verify that your masternode is running**

Go back to your **remote wallet** to check the masternode status: `./twins-cli startmasternode local false`

The message *Masternode successfully started* should appear.

You can also use the following command to check the status: \
`./twins-cli masternode status`

Something similar to this should appear:`{`\
`“txhash” : “334545645643534534324238908f36ff4456454dfffff51311”,`\
`“outputidx” : 0,`\
`“netaddr” : “45.11.111.111:37817”,`\
`“addr” : “WmXhHCV6PjXjxJdSXPeC8e4PrY8qTQMBFg”,`\
`“status” : 4,`\
`“message” : “Masternode successfully started”`\
`}`

**Now you can also double-check the masternode status in the TWINS explorer.**

To do so, copy your masternode wallet address from the terminal window by selecting it with your mouse (`WmXhHCV6PjXjxJdSXPeC8e4PrY8qTQMBFg` in the above example). Visit the masternode section of the [TWINS explorer](https://explorer.win.win/masternodes), and paste it in the lower right search box to find your masternode.

Your masternode status should appear as "ACTIVE".

{% hint style="info" %}
After starting the masternode its status changes **in the following order:**

ACTIVE --> For around 2-3 hours after starting it (on the explorer)

ENABLED --> For around 2-3 hours after starting it (in the wallet)

EXPIRED --> It will be for just a couple of minutes (on the explorer)

REMOVED --> For just a couple of minutes (on the explorer)

MISSING --> It will be for just 5-10 minutes (in the wallet)

ENABLED --> This is the final status for both the wallet and the explorer. The masternode will remain in this status while it's running and Active time will start increasing.
{% endhint %}

{% hint style="danger" %}
\*NOTE: if the masternode status is set as MISSING in your local wallet, always check its status in the masternode explorer - <https://explorer.win.win/masternodes>. It might be showing EXPIRED or REMOVED there during the starting process which is correct. It is always better to double-check the status with the community rather than hastily do Start alias again!
{% endhint %}

{% hint style="success" %}
**The first MN reward**

The average time it takes to receive the first reward is calculated in hours with the formula **millions\_locked\_before\_your\_MN\_is\_enabled\*2.6/60**. At the time of writing the total number of millions that are locked in MNs is 3,500 million, so **3500\*2.6/60=151.67 hours** or approximately **6 days, 7 hours and 40 minutes.**
{% endhint %}

\
That's about it. Congratulations! You have successfully created your masternode.
