How to Install

Prepare Environment and Files

Please prepare the following environment and files.

  1. Server (a number of server units which will be running as a node)
    Following are the recommended specifications:
    • CPU: 4 Core or more
    • Memory: 8GB or more
    • Hard Disk: 250GB or more
    • Number of Nodes: 4 units or more
    • The transactin will be approximately 100tx/sec with the specifications above.
  2. Prepare the mijin files
    The following files will be delivered from Tech Bureau, Corp..
    • The folder "mijin_install_files" contains:
    • serverjars ... mijin's program file
    • nemesis-mijinnet.bin ... a setting file of an account which creates the initial block (uneditable)
    • config-user.properties ... a setting file for each nodes (editable)
    • peers-config_mijinnet.json ... a setting file to connect each nodes (editable)
    • startnem.sh ... mijin's start file (uneditable)
    • nemesis-accounts.txt
    • An account that has been set up in the namesis-mijinnet.bin.Please make sure to take care with the information on the address, the Public Key, the Private Key.

Setting up Server Environment

In order to start the mijin, the following setting is needed for each server.

  • Create a mijin account
  • Install necessary softwares (Java8, Screen)
  • Set-up the port

Since the current mijin v.1 is created with the software of 'Java8', 'Java8' would be necessary to start the mijin Also, 'Screen' is used for an automatic start when rebooting the server. 7895 and 7778 are used as the defaulted ports, though other ports can be used as well. If the ports are not 7895 and 7778, please make sure to enter the port numbers in the port section in config-user.properties and peers-config_mijinnet.json which are listed later on.

Create mijin Account

// log-in to each server as below,
$ ssh root@host
// create account
$ adduser mijin
// set password
$ passwd mijin
* enter the same password twice

Install Necessary Softwares (Java8, Screen)

// install 'Java8' and 'Screen' at 'yum' as below,
$ yum install -y java-1.8.0
$ yum install -y screen

Set-up Port

// set-up for port as below,
// 7778 for 'WebSocket'
// 7895 for 'mijin'
$ systemctl start firewalld.service
$ firewall-cmd --permanent --add-port=7778/tcp
$ firewall-cmd --permanent --add-port=7895/tcp
$ firewall-cmd --reload
$ systemctl enable firewalld.service

Installment and Start on mijin

Followings are the steps to install mijin.

  1. Edit config-user.properties
  2. Edit peers-config_mijinnet.json
  3. Upload files on the server
  4. Start mijin
  5. Check the start on mijin
  6. Delete files

Above will need to be done for each server.
The followings are the steps.

1. Edit config-user.properties

It is a setting file for each nodes. The followings are the necessary steps for a start. Make sure to prepare the number of servers which will be running as nodes.

