Although there are very good tutorials on the Internet explaining how to set up a node, I missed a tutorial covering every aspect of the installation, configuration and monitoring of the node.
This tutorial is for Ubuntu, it should work in other Unix-like operating systems as well with some modifications.
Requirements :
- a fixed IP
- a list of peer nodes to connect to (at least one)
Notes:
$
means commands typed in the command line
-
Update your system
$ sudo apt-get -y update
-
Install wget package
$ sudo apt-get -y install wget
-
Install JDK v8 in your server https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
Instructions provided to install the pre-compiled version of the node, you can compile it as well
- Create a directory to install the node
$ mkdir -p /opt/iota && cd /opt/iota
- Download in that directory the testnet version of the compiled executable Java library
$ wget -O iri-testnet-1-4-0.jar https://github.com/iotaledger/iri/releases/download/v1.4.0-testnet/iri-1.4.0.jar
- Create a configuration file in the same directory
$ touch iota.ini
- My current configuration (i.e. the content of iota.ini) is:
[IRI]
PORT = 14700
UDP_RECEIVER_PORT = 14600
TCP_RECEIVER_PORT = 14265
NEIGHBORS = tcp://xx.xx.xx.xx:yyyyy udp://xx.xx.xx.xx:yyyyy udp://myhost.net:yyyyy tcp://anotherhost.net:15666
IXI_DIR = ixi
HEADLESS = true
DEBUG = true
TESTNET = true
DB_PATH = db
- Some comments: do not forget to add TESTNET = true; NEIGHBORS is a list of 7-9 nodes, don't make it any longer; go to the IOTA Slack to find neighbors for testnet
- Create a service file
$ sudo touch /etc/systemd/system/iota.service
- Write this into the service file just created
Description=IOTA node
After=network.target
[Service]
WorkingDirectory=/opt/iota
ExecStart=/usr/bin/java -Xmx4g -Xms246m -jar iri-testnet-1.4.0.jar -c iota.ini --remote-limit-api "removeNeighbors, addNeighbors" --remote
ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure
[Install]
WantedBy=multi-user.target
Alias=iota.service
-
You have several interesting options here: -Xmx4g -Xms246m is the max/min RAM memory allocated to the node application; -c iota.ini points to the configuration file created above; --remote-limit-api serves to limit API calls to the node, which in this case are the sensitive add/remove neighbors operations.
-
Launch the service
$ systemctl daemon-reload && systemctl restart iota
-
Ensure the service works file
$ systemctl status iota
-
Check the node works fine
$ curl http://localhost:14700 -X POST -H 'Content-Type: application/json' -d '{"command": "getNodeInfo"}' | python -m json.tool
(you get a JSON with lots of node parameters).
I have installed the monitoring tool in my laptop, but you could do it in your server as well. Follow the instructions in https://github.com/akashgoswami/ipm (link copied below):
-
Install the NPM package
$ npm i -g iota-pm
-
Create a directory
$ mkdir iota-node-monitor && cd mkdir iota-node-monitor
-
For simplicity, add a start script
$ echo 'iota-pm --iri http://YOUR_NODE_IP:14700 -p 127.0.0.1:8888 ' >> node-monitor.sh && chmod +x node-monitor.sh
-
Execute the script
$ source node-monitor.sh
and connect to http://127.0.0.1:8888/ to see how your node behaves real time :)
-
IOTA IRI Github https://github.com/iotaledger/iri
-
IOTA for Industrial IoT – IOTA node setup and implementation; this is where most of this tutorial comes from, kudos for the author. https://www.simform.com/iota-iiot-tutorial-part-2/
-
IOTA node peer manager, nice job too: https://github.com/akashgoswami/ipm
Dang. Ya know I was just thinking about this. Why even bother with testnet? At GetLoci.com when we added the Bitcoin support we needed it because Bitcoin has fees. But with IOTA since there are no fees and since having extra nodes for testing consumes resources it makes more sense to just partition your address space into development, test, and production. Given that one can test with very small amounts that have very little value this is a cheaper total cost solution for developing with IOTA that you don't have with other cryptos.