Initialize IOTA repository
Last updated
Last updated
First, we need to initialize our main repository object. We can do that by typing:
Easy, right? Now we have our repository object that is going to take care of all the communication between us and the IRI.
If you are connected to a known IRI and you are sure that the node is stable for most cases, connecting like this is just fine. But sometimes there are cases where you need to have a fall back mechanism in case the node you are connected to fails, goes offline or is not in sync with the rest of the network. A solution can be carried out as follows:
As you can see in the above picture, we have a list of IRIs instead of just a single one. In case a node times out (5 seconds by default) or is unresponsive, it will automatically try to connect to the next node. The behavior is similar to a circuit breaker.