Skip to content

Commit 98e3f0b

Browse files
committed
add more information
1 parent 9958ae5 commit 98e3f0b

File tree

8 files changed

+572
-38
lines changed

8 files changed

+572
-38
lines changed

about/faq.mdx

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,102 @@
22
title: "FAQ"
33
---
44

5-
Placeholder: Frequently asked questions and answers.
5+
## Does iroh use relay servers?
6+
7+
Iroh uses relay servers to support establishing direct connections, to speed up initial connection times, and to provide a fallback should direct connections between two endpoints fail or be impossible otherwise.
8+
By default iroh is configured with three relay servers run by number 0.
9+
One in the US, one in Europe and one in Asia.
10+
We can afford to run these servers for free, because [hole-punching](https://en.wikipedia.org/wiki/Hole_punching_(networking)) rates with iroh are really high.
11+
Still, to prevent abuse, we rate-limit throughput through our public relays.
12+
13+
14+
## Can relays read the traffic they route?
15+
16+
**No, all connections in iroh are end-to-end encrypted.**
17+
We use QUIC which is based on TLS 1.3.
18+
From the perspective of our QUIC implementation, the relay is "just another UDP socket" for sending encrypted packets around.
19+
Because the relays are relaying traffic, they theoretically know that Endpoint ID X talks to Endpoint ID Y and how many bytes are sent this way, but only for as long as these endpoints haven't established a direct connection yet.
20+
However, we don't record this data on our relays.
21+
22+
23+
## How secure is iroh's end-to-end encryption?
24+
25+
Iroh provides a secure, encrypted, forward and backward-secret, authenticated data channel between you and the recipient and protects you both from eavesdroppers.
26+
This assumes the Endpoint ID you're connecting to was exchanged securely, e.g. via scanning a QR code, sharing a link with the Endpoint ID in an encrypted chat app or using a trusted server and the corresponding secret keys haven't been compromised.
27+
The established connection is a QUIC connection, which together with TLS 1.3 specifies how it's encrypted.
28+
This specification is widely used, for example as part of the latest generation of HTTP, HTTP3.
29+
Instead of PKI-based certificates, at the moment iroh uses self-signed certificates with Endpoint IDs to authenticate both ends of the connection, borrowing [the libp2p handshake specification](https://github.com/libp2p/specs/blob/master/tls/tls.md).
30+
In the future, we plan on switching to the [raw public key TLS certificate type](https://datatracker.ietf.org/doc/html/rfc7250) instead.
31+
To make use of this end-to-end encryption, no additional setup in iroh is required, it is always enabled.
32+
Be aware of security caveats to forward secrecy when using the [opt-in 0-RTT feature](https://docs.rs/iroh/latest/iroh/endpoint/struct.Connecting.html#method.into_0rtt).
33+
34+
35+
## What if number 0 stops running relay servers?
36+
37+
The relay servers we run in production [are open-source](https://github.com/n0-computer/iroh/tree/main/iroh-relay), and we highly encourage you to run your own!
38+
You need a server with a public IP address and a DNS name that points to that IP address.
39+
Automatic TLS setup via [ACME](https://en.wikipedia.org/wiki/Automatic_Certificate_Management_Environment) is built into the iroh-relay code.
40+
Use the configured DNS name to add your relay to the [`RelayMap`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.relay_mode) you configure your iroh endpoint with.
41+
Running a custom relay server doesn't prevent you from connecting to others connected to other relay servers.
42+
43+
44+
## Is establishing a connection without relays or when offline possible?
45+
46+
Yes.
47+
When you share a `EndpointAddr`s with "direct addresses", then iroh will try to use these addresses to establish a connection with or without a relay.
48+
If you're in a local network together you can enable [local network discovery](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.discovery_local_network) to help establish connections in LANs even when the `EndpointAddr` doesn't contain direct addresses.
49+
50+
51+
## How can I control which relay servers iroh connects to?
52+
53+
Iroh will only talk to relay servers that it knows URLs for.
54+
By default iroh is configured with 3 relay servers from the [default `RelayMap`](https://docs.rs/iroh/latest/iroh/defaults/prod/index.html).
55+
If you do not disable the default discovery services or other discovery services, then iroh might connect to relay servers discovered that way.
56+
By changing iroh's relay mode or relay map you can control the home relay the endpoint connects to, and by wrapping or writing your own `Discovery` service, you gain control over the relay URLs iroh can discover.
57+
58+
59+
## What is "Discovery" in iroh and which one should I enable?
60+
61+
For most usage, using the services that are enabled by default in the `iroh::Endpoint::builder` is the best default.
62+
Discovery helps iroh find ways to connect to a specific Endpoint ID.
63+
The Endpoint ID on its own can only be used to identify if you're talking to the right recipient, but doesn't tell how to address the recipient on its own.
64+
Via configured discovery mechanisms, iroh resolves an Endpoint ID to IP addresses and relay URLs that help to actually attempt a connection.
65+
For more information on available discovery mechanisms, take a look at the [discovery module](https://docs.rs/iroh/latest/iroh/discovery/index.html).
66+
It's also possible to combine multiple discovery mechanisms at once, or write your own.
67+
We think it's particularly helpful to write application-specific discovery mechanisms that are tailored to an application's need.
68+
69+
70+
## How is iroh development funded?
71+
72+
The company behind iroh is number 0.
73+
It is partly venture capital and partly founder backed (as in: founders have invested their own money).
74+
Number 0 is healthy and has investors we actually think are a value-add.
75+
We earn revenue from customers today through https://n0.computer/n0ps, and are re-launching an “AWS for iroh protocols” in 2025.
76+
While it will be a service you can pay for, it won’t have special treatment beyond being convenient.
77+
We rely on iroh remaining open source, and are committed to keeping it that way, including server-side code for relays and DNS discovery.
78+
79+
80+
## How do iroh and libp2p compare?
81+
82+
Generally, we've put a lot of effort into making iroh "peer to peer connections that *just work*".
83+
This means we've kept the scope small: There's no DHT, swarm, or gossipsub.
84+
Instead, what you get are reliable direct [QUIC](https://en.wikipedia.org/wiki/QUIC) connections between iroh endpoints.
85+
On top of these, some of said libp2p features can be implemented as *protocols* on top, see for example [iroh-gossip](https://github.com/n0-computer/iroh-gossip/) which provides gossipsub-like functionality.
86+
While there are some features in libp2p like a DHT implementation based on kademlia that don't exist in the iroh ecosystem yet, we believe the features iroh *does* have work better.
87+
The iroh project was founded by developers who were deeply involved with libp2p, and wanted to build a more focused library with less configuration that would be easier to deploy and use with high reliability.
88+
89+
90+
## Is iroh post-quantum-secure?
91+
92+
No.
93+
Iroh uses Ed25519 for signing and X25519/P-256 for ECDH.
94+
These algorithms are not post-quantum-secure.
95+
Adopting the current best post-quantum-secure algorithm, for example Xyber, would incur a very significant network overhead:
96+
A Xyber public key is 37x larger than an Ed25519 public key.
97+
This has implications for connection establishment speed:
98+
For example, the initial handshake for a connection wouldn't fit into a normal UDP packet anymore.
99+
It also means DNS packets used for DNS discovery at the moment might get fragmented, etc.
100+
It would also mean Endpoint IDs would be exactly 37x as big.
101+
To support post-quantum-cryptography, we would need to trade off usability with the risk should a sufficiently powerful quantum computers would become real.
102+
We believe it is much more important to serve existing use cases efficiently, so they have encryption *today*.
103+
We fully believe the work on post-quantum-cryptography is good and important and follow developments closely.

concepts/discovery.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ The following sections describe the format of the Pkarr publishing records and N
9696

9797
## Node discovery via DNS
9898

99-
<img src="/images/dns.gif" alt="DNS Discovery Diagram" class="my-4 rounded-lg border border-gray-200 shadow-md" />
100-
10199
When connecting to an unknown `EndpointId`, the DNS discovery mechanism in iroh will perform a DNS query to discover relays or addresses for the node. The DNS discovery is configured with a *origin domain* (which defaults to *dns.iroh.link*, a server run by n0). iroh will then perform a DNS query through the configured DNS resolver (which defaults to using the host system's nameservers):
102100

103101
`_iroh.<z32-node-id>.<origin-domain> TXT`

concepts/protocols.mdx

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@
22
title: "Protocols"
33
---
44

5-
Assuming we have two endpoints connected, yay! Now we just have to… do something… with that connection. That’s where protocols come in.
6-
7-
## Introduction
5+
Iroh is organized into _protocols_: Composable networking software built on iroh
6+
connections.
87

98
A protocol sets up everything we need to both provide data we have locally when
109
others request it, and ask other endpoints that run the protocol to do whatever
1110
business or application logic we need.
1211

12+
The foundation of iroh is direct connections, which protocols use to extend up
13+
to higher-level functionality. When integrating iroh into an application you can
14+
use protocols to quickly add functionality, or write your own protocol(s) to
15+
maintain total control over how your application communicates.
16+
17+
Iroh is entirely composable and modular. You can run multiple protocols on the
18+
same endpoint, and each protocol can be used independently. This allows you to
19+
only include the protocols you need for your application, keeping connections
20+
lightweight and fast.
21+
22+
## Compare to HTTP
23+
1324
Coming from the world of HTTP client/server models, protocols are similar to
1425
request handlers. However, they go beyond request/response by creating multiple
1526
streams of data and usually include both initiating & accepting protocol
@@ -19,14 +30,45 @@ Peer to peer protocols do not require a client/server distinction, both sides
1930
can initiate and accept connections. However, you can still build client/server
2031
style protocols on top of iroh if you want to.
2132

33+
34+
## ALPN identifiers
35+
36+
Iroh builds on QUIC connections, and uses [application level protocol
37+
negotiation](https://datatracker.ietf.org/doc/html/rfc7301) (ALPN, a widely used
38+
and well specified TLS extension) to run multiple protocols on the same QUIC
39+
endpoint. An ALPN identifier is the string that identifies the protocol and is
40+
used for protocol negotiation between endpoints.
41+
42+
For example, the [iroh-blobs](/proto/iroh-blobs) protocol ALPN is
43+
[`/iroh-bytes/4`](https://github.com/n0-computer/iroh-blobs/blob/124820698cd85691e0d72aeed6e1ac028886b34a/src/protocol.rs#L353).
44+
This makes sure that an endpoint that accepts a connection can gracefully
45+
indicate whether it supports the requested protocol.
46+
47+
You can also use multiple ALPN identifiers when connecting as a way to negotiate e.g.
48+
protocol versions. For example, you would connect using `/iroh-bytes/5` as well
49+
as `/iroh-bytes/4`, and the other side could respond with `/iroh-bytes/4` to
50+
indicating it doesn't have support for `/iroh-bytes/5`.
51+
52+
53+
## The Accept Loop
54+
55+
The accept loop is the main loop of an iroh server. It listens for incoming
56+
connections, and then processes them. The accept loop is the entry point for all
57+
iroh protocols, and is where you can add your own protocol to the iroh stack.
58+
59+
Coming from the world of HTTP servers, the accept loop is similar to the main loop of an HTTP server. The main difference is that the accept loop is more flexible, as it can run multiple protocols on the same endpoint. Normally HTTP servers hide the raw accept loop from you, and instead route to the correct handler based on the URL. In iroh, the accept loop is exposed to you, and you can use it to route to the correct protocol based on the ALPN.
60+
61+
Assuming we have two endpoints connected, yay! Now we just have to… do something… with that connection. That’s where protocols come in.
62+
63+
## Learn more
64+
2265
Protocols are modules you compose together to add functionality to connections.
2366
Protocols exist for file transfer, game server sync, message broadcasting,
2467
document collaboration, all kinds of stuff. You can use off-the-shelf protocols
2568
to quickly add functionality, work directly with QUIC streams & build a fully
2669
custom protocol that does exactly what you want, or fork an existing protocol to
2770
get what you need.
2871

29-
## Learn more
3072
- [iroh-gossip](/connecting/gossip): creating swarms of peers for broadcasting messages on topics.
3173
- [iroh-blobs](/protocols/blobs): storing and transferring large binary blobs of data.
3274
- [iroh-docs](/protocols/docs): collaborative key-value store.

docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
{
4343
"group": "Data Protocols",
4444
"pages": [
45-
"protocols/streaming",
4645
"protocols/kv-crdts",
4746
"protocols/blobs",
4847
"protocols/rpc",
4948
"protocols/automerge",
49+
"protocols/streaming",
5050
"protocols/writing-a-protocol"
5151
]
5252
},

protocols/blobs.mdx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,27 @@
22
title: "Blobs"
33
---
44

5-
Content-addressed blob storage and transfer for iroh. `iroh-blobs` implements
5+
Content-addressed blob storage and transfer. `iroh-blobs` implements
66
request/response and streaming transfers of arbitrary-sized byte blobs, using
77
BLAKE3-verified streams and content-addressed links.
88

9-
The page below is a concise summary of the `iroh-blobs` crate. For complete
10-
API details, examples, and the module reference, see the upstream docs:
11-
https://docs.rs/iroh-blobs/latest/iroh_blobs/
12-
139
## Concepts
1410

1511
- Blob: an opaque sequence of bytes (no embedded metadata).
1612
- Link: a 32-byte BLAKE3 hash that identifies a blob.
1713
- HashSeq: a blob that contains a sequence of links (useful for chunking/trees).
18-
- Provider / Requester: provider serves data; requester fetches it. A node can
19-
be both.
14+
- Provider / Requester: provider serves data; requester fetches it. An endpoint can be both.
2015

2116
## Installation
2217

2318
```
2419
cargo add iroh-blobs
2520
```
2621

27-
- Primary docs and API reference: https://docs.rs/iroh-blobs/latest/iroh_blobs/
28-
- Examples repo: https://github.com/n0-computer/iroh-blobs/tree/main/examples
22+
- [Primary docs and API reference](https://docs.rs/iroh-blobs/latest/iroh_blobs/)
23+
- [Code samples on GitHub](https://github.com/n0-computer/iroh-blobs/tree/main/examples)
2924

30-
## Example
25+
## Examples
3126

3227
The crate is typically used by creating a store, a `BlobsProtocol` handler,
3328
and registering it with an `iroh::Router`. The code below is an illustrative
@@ -74,3 +69,4 @@ async fn main() -> anyhow::Result<()> {
7469
large payloads and transfer the data via the blobs protocol.
7570
- Use HashSeq to represent sequences of blobs (e.g., chunked content).
7671
- Use the downloader utilities to aggregate sources and store results locally.
72+

protocols/kv-crdts.mdx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
title: "Key-value Store"
33
---
44

5-
Multi-dimensional key-value documents with an efficient synchronization protocol.
65

7-
The crate operates on Replicas. A replica contains an unlimited number of
8-
Entries. Each entry is identified by a key, its author, and the replica's
9-
namespace. Its value is the 32-byte BLAKE3 hash of the entry's content data, the
10-
size of this content data, and a timestamp. The content data itself is not
11-
stored or transferred through a replica.
6+
A key-value store for multi-dimensional documents, built on CRDTs, with an
7+
efficient synchronization protocol. `iroh-docs` provides a protocol handler for
8+
the iroh networking stack, enabling storage and synchronization of documents over
9+
peer-to-peer connections.
1210

13-
Range-based set reconciliation is a simple approach to efficiently compute the
14-
union of two sets over a network, based on recursively partitioning the sets and
15-
comparing fingerprints of the partitions to probabilistically detect whether a
16-
partition requires further work.
11+
## When would I use this?
12+
13+
You would use `iroh-docs` when you need a distributed key-value store that can
14+
handle concurrent updates from multiple peers, ensuring eventual consistency
15+
without conflicts. This is particularly useful for collaborative applications,
16+
distributed configuration management, and any scenario where data needs to be
17+
shared and synchronized across multiple devices or users.
1718

18-
The crate exposes a generic storage interface with in-memory and persistent
19-
file-based implementations. The latter makes use of [redb], an embedded
20-
key-value store, and persists the whole store with all replicas to a single
21-
file.
2219

2320
## Installation
2421

2522
```
2623
cargo add iroh-docs
2724
```
2825

29-
See the [iroh-docs API documentation](https://docs.rs/iroh-docs/latest/iroh_docs/) for more details.
26+
- [API documentation](https://docs.rs/iroh-docs/latest/iroh_docs/)
3027

3128
## Example
3229

@@ -67,4 +64,22 @@ async fn main() -> anyhow::Result<()> {
6764
Ok(())
6865
}
6966

70-
```
67+
```
68+
69+
## How it works
70+
71+
The crate operates on Replicas. A replica contains an unlimited number of
72+
Entries. Each entry is identified by a key, its author, and the replica's
73+
namespace. Its value is the 32-byte BLAKE3 hash of the entry's content data, the
74+
size of this content data, and a timestamp. The content data itself is not
75+
stored or transferred through a replica.
76+
77+
Range-based set reconciliation is a simple approach to efficiently compute the
78+
union of two sets over a network, based on recursively partitioning the sets and
79+
comparing fingerprints of the partitions to probabilistically detect whether a
80+
partition requires further work.
81+
82+
The crate exposes a generic storage interface with in-memory and persistent
83+
file-based implementations. The latter makes use of [redb], an embedded
84+
key-value store, and persists the whole store with all replicas to a single
85+
file.

0 commit comments

Comments
 (0)