Skip to content

Commit 3eb48b0

Browse files
committed
add info
1 parent 820021e commit 3eb48b0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

concepts/tickets.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,26 @@ They're also very powerful. Tickets combine a piece of info with _dialing inform
1919

2020
In practice this is a _massive_ speed pickup for iroh. When you're given a ticket, you have everything you need to construct a request
2121

22+
## Creating a ticket
23+
24+
A ticket is created from an endpoint address. An endpoint address contains all
25+
the dialing information needed to connect to an iroh endpoint.
26+
27+
```rust
28+
use iroh_tickets::endpoint::EndpointTicket;
29+
let ticket = EndpointTicket::new(endpoint.addr());
30+
println!("Share this ticket to let others connect to your endpoint: {ticket}");
31+
```
32+
2233
## Kinds of Tickets
2334

2435
Currently, there are three kinds of tickets:
2536

2637
| Type | Description | Contents |
2738
| --- | --- | --- |
2839
| `endpoint` | A token for connecting to an iroh endpoint | `Endpoint Address` |
29-
| `blob` | A token for fetching a [blob](/docs/layers/blobs) or [collection](/docs/layers/blobs#collections) | `Hash`, `HashOrCollection`, `Endpoint Address` |
30-
| `document` | A read/write access token to a [document](/proto/iroh-docs), plus an endpoint address | `DocID`, `Read/Write Capability`, `[Endpoint Address]` |
40+
| `blob` | A token for fetching a [blob](/protocol/blobs) | `Hash`, `HashOrCollection`, `Endpoint Address` |
41+
| `document` | A read/write access token to a [document](/protocol/kv-crdt), plus an endpoint address | `DocID`, `Read/Write Capability`, `[Endpoint Address]` |
3142

3243
Tickets always start with an ascii string that describes the type of ticket (eg: `blob`), followed by a base32-lowercase-encoded payload. The payload is [postcard-encoded data](https://postcard.jamesmunns.com/wire-format.html) that contains the information needed to use the ticket. We chose postcard because it's extremely succinct.
3344

0 commit comments

Comments
 (0)