How to get started using the Rust API



I’m trying to get started writing applications for the SAFE Network in Rust.

I’ve tried finding a minimal standalone example or tutorial somewhere to get me started, but I haven’t been able to find anything. It seems like pretty much all information about using the APIs are about how to create a web browser application in one way or another.

After playing around and trying to get things to work for a while I found the file:

That file seems to have everything I need, but I’ve run into an issue with it.

The issue is that when I try to use the Authenticator::login() function, I get the following errors:

error: cannot find macro `wait_for_response!` in this scope
   --> C:\Users\Lukas\.cargo\registry\src\\safe_authenticator-0.8.0\src\
188 |             .and_then(|_| wait_for_response!(routing_rx, Response::PutMData, msg_id))
    |                           ^^^^^^^^^^^^^^^^^

error: cannot find macro `wait_for_response!` in this scope
   --> C:\Users\Lukas\.cargo\registry\src\\safe_authenticator-0.8.0\src\
310 |                 .and_then(|_| wait_for_response!(routing_rx, Response::GetMDataValue, msg_id))
    |                               ^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: Could not compile `safe_authenticator`.

Here is the minimal that produces the error:

extern crate safe_authenticator;
use safe_authenticator::Authenticator;

fn main() {
    let secret = "2hGBu03klEttptnzTvFYm";
    let password = "e5f0FT0Zu12f0azeu60n8";

    Authenticator::login(secret, password, || ());

And are the dependencies:

safe_authenticator = "0.8.0"

Does anyone have any idea how I can solve this issue?



Hi @lukas! Thanks for your interest in building Rust apps for SAFE :slight_smile:

The API package you need to use is safe_app:

Unfortunately there’s no extensive tutorials on Rust API usage just yet, but actually the most complicated part about it is the initialisation and the entry point. You need to send a request to the Authenticator and obtain app keys to be able to communicate with the SAFE Network (even with its mock version). After that, the API stays similar to what you can find in NodeJS: it’s all about Mutable Data, Immutable Data, and so forth (just with a more idiomatic feeling).

Give us some time and in the following post I or @marcin will show you a minimal Rust example that establishes a connection with the Network.


Thank you for the overview! I’ll be looking forward to the minimal Rust example! :smiley:


Been trying to get something to work the past couple of weeks.

This is what I have so far:

extern crate safe_app;

use safe_app::{

use std::collections::{

fn main() {
    let app = AppExchangeInfo {
        id: "".to_string(),
        scope: None,
        name: "safe_test".to_string(),
        vendor: "My Company".to_string(),

    let mut permissions: BTreeSet<Permission> = BTreeSet::new();

    let mut containers: HashMap<String, BTreeSet<Permission>> = HashMap::new();

    let auth_req = AuthReq {
        app_container: false,

    let ipc_req = IpcReq::Auth(auth_req);

    let ipc_msg = IpcMsg::Req {
        req_id: ipc::gen_req_id(),
        req: ipc_req,

At this point I think I need to get access to the authenticator somehow so I can send this message I’ve created to it.

I’ve been unable to find somewhere in the API where I can send this message. Does anyone know where I can send it?


Me too! I would love to see a Rust getting started tutorial that authenticates then creates and updates mutable data.


I’d also like to have an official getting started rust documentation if it’s possibly by now