You can see the examples in the examples directory and try them with:

cargo run --example # lists the available examples
cargo run --example transfer # execute the `transfer` example

Backup and restore example

Create an account manager and set an password:

fn main() {
let mut manager = AccountManager::builder().finish().await.unwrap();

manager.store_mnemonic(SignerType::Stronghold, None).await.unwrap();


Create your account:

fn main() {
let client_options = ClientOptionsBuilder::new()
let account_handle = manager
let id = account_handle.id().await;


Now you can secure your account in a backup file:

fn main() {
// backup the stored accounts to ./backup/${backup_name}
let backup_path = manager.backup("./backup").await?;


You can import the backup later or by another application like here:

fn main() {
manager.import_accounts(backup_path, "password").await?;

let imported_account_handle = manager.get_account(&id).await?;

let account = account_handle.read().await;
let imported_account = imported_account_handle.read().await;


That's it! Now you know, how do backup and restore your account!

See the full example here