Atyha
Atyha lets one program (the joiner) reach another (the host) by a short room code a person reads aloud or pastes, HK4M-7TRW, and opens a WebRTC connection between them. No server of your own is involved: the two sides find each other through public Nostr relays, and an optional password protects the room with a PAKE (CPace), so the relays and anyone watching them learn nothing that lets them join a password room or tamper with the connection.
It was written for Nexgen Spades, whose players host matches on their own machines and invite friends by code, and it is a transport layer any application can use: a game, a file transfer, a whiteboard, anything two peers do over DataChannels.
New to this? Explain like I'm 5 tells the whole thing as a story first.
The name
Atyha is Guarani: aty is a gathering, an assembly (as in Aty Guasu, the great assembly), and the suffix -ha makes it a place. Atyha is the meeting place: where players find each other.
How it works
- The host draws a code (or is given one) and subscribes to the room's topic on several relays at once.
- The joiner, given the code (and the password, if the room has one), runs CPace with the host through the relays. Both sides end with the same key only if the code and the password match; nobody else can compute it, and each attempt lets a guesser test a single password, online.
- With that key the joiner sends its SDP offer and the host its answer, sealed (ChaCha20-Poly1305): the relays carry them but cannot read or change them, so the DTLS fingerprints inside are authentic.
- WebRTC connects the two directly (STUN, or the host's TURN server, whose address and credentials travel sealed too). The relays are no longer used.
A join takes about two relay round trips plus ICE: around two seconds in our tests, between Brazil and the public relays.
What it is not
- It is signalling only. It carries one complete offer and one complete answer (no trickle ICE); what runs on the connection is the application's. The libraries add the recommended DataChannel profile (a reliable and an unreliable channel) for convenience.
- It does not relay traffic. Two peers that cannot reach each other (both behind symmetric NATs) need a TURN server, as with any WebRTC application.
- It is not a lobby or a server list: a room is found by its code only.
Implementations
| Language | Where | WebRTC helpers |
|---|---|---|
| TypeScript | ts/: browsers and Node; the reference | the browser's RTCPeerConnection, or node-datachannel |
| C | c/: native and Emscripten, poll driven, no threads | any stack; the example uses libdatachannel |
| Go | go/ | pion/webrtc |
| C# / Unity | csharp/: pure managed, a UPM package | com.unity.webrtc |
| Godot 4 | godot/: a GDExtension over the C library | webrtc-native |
Every implementation reproduces the same test vectors and has been run against the others over the real public relays, with and without a password. Getting started shows the same host and join in each.
Licence
MIT. The protocol is described in full in Protocol; anyone may implement it.
