[Java] How to build NEM (current version) node (NIS1: NEM Infrastructure Server)

8 minute read

NEM blockchain is currently undergoing various preparations on the testnet for the launch of the next version of Symbol. At such a time, I feel that the documentation and reference information on how to build nodes for the next version of the Symbol test net are very substantial. But, surprisingly, I had a hard time looking for documentation and references on how to build nodes for the current version of the NEM blockchain. (Maybe it’s my own problem with gragability…) For my own memorandum, I would like to summarize in this article how to build the current version of NEM node (=NIS1 … NEM Infrastructure Server abbreviation) on Google Cloud Ploatform. If you have any mistakes or better methods, please let me know. Thank you.


  1. Create a firewall rule
  2. Create a VM with GCE and login with SSH
  3. Java installation
  4. Download and unzip the NIS1 body
  5. Modify node start script
  6. Start the node
  7. Confirmation after startup


1. Create a firewall rule

NIS1 seems to use port 7890 for http and port 7778 for WebSocket. Also, it seems customary to use port 7891 for https and port 7779 for WebSocket(SSL). Create a firewall rule as in the example below. You can use any name and target tag, but you will use the target tag later in the VM settings.

  1. Click the navigation menu (three-line icon) in the upper left
  2. Click on “VPC Network” (scroll down to reveal)
  3. Click “Firewall”
  4. Click “Create Firewall Rule” and “Create” the following two firewall rules

Firewall rule 1st: for http

-Name: nem-http-allow -Target tag: nem-http-allow -Source IP range: -Protocol and port: Check the radio button of the specified protocol and port, check the check box on the left side of “tcp”, and enter 7890, 7778 in the input box next to it. -Click “Create”

Second firewall rule: for https

-Name: nem-https-allow -Target tag: nem-https-allow -Source IP range: -Protocol and port: Check the radio button of the specified protocol and port, check the check box on the left side of “tcp”, and enter 7891, 7779 in the input box next to it. -Click “Create”

2. Create VM with GCE

As a result of researching beforehand and listening to rumors, it seemed that heavy processing was likely to run, so at first I decided to set a higher specification. Once the initial synchronization is complete and the state is stable, it is better to consider narrowing down the specifications considering the cost. An example of VM settings is as follows.

