Skip to main content
Version: IOTA

Connecting to Node(s)

You can access all the features of the iota.rs library using an instance of the Client class. The Client class provides high-level abstraction to all interactions over IOTA network (Tangle). You have to instantiate this class before you start any interactions with the library, or more precisely with the IOTA nodes that power IOTA network.

The library is designed to automatically choose a starting IOTA node based on the network type you would like to participate in: devnet or mainnet.

Password Storage

It is not recommended to store passwords or seeds on a host's environment variables or in the source code in a production setup. Please follow our backup and security recommendations for production use.

bindings/java/examples/java-app/src/main/java/org/iota/client/example/ExampleApp.java
loading...

Output example of the getInfo() function of the Client instance:

The most common ones are:

  • .withNetwork(string): Can be either devnet or mainnet. It instructs the library whether to automatically select devnet nodes or mainnet nodes.
  • .withNode(string): Specify address of actual running IOTA node that should be used to communicate with in the format https://node:port). For example: https://api.lb-0.h.chrysalis-devnet.iota.cafe:443.
  • .withNodePoolUrls(String[]): The library also supports managing a pool of nodes. You can provide a list of nodes and the library manages the access to them automatically by selecting them based on their sync status. If you provide .withNodePoolUrls(String[]), then the library periodically will periodically check whether node is in sync or not by calling .withNodeSyncInterval(float).
  • .withLocalPow(boolean): If .localPow (True) a Proof-of-work will be done locally and not remotely.
  • .withNodeSyncDisabled(): When called, the library will use nodes that are not in sync with network. This parameter is usually useful if you would like to interact with a local test node that is not fully synced. This parameter should not be used in production.