This is the official Rust client library, which allows you to do the following: * Create transactions * Sign transactions * Generate addresses * Interact with an IRI node
This is beta software, so there may be performance and stability issues. Please report any issues in our issue tracker.
|Table of contents| |:----| | Prerequisites| | Using the library| | Getting started| | API reference | Examples| | Supporting the project| | Joining the discussion| | License|
To use the library, we recommend update your Rust to latest stable version rustup update stable
. Nightly should be fine but you are expected some changes might not be compatable.
no_std
is not supported currently, but we are working on it in bee, and will provide it as feature once new library implementation is ready.
Using the library is fairly easy, just add it as dependancy in Cargo.toml
:
[dependencies]
iota-lib-rs = "0.3"
After you've installed the library, you can connect to an IRI node to send transactions to it and interact with the ledger.
To connect to a local IRI node, we provide a module Client
:
```js use iotalibrs::prelude::*;
let mut iota = iota_client::Client::new("https://localhost");
println!({:?}, iota.getnodeinfo().unwrap); ```
For details on all available API methods, see the documentation.
```rust use iotaclient::options::SendTransferOptions; use iotalibrs::prelude::*; use iotamodel::Transfer; use iotaconversion::trytesconverter;
fn main() { let trytes = "HELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDD"; let message = trytesconverter::totrytes("Hello World").unwrap(); let transfer = Transfer { address: trytes.tostring(), // Don't need to specify the field // because the field and variable // have the same name message, // Populate the rest of the fields with default values ..Transfer::default() }; let mut api = iotaclient::Client::new("https://node01.iotatoken.nl"); let tx = api .sendtransfers( transfer, &trytes, SendTransferOptions { localpow: true, threads: 2, ..SendTransferOptions::default() }, ) .unwrap(); println!("{:?}", tx); } ```
If you want to get involved in the community, need help with getting setup, have any issues related with the library or just want to discuss IOTA, Distributed Registry Technology (DRT) and IoT with other people, feel free to join our Discord.
The MIT license can be found here.