VM setting example

  • Name: nem-mainnet-1
  • Region: asia-northeast1 (Tokyo)
  • Zone: asia-northeast1-b
  • Machine configuration -Series: E2 -Machine type: Custom -Number of cores: 2 vCPU -Memory: 16 GB (It seems like you have secured too much, but for the time being…)
  • Boot disk -Click “Change” -Operating system: Ubuntu -Version: Ubuntu 20.04 LTS -Boot disk type: standard persistent disk -Size: 400 GB (feeling too secure properly… -Click Select to save the boot disk settings
  • Firewall -Check “Allow HTTP traffic” -Check “Allow HTTPS traffic”
  • Click on Management, Security, Disks, Networking, Single Nancy and select the Networking tab -Network tag: set nem-http-allow and nem-https-allow -Network interface: Click the edit icon to configure -Select “External IP” from “Ephemeral” and select “Create IP address”, enter an appropriate name (eg nem-mainnet-1) in the dialog and click “Reserve” -Click “Finish” to save network interface settings
  • Click “Create” to create a VM

SSH login to VM

After creating the VM, after a while, the startup of the VM is completed, and the select list called “SSH” in the “Connect” column of the VM list can be clicked.Clicking this opens the screen for SSH login to the VM in the browser. .. Subsequent operations are mainly performed on that screen.

3. Java Installation

You need Java 8 to run NIS1, so install it. Let’s do other updates as well. Execute the following command.


sudo apt update

Install Java 8 (OpenJDK8 to be exact)

sudo apt install -y openjdk-8-jdk

Verify Java 8 installation

Execute the following command,

java -version

If the following result is obtained, the installation is successful.

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

4. Download and unzip the NIS1 body

The tool for executing NIS1 on Linux is a compressed tgz file that is distributed from the following URL, so download it, unzip it, and use it. Latest version as of 05/30/2020: https://bob.nem.ninja/nis-0.6.97.tgz A page with links to other versions and related data: https://bob.nem.ninja/


You can download it as the file name nis1.tgz with the following command. The file name of nis1.tgz can be anything as long as it has the extension .tgz, but please replace the file name appropriately with the next unzip command.

curl -o nis1.tgz https://bob.nem.ninja/nis-0.6.97.tgz


(If you downloaded with the file name nis1.tgz at the time of download), you can unzip it with the following command. When you unzip it, you will have a folder called package.

tar -xzvf nis1.tgz

5. Fix node start script

Move to the package folder with the following command,

cd package

Use the following command to open the nix.runNis.sh file (node startup shell script) with an editor and modify it. Here is an example of using nano as the editor, but use the editor of your choice.

nano nix.runNis.sh

At a minimum, the points to be changed are as follows.

Relax maximum memory usage

The default settings do not seem to have enough memory to boot properly. This time I’m creating a VM with 16GB of memory and a lot of extra power, so I’d like to try it as a setting that allows NIS1’s process to use up to 14GB of memory. (Maybe even a little more conservative maximum memory allocation will work.)

Add nohup to the start of the start command, add & to the end of the start command

Running the node start shell script by default causes NIS1 to run in the foreground. This will force NIS1 to exit when you log off. It seems that by adding nohup at the beginning of the startup command and & at the end of the startup command, it can be executed continuously even if you are not logged in in the background.

Nix.runNis.sh before change


cd nis
java -Xms512M -Xmx1G -cp ".:./*:../libs/*" org.nem.deploy.CommonStarter

The modified nix.runNis.sh


cd nis
nohup java -Xms512M -Xmx14G -cp ".:./*:../libs/*" org.nem.deploy.CommonStarter &

If you use nano as the editor, to save the file by overwriting, first use “Ctrl” + “X”, then “Y”, and then “Enter” when the file name is displayed.

6. Start the node

Now that you are ready to start the node, start the node with the following command.


7. Confirmation after startup

Since it is set to operate in the background, no special messages are displayed on the screen even after startup, so hit an API that acquires block height, node information, etc. from the outside and return an appropriate value. Let’s check. Replace the IP address with your own environment.

block height

  • Response example

You can see that the synchronization has not finished yet because it is just after the start-up, and the synchronization has been completed only to a place much lower than the latest block height. This number will increase little by little, and when it catches up with the latest block height, node construction will be a break.

Originally, in order to reduce the time required for this synchronization, it is possible to separately download the DB information of the blockchain up to the most recent extent and expand it, so I would like to add that method somewhere as well. I am.

Node information

  • Response example
"metaData": {
"features": 1,
"application": null,
"networkId": 104,
"version": "0.6.97-BETA","platform": "Private Build (1.8.0_252) on Linux"
"endpoint": {
"protocol": "http",
"port": 7890,
"host": ""
"identity": {
"public-key": "79140632da5b00327bba8d5cb3b258d04843c10520cb757fde1a5a859f0ae567"

In addition, tapping the node information API etc. will deepen your confidence in your own settings. You can see that the networkId 104 indicates MAIN_NET, the NIS1 and Java versions are shown, and the API protocol, port, and host name are shown. Also, what I found a little interesting is that the NEM account is automatically created and used as an identifier when the node is started. (I wonder if these accounts will be related to harvest settings etc.)


After going through all the steps, I thought, “Is it really just a shell script running?” (So there’s a lot to say, there isn’t much to say, so maybe you can’t find much information like a solid procedure… of course it’s done internally after the shell script is started. I get the impression that it seems to be complicated…)

For the time being, start it up and leave it alone! If the level is good (≒ this article level), I got a simple impression.

However, where is the maximum memory correction value, the default foreground execution, and where is the NIS1 main program stored? I feel that there are some “hammering points” such as that, so I felt that it would be happy for users who newly build NIS 1 in the future if there are no such hammering elements by default.

Contents to be added (want to)

I would like to add the following contents eventually.

  • Appropriate management such as service conversion
  • Domain settings
  • SSL
  • Harvest acceptance setting
  • Settings related to incentives, etc. after the launch of the next version

Reference information

I have referred to the following information. Thank you to all the pioneers.

  • NIS 1 node construction of NEM official blog: https://blog.nem.io/ubuntu-installation-guide-standalone/
  • NEM official blog made NIS 1 node SSL: https://blog.nem.io/https-nis-node/
  • Build NIS1 node for testnet: https://blog.44uk.net/2018/02/12/up-nem-testnet-node/
  • Main net NIS1 node construction: https://mizunashi-rin.hatenablog.jp/entry/2017/02/15/002342
  • NIS 1 node SSL: https://blog.44uk.net/2017/10/31/nis-with-https-by-dehydrated/