How to run ADAMANT node on Windows
By: Adamant Messenger
Tags: Wsl 2, Blockchain, Cryptocurrency, Ubuntu, Wslinux

Starting June 2019, Windows 10 and Windows Server 2019 include WSL 2 — Windows Subsystem for Linux. WSL lets you run Linux applications on Windows, essentially creating a “Linux computer within a Windows computer”. This means that you can run the ADAMANT node on your home computer, as well as run a delegate or forging pool.

To do this, you need to install WSL 2 with Ubuntu, and then run the ADAMANT node using the instructions for Ubuntu.

System requirements

Windows 10 x64, version 1903 /build 18362 or higher, or Windows Server 2019

RAM 4 GB

50 GB system disk space

WSL 2 setup

Guide for WSL 2 installation: https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps.

Installing WSL 2 takes a few minutes. Note that Virtualization Technology must be enabled before installation in the BIOS of the computer.

If you do not use the Microsoft Store, then instead of the “Install your Linux distribution of choice” step, download the Ubuntu distribution manually. Suitable versions of Ubuntu are 16, 18, or 20.

After installation, create a user account (UNIX username) and password for the new Ubuntu distribution. For example, set the username to ubuntu. If you have any difficulties, use the instructions: https://docs.microsoft.com/en-us/windows/wsl/user-support.

Install ADAMANT node

You now have a Windows computer with the Ubuntu subsystem running, which works the same as in a virtual machine (VPS). Therefore, you can install the ADAMANT node according to the usual instructions for Ubuntu: https://medium.com/adamant-im/how-to-run-your-adamant-node-on-ubuntu-990e391e8fcc.

Immediately after the node is installed, the Vmmem (WSL 2) process can consume a lot of RAM. This is because during installation, the script downloads a fresh blockchain image, and the Linux subsystem writes it to memory whenever possible. When the computer is restarted, the memory consumption will be significantly lower.

FAQ

Can I run a forging pool or other ADAMANT service on Windows?

Yes, the Linux subsystem on Windows allows you to install and run all programs.

If I close the Ubuntu window on Windows, does my ADAMANT node stop working?

No, the Linux subsystem will continue to run in the background as it would with an open window. You can open the Ubuntu terminal again at any time.

If the computer goes to sleep, will my ADAMANT node start automatically when it wakes up?

Yes. Note: it will take some time to catch up with the height of the blockchain.

If I restart my computer, will my ADAMANT node start automatically?

No, it needs to be done manually. Open Ubuntu terminal, or connect to it from PowerShell:

wsl

If you have multiple versions of Linux installed on your computer, specify the specific version:

wsl -d Ubuntu-18.04

To show a list of installed Linux versions:

wsl -l -v

If you want to connect to a terminal as root (usually not necessary):

wsl -d Ubuntu-18.04 -u root

Once connected, start the PostgreSQL database service:

sudo service postgresql start

Choose adamant user:

su - adamant

Run the ADAMANT node:

cd /home/adamant/adamant && pm2 start --name adamant app.js

Check that the node is working and gaining height:

curl http://localhost:36666/api/blocks/getHeight

It will take some time for the node to catch up with the height of the blockchain.

You can configure autostart on reboot if you have knowledge of the system administrator: https://askubuntu.com/a/1166012

How do I connect to my host to access the API?

In both Ubuntu terminal and Windows, you can use localhost to connect to the API. Open in a browser:

http://localhost:36666/api/blocks/getHeight

To access your node’s API from another computer, you need to have knowledge of a system administrator.