nem.host: host of node (around line #19)

Enter the host of the server that will be setted up as a node.

// Example:
nem.host = 52.242.27.206

nis.bootName: name of node (around line #46)

Enter the node name (voluntary name is fine).

// Example:
nis.bootName = mijin01

nis.bootKey: bootKey of node (around line #45)

Enter the Private Key of the account that will be setted up as a node. Nodes will be set with individual account configration, and then start. Make sure to use one of the harvest account entered in nemesis-accounts.txt.

// Example:
nis.bootKey = 7616b36c518b2bc0454821qqc4a94887112f3a6fb7564a58abbe87c8aca7032c

nis.additionalLocallps: Limit the usage of API that broadcast the Private Key information (around line #101)

The host IP address will limit the usage of API that broadcast the Private Key information. If, it is needed to unlock the usage limit (enable to access from any IP address), please set through the wild card as following.

// Example:
nis.additionalLocalIps = *.*.*.*

2. Edit peers-confg_mijinnet.json

Setting file is needed in order to have a direct connection between the nods. The number of nodes which will be broadcasting each other will need to be entered.

  • host ... enter 'nem.host' and 'host'
  • name ... enter the same node name as 'nis.bootName'
  • public-key ... enter the paired Public Key as 'nis.bootKey'
{
  "_info": "this file contains a list of all trusted peers and can be shared",
  "knownPeers": [
    {
      "endpoint": {
        "host": "27.133.152.53",
        "port": 7895,
        "protocol": "http"
      },
      "identity": {
        "name": "mijin01",
        "public-key": "c48850b863c2fe13066a8aed308da9b4d897e62ef8d81ae5bc04ff85bfb31a74"
      }
    }
    {
      "endpoint": {
        "host": "59.106.214.132",
        "port": 7895,
        "protocol": "http"
      },
      "identity": {
        "name": "mijin02",
        "public-key": "029111bc1c9903f094d207cfb55e97733e7e2a0044b1869a28f3e4705219b777"
      }
    }
  ]
}

3. Upload File onto Server

Including the files which have been set in above, the following files will need to be placed under /home/mijin/

  • serverjars.tgz
  • nemesis-mijinnet.bin
  • config-user.properties
  • peers-config_mijinnet.json
  • startnem.sh

With the following SCP command, upload the set of files.

$ scp -P 22 ./* mijin@host:/home/mijin/

4. Start mijin

Log-in to the server with the created mijin account. Unzipthe file, and set the 'cron tab'. The 'cron tab' is in order to enable the automatic start-up for mijin when re-starting the server.

// grant on perfomance authority
$ chmod +x startnem.sh

// unzip file
$ tar zxvf serverjars.tgz

// set-up for 'cron tab'
$ echo "@reboot screen -S mijin -d -m /home/mijin/startnem.sh" | sort - | uniq - | crontab -

// check on 'cron tab'
$ crontab -l

Start mijin as the following.

$ screen -S mijin -d -m /home/mijin/startnem.sh

After the start, the following files and folders will be issued.

  • gc.txt
  • nem folder ... a log file and a H2DB file will be created.

5. Check on Start of mijin

Let's check the condition of the mijin after the start.

/heartbeat

/status

Via command explained below, the operating condition of the nodes can be checked even by calling mijin API.
It can be also checked by shaping the returned JSON by using the JQ command.
https://stedolan.github.io/jq/

// check on the operating condition on nodes
$ curl http://host:7895/status

// perth JSON by using JQ
$ curl http://host:7895/status | jq .

6. Delete Files

Once the start for node has been checked, the following files will need to be deleted. Make sure to back up the files to the local environtment before deleting the each files.

  • config-user.properties
  • serverjars.tgz
  • nemesis-mijinnet.bin

config-user.properties contains the Private Key for the node. By deleting the config-user.properties, this protect the account information even though there is a false log-in to the node.

If, there is a need to change the node setting, please reboot the mijin after re-uploading the backed-up config-user.properties from the local environment.

For Higher Security

To Change Initial Account

In order to avoid letting the third party, including Tech Bureau, to know the account being set for each nodes, it may be bothering a little bit, but the followings steps are required as a safe environment. Convert it into a Private blockchain which is managed by a corporate by sending XEM to a separate account from 'Change Running Account of Node and Initial Account' while mijin is running.

The following is the overall process.

  1. create a new account
  2. send all XEM owned by the initial account to the new account
  3. suspend the node, and change the account that sent the XEM into a starting account, then reboot mijin
  4. leave the running nodes with the initial account, and switch rest of the nodes into a new account
  5. wait for a day for the 'importance' to be reflected on the new account
  6. once the 'importance' has been reflected to the new account, switch the initial account of the node into a new account

1. Generating Account

Please issue the account from the host of the running node from below. Account can be issued more than one, however, the information on the account address, the Public Key, and the Private Key will not be recorded on mijin once it is issued. So please take a note on the account information.

/account/generate

2. Checking Owning XEM on Initial Account

Here is to check how much XEN is owned by the initial account (the account apart from the one which is used for mijin that is running).

/account/mosaic/owned

3. Send XEM from Initial Account to New Account

After figuring out how much XEM is owned, it is time to send the XEM to the new account.

/transaction/announce

4. Check Transaction Record on Blockchain

Let's check that the XEM has been sent to the account, as well as check there is no balance in the initial account.

/account/mosaic/owned

5. Edit config-user.properties

Followings are the editting sections.

// around line #45
// enter the Private Key of the account that sent the XEM nis.bootKey = 56f3366cce8c643cbfbd4884ad9ed231e58915e64998ed667edcaf2ad05816cd

6. Edit peers-config_mijinnet.json

Download the file from the running node, and enter the Public Key of the account that has been set for nis.bootKey to the public-key of the changing node.

{
	"_info": "this file contains a list of all trusted peers and can be shared",
	"knownPeers": [
		{
			"endpoint": {
				"host": "27.133.131.154",
				"port": 7895,
				"protocol": "http"
			},
			"identity": {
				"name": "mijin01",
				"public-key": "442159366e13c9b899e53d4f0b64e6139910a6679fc30d6941e234de13f587e5"
			}
		}
		{
			"endpoint": {
				"host": "27.133.154.6",
				"port": 7895,
				"protocol": "http"
			},
			"identity": {
				"name": "mijin02",
				"public-key": "f7321ebe78dc09dac511893984ac1e194dfcffa3c3c3224192156ee94c304780"
			}
		}
		.
		.
		.
	]
}
					

7. Upload the Files and Reboot mijin

Upload the following editted files and the nemesis-mijinnet.bin file to the node which will be changing the account, and then reboot the mijin.

  • peers-config_mijinnet.json
  • config-user.properties
  • nemesis-mijinnet.bin

Following is the method to reboot.

// acquire the process of Java
$ ps aux | grep java

root 14925 2.0 82.3 8315404 837156 pts/2 Sl+ 18:20 4:53 java -Xms6G -Xmx6G -XX:+PrintGC -XX:+PrintGCDateStamps -Xloggc:./gc.txt -cp .:./serverjars/* org.nem.deploy.CommonStarter
root 15227 0.0 0.0 9032 660 pts/0 S+ 22:20 0:00 grep --color=auto java
in case of above, 14925 is suitable

// select the process number and suspend
$ kill -9 Process Number

// reboot mijin
$ screen -S mijin -d -m /home/mijin/startnem.sh

8. Check on mijin's Start

Check the condition on the mijin once it starts. Sometimes it may take a while (for few minutes) to re-start due to making a record on the memory to an activated address once it scans the retainling hashed database.

/heartbeat

/status

9. Delete Files

Create a back-up for the following files and delete them from the node on the running mijin.

  • config-user.properties
  • nemesis-mijinnet.bin

10. Same Process Method for other Nodes

Repeat the method from #1 to #9shown above for rest of each nodes (make sure to leave one of the nodes as an initial running account).

11. Check the 'importances' on the Account being Set

Here it is to check the importances (the authority to connect the blockchains) of the newly setted account. It will take a day to have the importances to be reflects after sending the XEM to the new account.

/account/importances

12. Transfer Rest of the Nodes to a New Account

When the 'isSet' is stated as '1' in the 'importance' of the newly setted account, switch the rest of the nodes into a new account. The method is as same as above.

Send the balance of XEM to other Accounts from the Initial Account

For the initial account that still has the balance of XEM, send all the balance to other account and make sure that there are no balance of XEM in the initial account. This will avoid a false use of the account.

  • Remove all the balace of XEM in the initial account
  • Check whether the transaction process has been successfully done after the switch of the account.

The following is the method.

1. Generate Receiver's Account

/account/generate

2. Check Balance of Sender's XEM

Here is to check the balance of XEM in the sender's account.

/account/mosaic/owned

3. Send XEM to Created Account

/transaction/announce

4. Check Balance of XEM on Account

Check the balance of the XEM in the account to see that it has been successfully sent.

/account/mosaic/owned

When the process above is completed, the XEM will disappear from the account of nemesis-accounts.txt which had been provided from Tech Bureau. The initial account will become just an account which cannot generate a transaction.

Adding Nodes

Use the same step and methods as when initially runned the mijin, to start the mijin. Enter the new information of the nodes that are going to be added to peers-config_mijinnet.json, as well as the information of the node which as initially recorded. It is unnecessary to change the peers-config_mijinnet.json of the nodes that are already running. The nodes will recognize each other, and the new nodes will be added to the nodes that are already in running.

Method to Add Nodes

i) Prepare the server, and place the following necessary files under the running mijin

  • config-user.properties … setting files for each nodes per unit
  • nemesis-mijinnet.bin … setting file for master account
  • peers-config_mijinnet.json … setting file to connect nodes
  • serverjars.tgz … file for mijin
  • startnem.sh … file to strat mijin

ii) Enter the following to 'config-user.properties'

  • the Private Key of the account that is used to set the node
  • the host of the node itself
  • name for each nodes (if needed)

iii) Enter the following to 'peers-config_mijinnet.json'

  • the host of the user's node and the Public Key of the running account
  • opponent's (even just 1 is fine) host and the Public Key of the running account

iv) Start mijin

For example, if there are three nodes already connected to each other and there is a node that needs to be added, add the host of node itself (the one is being added) and the host of the opponent (just one of the nodes out of three current ones) to peers-config_mijinnet.json, the nodes will broadcast with each other and recognize the newly added one between the nodes.


Revision History

  • 2017年12月6日:第3版(よりセキュアに使うためにの手順変更)
  • 2017年8月2日:第2版
  • 2017年8月1日:初版

Response

Response from mijin will be shown below.