To communicate with the IOTA network, you have to connect and interact with a node, the task that the iota.rs library is designed to simplify. It will generate addresses for you, send messages, sign and send transactions, and more.
Beyond establishing the initial connection to a node, iota.rs has no state. Operations use only the data that you pass during a call and have no effect on your software beyond returning a value. You are in full control of the data flow in your application.
This stateless approach makes iota.rs easier for you to use and understand. But since you are in full control of the data management, you also fully responsible for it, which could feel overwhelming if you have to handle complex or sensitive data. If you plan on managing funds in your application, take a look at our wallet.rs library instead. It allows you to safely manage your user's funds, and it already includes our best security practices. It uses stronghold.rs to store sensitive data and iota.rs to communicate with the IOTA network. Unlike iota.rs, it has a state.
Your Application In the IOTA Network
Your application communicates with iota.rs either directly in Rust or through one of the language bindings. The iota.rs library turns your requests into REST API calls and sends them to a node through the Internet. The node, in turn, interacts with the rest of an IOTA network, which could be the main operational network (mainnet) or a network for testing purposes (devnet).
Different nodes could run on a different software, but they always expose the same interface to clients. For example, one node could be a Hornet node and the other could be a Bee node, and they both would appear the same for any client.
The iota.rs library exposes operations of two types. Clients interact with nodes by calling their REST API, and the first group of operations mirrors the available calls. When your program invokes such an operation, it directly translates it into a REST call to a node. For a full list, see the node's REST API reference.
Operations from the first group tend to be too atomic and basic to use them in a convenient way. The second group provides you with higher-level helper functions. These functions represent an actual task and combine multiple basic operations internally. For example, you can get your token balance by calling
getBalance. It first calls
getAddresses, then it calls
getAddressBalances for each address, and adds the results together to return the total balance. See the full specification for details.