Skip to main content
PlatformArchitectures
iOSdevice and simulator
Androidaarch64, armv7
macOSarm64, x86_64
Linuxx86_64, aarch64, armv7 (glibc and musl)
Windowsx86_64, aarch64
iroh is written in Rust, so the Rust crate is the most fully-featured way to use it. Everything in these docs assumes Rust unless explicitly tagged otherwise.

Install

Add iroh to your project:
cargo add iroh
For tickets, common protocols, and async runtime support you’ll usually want a few more:
cargo add iroh-tickets iroh-ping anyhow
cargo add tokio --features full

Hello, iroh

use anyhow::Result;
use iroh::{Endpoint, endpoint::presets};

#[tokio::main]
async fn main() -> Result<()> {
    let endpoint = Endpoint::bind(presets::N0).await?;
    endpoint.online().await;
    println!("endpoint id: {}", endpoint.id());
    Ok(())
}
This binds an endpoint using the N0 preset (public discovery + default relays), waits until it has a home relay, and prints its 64-character endpoint id. Run it with cargo run.

Next steps

Quickstart

Run two endpoints and watch them ping each other in five minutes.

Connect two endpoints

Build the sender/receiver flow from scratch with tickets and a custom protocol handler.

Rust API docs

Full type and function reference on docs.rs.