How to run a TN node (part 2)

…on an Azure VPS from a Windows PC.

In the previous part you learned how to setup your Azure VPS, now let’s continue with the configuration and install the actual node.

Again, big credit to the original set-up guides by BlackTurtle and MapleNode, most of the stuff in this section is coming from them.

We finished of in the last part with the VPS being created on the Azure platform. When it’s done hit the Go to resource button and you’ll see this screen:

1. Resource overview

This might look a bit daunting at first, but we need just a few settings here.

1. Securing access

First we need to secure access to your VPS. Click on Networking under settings in the left menu bar.

2. Network settings

Double click on the line with SSH to edit the settings and change Source to IP Addresses and fill in your own IP address (if you don’t know you can find out with whatsmyip.org).

3. Securing SSH access

While we are here we can also add the other firewall rules required for running the node, opening up port 6860 to the public and 6861 for private access. Click on Add inbound port rule and use the following settings:

4. Opening port 6860 for node communication

and click Save. then click Add inbound port rule again for port 6861:

5. Opening port 6861 for your IP

Again, change the source like we did with port 22 and put your own IP address in for Source ip addresses.

You should end up with something like this:

6. Finished firewall settings

2. Connect to the VPS

ok, finally, we can connect to the VPS 🙂
If you ever forget your public ip, just click on the Connect button on your resource overview in Azure:

6. All the connect information you need

Fire up Putty, put in your public IP in the Host Name (or IP address) field and click Open.

7. the Putty start interface

Once connected enter your Login credentials.

8. It’s alive!!!

…and we’re connected to our fresh new Linux environment.
As this is a Azure VM you are not connected as the ‘root’ user, but you you do have root / administrator rights as long as you use the sudo command.

3. Update Ubuntu

Now that we’re connected we need to update Ubuntu. Run the following commands to update your VPS:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get dist-upgrade
9. Updates are done

Once the updates finished, restart the VPS with:
sudo shutdown -r now
and reconnect again with Putty.

Now with most other how-to’s on running a TN node you would now create a new user. On Azure this isn’t necessary because we already created the user when configuring the VPS, so we can skip that step.

4. Install JAVA

Next we will install Java Runtime Environment 1.8 to run the node software. Run these commands to install the JRE and JDK:

  • sudo apt-get install openjdk-8-jre
  • sudo apt-get install openjdk-8-jdk

Once completed check your installed version with: java -version

10. Verify your Java installation

5. Install node software

Next we need to create our working directory where the node software and configuration will be placed:

  • Create the directory: sudo mkdir /opt/turtle
  • Change directory: cd /opt/turtle

Next we’ll need to download the latest stable version of the software.
Go to https://github.com/BlackTurtle123/TurtleNetwork/releases to check what the latest release is, currently that is 0.16.3. You’ll need to remember that version number for the following commands:

  • Get the node software: sudo wget https://github.com/BlackTurtle123/TurtleNetwork/releases/download/v0.16.3/TN-all-0.16.3.jar
  • Get the .conf file: sudo wget https://github.com/BlackTurtle123/TurtleNetwork/releases/download/v0.16.3/TN-mainnet.conf

If the current version is higher than 0.16.3 just replace 0.16.3 in the above command with the current version number.
Current version is 0.16.6, but this version doesn’t have a separate TN-mainnet.conf file, so you still need to grab the one from version 0.16.3 as shown above.

10. Getting the software and .conf file

6. Create a new TN wallet

Now it’s best to start off with a fresh TN wallet for use with your node. Head over to https://client.turtlenetwork.eu and click on new account.

11. Create a new TN wallet
12. Save your seed offline

Important: Save your seed (preferably somewhere offline) and don’t loose it or give it out. If you don’t have your seed, you can’t restore your wallet and loose access & anything you have in it.

Put in a name and password (remember it, we need it later on) and click on REGISTER to login.

Now click on the BACKUP icon in the upper right corner and copy the ENCODED SEED, we will also need that for the configuration.

13. Copy the encoded seed and address

You can logout of your wallet now.

7. Configure node software

Finally we can start configuring the node 🙂

Fire up an editor to start editing the .conf file:

sudo nano TN-mainnet.conf

and change the following lines (remove any starting # on those lines):

  • line 19 node-name: replace My MAINNET node with your node’s name
  • line 22 declared-address: replace 1.2.3.4:6868 with your public ip-address followed by :6860
  • line 27 password: replace ridetheTN! with the password you put in when creating your wallet
  • line 30 seed: put your encoded seed (the one you copied in the previous section)
  • line 52 enable: replace no with yes
  • line 55 bind-address: replace 127.0.0.1 with 0.0.0.0
  • line 65 features: replace supported = [1, 2, 3, 5, 6,7,8] with
auto-shutdown-on-unsupported-feature = yes
supported = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
14. Configure TN-mainnet.conf

8. Start your node

After saving the changes to TN-mainnet.conf it’s time to fire up your node for the first time:

java -jar TN-all-0.16.3.jar TN-mainnet.conf
15. Starting for the first time

It will take a while to synchronize all blocks already created. Just let it run until the Blockchain is completely updated.

Check if your node is listed in the peers overview at https://explorer.turtlenetwork.eu/peers – if it’s listed your good to go.

9. Configure REST API

Next we need to configure your REST API, that’s required to being able to access certain feature of your node from external addresses (for instance using my LPOS Distribution setup).

Open your browser and head over to your node’s public IP at port 6861, for instance http://23.97.218.152:6861.

16. The REST API interface

Click on Utils and then /utils/hash/secure. Enter your api key in the Value field and click Try it out!.

17. Hash your api key

Copy the information from Repsonse Body, message is your unhashed api key and hash is your hashed api key. You will need these, so write them down carefully.

Go back to Putty and your terminal session with your node. It’s probably still downloading the blockchain. If you do not want to wait for it to finish before we edit the TN-mainnet.conf again press Ctrl-C, this will gracefully shut down the nodesoftware:

18. Shutting down your node software

Now we need to add the information for the apikey in TN-mainnet.conf, so let’s edit it again:

sudo nano TN-mainnet.conf

Head to line 61 api-key-hash and change it to the hashed api key we copied above. Save it.

10. Run It!

That’s basically it. Now we can fire up the node software again and it can keep chugging along. To make sure the node software isn’t shut down when you disconnect your Putty session we are going to use tmux, tmux allows a user to run multiple terminal sessions (that stay active) locally or from a remote terminal session.

First we need to install tmux:

sudo apt-get install tmux

And let’s run it:

tmux

and start the node again:

java -jar TN-all-0.16.3.jar TN-mainnet.conf
19. …and we’re done!

that’s it, your node is running, congratulations!!!

Next time you connect to your node with putty you can attach to the tmux session with (check here for a small tmux cheatsheet):

tmux attach -t 0

One Reply to “How to run a TN node (part 2)”

Leave a comment