# Understanding Iroh Presets: Empty, Minimal, N0, and N0DisableRelay Explained

> Explore Iroh presets like Empty, Minimal, N0, and N0DisableRelay. Learn how to configure cryptographic providers, lookup services, and relay modes for your specific networking needs.

- Repository: [number zero/iroh](https://github.com/n0-computer/iroh)
- Tags: deep-dive
- Published: 2026-07-05

---

**Iroh provides four endpoint presets—`Empty`, `Minimal`, `N0`, and `N0DisableRelay`—that pre-configure cryptographic providers, address lookup services, and relay modes to match different networking requirements.**

The `n0-computer/iroh` repository ships these **iroh presets** in [`iroh/src/endpoint/presets.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs) to simplify `Endpoint` initialization. Each preset implements the `endpoint::presets::Preset` trait and applies specific configurations to the `Endpoint` builder, ranging from completely manual setup to production-ready defaults with relay connectivity.

## Available Iroh Presets

Iroh defines four distinct presets that serve different configuration needs. All presets are located in [`iroh/src/endpoint/presets.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs) and implement the `Preset` trait's `apply` method to modify the `Endpoint` builder state.

| Preset | Location | Configuration Level | Best For |
|--------|----------|---------------------|----------|
| `Empty` | [Line 37](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs#L37) | No defaults | Full manual control |
| `Minimal` | [Line 59](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs#L59) | Crypto provider only | Custom networking stacks |
| `N0` | [Line 112](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs#L112) | Production defaults | General application development |
| `N0DisableRelay` | [Line 174](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs#L174) | N0 without relays | Direct peer-to-peer only |

**Note:** The `Minimal`, `N0`, and `N0DisableRelay` presets require a crypto-provider feature flag (`tls-ring` or `tls-aws-lc-rs`) to be available at compile time.

## Detailed Preset Breakdown

### Empty Preset

The `Empty` preset, defined at line 37 in [`presets.rs`](https://github.com/n0-computer/iroh/blob/main/presets.rs), performs no configuration on the builder. It leaves all mandatory fields unset, including the **crypto provider**, which is required for `bind()` to succeed.

Use `Empty` when you need absolute control over every `Endpoint` parameter. This preset requires you to manually set the crypto provider and all other options before calling `bind()`.

### Minimal Preset

The `Minimal` preset (line 59) configures only the mandatory **crypto provider** (`rustls` with `ring` or `aws-lc-rs` depending on enabled features). It provides the smallest viable configuration for a functional endpoint.

Choose `Minimal` when you want a working cryptographic foundation but need to customize address lookup mechanisms, relay modes, or transport configurations separately.

### N0 Preset

The `N0` preset (line 112) is the **recommended default** for most applications. It applies `Minimal` configurations plus:

- **Default address lookup service**: Registers `PkarrPublisher` and `DnsAddressLookup` pointing to `iroh.link`
- **Default relay mode**: Configures production relay servers (switched to staging in test environments)

Use `N0` when you want out-of-the-box connectivity through Number 0's public relay infrastructure and DNS-based address resolution.

### N0DisableRelay Preset

The `N0DisableRelay` preset (line 174) applies all `N0` configurations but forces `RelayMode::Disabled`. This gives you the full N0 defaults—crypto provider and address lookup—without relay functionality.

Select this preset when you require direct peer-to-peer connections only, run your own relay infrastructure, or operate in environments where relay connections are restricted.

## Practical Code Examples

### Building with the N0 Preset

The standard approach for most applications uses the `N0` preset for immediate connectivity:

```rust
use iroh::{Endpoint, endpoint::presets};

let ep = Endpoint::builder(presets::N0).bind().await?;

```

This provides the crypto provider, address lookup service, and production relay list in a single call.

### Disabling Relays with N0DisableRelay

For direct connections without relay fallback:

```rust
use iroh::{Endpoint, endpoint::presets};

let ep = Endpoint::builder(presets::N0DisableRelay).bind().await?;

```

### Customizing the Minimal Preset

Start with `Minimal` and add specific configurations:

```rust
use iroh::{Endpoint, endpoint::presets};

let mut builder = Endpoint::builder(presets::Minimal);
// Add custom address lookup, relay mode, or transport settings
let ep = builder.bind().await?;

```

### Manual Configuration with Empty

For complete control, start from `Empty` and set all options manually:

```rust
use iroh::{Endpoint, endpoint::presets};

let mut builder = Endpoint::builder(presets::Empty);
builder = builder.crypto_provider(my_provider);
// Configure remaining options...
let ep = builder.bind().await?;

```

## Key Implementation Files

Understanding the source structure helps when customizing presets:

- **[`iroh/src/endpoint/presets.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint/presets.rs)**: Defines the `Preset` trait and all four preset implementations with their specific `apply` methods.
- **[`iroh/src/endpoint.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/endpoint.rs)**: Contains the `Endpoint::builder` entry point and `Builder` type that accepts preset configurations.
- **[`iroh/src/address_lookup.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/address_lookup.rs)**: Implements `PkarrPublisher` and `DnsAddressLookup` services used by the `N0` presets.

## Summary

- **`N0`** provides production-ready defaults with crypto, DNS lookup, and relays—ideal for most applications.
- **`N0DisableRelay`** offers the same configuration without relay functionality for direct peer-to-peer scenarios.
- **`Minimal`** supplies only the crypto provider, serving as a foundation for custom networking stacks.
- **`Empty`** gives you complete manual control but requires setting all mandatory fields including the crypto provider.
- All presets except `Empty` require `tls-ring` or `tls-aws-lc-rs` feature flags to compile.

## Frequently Asked Questions

### What is the difference between Minimal and N0 presets?

The `Minimal` preset configures only the cryptographic provider, leaving address lookup and relay mode unset. The `N0` preset extends `Minimal` by adding the default DNS-based address lookup service (`PkarrPublisher` + `DnsAddressLookup`) and configuring production relay servers. Use `Minimal` when building custom networking configurations and `N0` for standard production deployments.

### When should I use the Empty preset instead of Minimal?

Use `Empty` when you need to configure the cryptographic provider manually or want to ensure no default settings are applied. Unlike `Minimal`, which automatically selects `ring` or `aws-lc-rs` based on feature flags, `Empty` leaves the builder in a blank state. This is useful for testing experimental crypto providers or when you need explicit control over every configuration parameter.

### How do I disable relays while keeping other N0 defaults?

Use the `N0DisableRelay` preset, which applies all `N0` configurations—including the crypto provider and address lookup—but sets `RelayMode::Disabled`. This is preferable to manually configuring `N0` and then overriding the relay mode, as it ensures consistency with the preset's intended behavior.

### Are iroh presets available without crypto provider features?

No. The `Minimal`, `N0`, and `N0DisableRelay` presets are conditionally compiled and only available when you enable either the `tls-ring` or `tls-aws-lc-rs` feature flags. The `Empty` preset is always available since it performs no configuration and has no crypto provider dependencies.