IOTA IRI is the reference implementation of IOTA nodes. There are some pain about IOTA documentation on the GitHub, after some explore, I note the step for others to reduce the pain of install and running IOTA iri in full node.
0x1 Installation of IRI on Arch Linux
On Arch Linux, there have a aur/iri, so it is quite simple to install iri and deal with the dependency:
1 |
$ yaourt –S iri |
If you are not Arch, you may build iri
from scratch (this requrie you to install marven
first):
1 2 3 4 5 |
$ git clone https://github.com/iotaledger/iri $ cd iri $ mvn clean compile $ mvn package $ |
After install, you can test iri
by typing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ iri 10/22 22:00:34.705 [main] INFO com.iota.iri.IRI – Welcome to IRI 1.4.0 10/22 22:00:37.614 [main] INFO c.i.i.s.r.RocksDBPersistenceProvider – Initializing Database Backend... 10/22 22:00:37.649 [main] INFO c.i.i.s.r.RocksDBPersistenceProvider – RocksDB persistence provider initialized. 10/22 22:00:37.673 [main] INFO com.iota.iri.network.UDPReceiver – UDP replicator is accepting connections on udp port 14600 10/22 22:00:37.673 [UDP receiving thread] INFO com.iota.iri.network.UDPReceiver – Spawning Receiver Thread 10/22 22:00:37.673 [UDP receiving thread] INFO com.iota.iri.network.UDPReceiver – Receiver thread processed/dropped ratio: 0/0 10/22 22:00:37.674 [main] INFO c.i.i.network.replicator.Replicator – Started ReplicatorSourcePool 10/22 22:00:37.675 [Thread–2] INFO c.i.i.n.r.ReplicatorSourcePool – TCP replicator is accepting connections on tcp port 15600 10/22 22:00:37.694 [pool–2–thread–1] INFO com.iota.iri.network.Node – Spawning Broadcaster Thread 10/22 22:00:37.694 [pool–2–thread–2] INFO com.iota.iri.network.Node – Spawning Tips Requester Thread 10/22 22:00:37.695 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 0 , toReply = 0 / totalTransactions = 0 10/22 22:00:37.696 [pool–2–thread–3] INFO com.iota.iri.network.Node – Spawning Neighbor DNS Refresher Thread 10/22 22:00:37.696 [pool–2–thread–3] INFO com.iota.iri.network.Node – Checking Neighbors‘ Ip... ^C $ |
0x2 Add iri config file
We will put the configure under /etc
, so please write then following content into /etc/iri.ini
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[IRI] PORT = 14665 UDP_RECEIVER_PORT = 19775 TCP_RECEIVER_PORT = 18750 NEIGHBORS = tcp://iotanode2.louie.lu:18750 tcp://iotanode2.louie.lu:18750 HEADLESS = true DB_PATH = /var/db/iota/mainnetdb DB_LOG_PATH = /var/db/iota/mainnetdb.log # If you want to enable remote # please uncomment folowing lines #REMOTE_LIMIT_API=”removeNeighbors, addNeighbors, interruptAttachingToTangle, attachToTangle, getNeighbors” #API_HOST=0.0.0.0 #IRI_OPTIONS = “–remote” |
Here to explain each option:
- PORT: This is a mandatory option that defines the port to be used to send API commands to your node
- UDP_RECEIVER_PORT: This is the port for receiving tx from other nodes via tcp, if you want to give your ip to others, please gave it:
udp://your-ip-or-domain:[UDP_RECEIVER_PORT]
, e.g.udp://iotanode1.louie.lu:19775
- TCP_RECEIVER_PORT: This is the port for receiving tx from other nodes via tcp, if you want to give your ip to others, please gave it:
tcp://your-ip-or-domain:[TCP_RECEIVER_PORT]
, e.g.:tcp://iotanode1.louie.lu:18750
- NEIGHBORS: the most important setting, you will have to add other nodes to make sure you are sync in the tangle. And, neighbors must setup both side so that the connect will be established, if only setup the neighbors yourself, it just won’t works. For how to exchange neighbors, please scroll down to the bottom, I will explain it.
- HEADLESS: run without GUI
- DB_PATH: your database path
- DB_LOG_PATH: your database log path
- REMOTE_LIMIT_API: Exclude certain API calls from being able to be accessed remotely, for full API list, please visit iri API reference
- API_HOST: This will setup your host, if you want to let your node API visible by other, make sure this is
0.0.0.0
, default is localhost - IRI_OPTIONS: Set iri with option
--remote
0x3 Adding systemd service unit
There is no service unit in the aur package, so you must do it your self. The service unit can let you control, manage iri via systemd.
Write the following content into /etc/systemd/system/iri.service
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[Unit] Description=IOTA Reference Implementation After=network.target [Service] Type=simple PrivateDevices=yes SyslogLevel=err ExecStart=/usr/bin/java –jar /usr/lib/iri/iri.jar –c /etc/iri.ini KillSignal=SIGTERM KillMode=mixed [Install] WantedBy=multi–user.target |
0x4 Start the iri servcie
Glad you are here, this is the final step to start our IOTA iri full node.
Now, using the following command to enable and start iri:
1 2 |
$ sudo systemctl enable iri $ sudo systemctl start iri |
After a few seconds, you can use systemctl status iri
to check the status:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$ sudo systemctl status iri ● iri.service – IOTA Reference Implementation Loaded: loaded (/etc/systemd/system/iri.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2017–10–22 21:24:24 CST; 58min ago Main PID: 27668 (java) Tasks: 141 (limit: 4915) CGroup: /system.slice/iri.service └─27668 /usr/bin/java –jar /usr/lib/iri/iri.jar –c /etc/iri.ini Oct 22 22:21:17 nems_nctu_lu java[27668]: 10/22 22:21:17.527 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4262 , toReply = 0 / totalTransactions = 455471 Oct 22 22:21:32 nems_nctu_lu java[27668]: 10/22 22:21:32.527 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4241 , toReply = 0 / totalTransactions = 457636 Oct 22 22:21:42 nems_nctu_lu java[27668]: 10/22 22:21:42.528 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4289 , toReply = 0 / totalTransactions = 459098 Oct 22 22:21:57 nems_nctu_lu java[27668]: 10/22 22:21:57.528 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4239 , toReply = 0 / totalTransactions = 460811 Oct 22 22:22:07 nems_nctu_lu java[27668]: 10/22 22:22:07.529 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 1 , toBroadcast = 0 , toRequest = 4247 , toReply = 1 / totalTransactions = 462348 Oct 22 22:22:22 nems_nctu_lu java[27668]: 10/22 22:22:22.529 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4303 , toReply = 1 / totalTransactions = 464386 Oct 22 22:22:32 nems_nctu_lu java[27668]: 10/22 22:22:32.530 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4271 , toReply = 0 / totalTransactions = 465383 Oct 22 22:22:47 nems_nctu_lu java[27668]: 10/22 22:22:47.530 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4259 , toReply = 1 / totalTransactions = 467793 Oct 22 22:23:02 nems_nctu_lu java[27668]: 10/22 22:23:02.531 [pool–2–thread–2] INFO com.iota.iri.network.Node – toProcess = 0 , toBroadcast = 0 , toRequest = 4313 , toReply = 0 / totalTransactions = 469459 Oct 22 22:23:06 nems_nctu_lu java[27668]: 10/22 22:23:06.004 [pool–5–thread–2] INFO com.iota.iri.network.Node – RecentSeenBytes cache hit/miss ratio: 32965/17035 |
0x5 Check iri status via cURL
There are some API for iri that we can use to check the status or manipulate iri. For example, we can check neighbors status via getNeighbors
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$ curl http://127.0.0.1:14665 \ –X POST \ –H ‘Content-Type: application/json’ \ –H ‘X–IOTA–API–VERSION: 1.4.1.1 –d ‘{“command”: “getNeighbors”}’ | python –m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 526 100 499 100 27 499 27 0:00:01 —:—:— 0:00:01 513k { “neighbors”: [ { “address”: “iotanode1.louie.lu:18750”, “numberOfAllTransactions”: 451732, “numberOfRandomTransactionRequests”: 356, “numberOfNewTransactions”: 83, “numberOfInvalidTransactions”: 0, “numberOfSentTransactions”: 593753, “connectionType”: “tcp” } ], “duration”: 0 } |
Please notice, the port that using with curl is the setting of PORT
, not UDP_RECEIVER_PORT
or TCP_RECEIVER_PORT
.
And, if you didn’t set up with API_HOST
, IRI_OPTIONS
, you will not able to request from other computer or devices to your node.
For how to making a request, please visit Making Requests, for the full API list, please visit API Reference.
0x6 The Neighbors
This is my nodes:
1 2 |
tcp://iotanode1.louie.lu:18750 tcp://iotanode2.louie.lu:18750 |
You can add these nodes, and contact me to add you too.
For others node, you will need to exchange at iota slack , or iota telegram. I think there will be a much better method to deal with in the future.
0x7 Reference
- Running a Headless Node
- Install IRI
- archlinux aur iri
- blackbeam/PKGBUILD
- Configure IOTA (IRI) Full Headless Node on Centos 7
- iotaledger/iri
0x8 Additional
That’s all! Have a nice day!
If you like this post, you can tip here:
- BTC: 3BzwnZ4UrqXx7xPafi7Lb4WuFBNizSfnh5
- ETH: 0x07b0cEEECCd90900B8d4894bCbe2e8A632783F34
- LTC: MNBTs339PLXKdv2U2Z8dpvdLBMsqATkEyR
- LTC(ddeprecated): 3FyKZ9dBSDftqQkZvg9J1HNvrfHP89PJFk
- DASH: XehuTHVnBfF6dqRYQfA9SV9oYyFhrNxiyW
- BTH: 12YGnthT4RSUW6a4WDivDp9rLogGkcpcCP
Leave a Reply