Skip to content

The Core Component holding all the logic to send Data to the IOTA-Tangle over Streams

License

Notifications You must be signed in to change notification settings

iot2tangle/streams-gateway-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streams-Gateway-Core

Introdution

This is the Core Repository for the iot2tangle Gateways. It provides the base API to open Channels and publish signed data to the Tangle.

To learn more about IOTA-Streams clicke here

To look at example implementations we have two Gateways, for HTTP and MQTT, already deployed with the Streams-Gateway-Core.

Usage

To interact with Library import it as a dependency by adding it to the Cargo.toml file:
gateway_core = { git = "https://github.com/iot2tangle/streams-gateway-core", branch="master"}

You can then import the library into your project with:
extern crate gateway_core;

API

To Create a new channel use:
Channel::new(node: String, send_opt: SendTrytesOptions, seed_option: Option<String>);

  • node is: the url of an IOTA Node
  • send_opt: are options used by the IOTA Client when sending Transaction
  • seed_option: Can be None to generate a new Seed or Some(seed) to use an existing seed

To Open the channel and get its address:
let address: String = channel.open().unwrap();
This will open the Channel by generating the channel address and publishing the signature keys
This address will be needed to read the data from the Tangle


To Send signed data over the Tangle by writing to the channel:
write_signed<T>(&mut self, data: T) -> Result<String>

  • The type T needs to have the serde::Serialize trait

If the transaction is succesfully sent the Identifier of the transaction will be returned.

Example

To run the provided example:
cargo run --example test
This will send a "Hello World" message to the Tangle!

Note

The Underlying libraries are not compatible for 32Bit Processors and Operating systems.

About

The Core Component holding all the logic to send Data to the IOTA-Tangle over Streams

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages