Node control
Last updated
Last updated
Now that we have obtained the knowledge on how to initialize our main IOTA repository object, we can explore what are we able to do with the node that we are connected to.
The first thing we can do is to fetch node info by calling the method GetNodeInfo as follows:
As we can see, the method returns quite a lot of information about the node that we are currently connected to. One of the things to pay attention to here is the LatestMilestoneIndex and the LatestSolidSubtangleMilestoneIndex numbers. If both numbers are equal, it means that the node is currently in sync with the network.
WARNING: The next set of methods are by default blocked by the nodes. The only way to access them is from localhost.
Another method we can call is GetNeighbors which will return the list of IRI neighbors:
We can also add neighbors to the node by calling AddNeighbors method:
We're also able to remove them by calling RemoveNeighbors method: