Tenzro
Tutorial — Getting started

Rust SDK quickstart

Install tenzro-sdk, open a TenzroClient against the public testnet, and read a balance and block height. About ten minutes from zero to a working call.
Level
Beginner
Time
~10 min
Prerequisites
Rust 1.85+, cargo
Stack
Rust
01

Add the SDK to your project

Create a new binary crate and pull in the Tenzro SDK along with tokio.

cargo new tenzro-hello && cd tenzro-hello
cargo add tenzro-sdk
cargo add tokio --features full
02

Open a TenzroClient against the testnet

The testnet JSON-RPC endpoint is served at rpc.tenzro.network. No API key.

use tenzro_sdk::TenzroClient;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = TenzroClient::new("https://rpc.tenzro.network").await?;
    let height = client.block_number().await?;
    println!("block height: {height}");
    Ok(())
}
03

Read a TNZO balance

Balances are returned in base units (18 decimals).

use tenzro_sdk::types::Address;

let addr = Address::from_hex("0x7a4bcb13a6b2b384c284b5caa6e5ef3126527f93")?;
let balance = client.get_balance(addr).await?;
println!("{addr:?} = {balance} TNZO base units");
04

Fund the address from the faucet

The testnet faucet drips 100 TNZO with a 24-hour cooldown per address.

curl -X POST https://api.tenzro.network/faucet \
  -H 'content-type: application/json' \
  -d '{"address":"0x7a4bcb13a6b2b384c284b5caa6e5ef3126527f93"}'
Related
← All tutorials