@@ -4,6 +4,7 @@ weight = 1
4template = "doc.html"
4template = "doc.html"
5aliases = ["/docs/learn/arvo/ames/"]
5aliases = ["/docs/learn/arvo/ames/"]
7Our networking protocol.
8Our networking protocol.
9Ames is the name of both our network and the vane that communicates
10Ames is the name of both our network and the vane that communicates
@@ -11,7 +12,7 @@ over it. When Unix receives a packet over the correct UDP port, it pipes
11it straight into Ames for handling. Also, all packets sent over the
12it straight into Ames for handling. Also, all packets sent over the
12Ames network are sent by the Ames vane. Apps and vanes may use
13Ames network are sent by the Ames vane. Apps and vanes may use
13Ames to directly send messages to other ships. In general, apps use
14Ames to directly send messages to other ships. In general, apps use
14−[Gall](/docs/userspace/gall/gall) and [Clay](/docs/arvo/clay/clay)
15+[Gall](/docs/arvo/gall/gall) and [Clay](/docs/arvo/clay/clay)
15to communicate with other ships rather than using Ames
16to communicate with other ships rather than using Ames
16directly, but this isn't a requirement. Of course, Gall and Clay use
17directly, but this isn't a requirement. Of course, Gall and Clay use
17Ames behind the scenes to communicate across the network. Jael is the only other
18Ames behind the scenes to communicate across the network. Jael is the only other
@@ -25,32 +26,33 @@ protocol itself, including how to route incoming packets to the correct
25vane or app, is defined in Ames.
26vane or app, is defined in Ames.
27## Technical Overview
28## Technical Overview
28This section summarizes the design of Ames. Beyond this section are deeper
30This section summarizes the design of Ames. Beyond this section are deeper
29elaborations on the concepts presented here.
31elaborations on the concepts presented here.
31Ames extends [Arvo's](/docs/arvo/overview) `%pass`/`%give` `move` semantics across the network.
33Ames extends [Arvo's](/docs/arvo/overview) `%pass`/`%give` `move` semantics across the network.
33Ames receives packets as Arvo events and emits packets as Arvo
35Ames receives packets as Arvo events and emits packets as Arvo
34−effects. The runtime is responsible for transferring the bytes in
36+effects. The runtime is responsible for transferring the bytes in
35an Ames packet across a physical network to another ship.
37an Ames packet across a physical network to another ship.
37The runtime tells Ames which physical address a packet came from,
39The runtime tells Ames which physical address a packet came from,
38−represented as an opaque atom. Ames can emit a packet effect to
40+represented as an opaque atom. Ames can emit a packet effect to
39one of those opaque atoms or to the Urbit address of a galaxy
41one of those opaque atoms or to the Urbit address of a galaxy
40(root node), which the runtime is responsible for translating to a
42(root node), which the runtime is responsible for translating to a
41−physical address. One runtime implementation sends UDP packets
43+physical address. One runtime implementation sends UDP packets
42using IPv4 addresses for ships and DNS lookups for galaxies, but
44using IPv4 addresses for ships and DNS lookups for galaxies, but
43other implementations may overlay over other kinds of networks.
45other implementations may overlay over other kinds of networks.
45−A local vane can pass Ames a `%plea` request message. Ames
47+A local vane can pass Ames a `%plea` request message. Ames
46transmits the message over the wire to the peer ship's Ames, which
48transmits the message over the wire to the peer ship's Ames, which
47passes the message to the destination vane.
49passes the message to the destination vane.
49Once the peer has processed the `%plea` message, it sends a
51Once the peer has processed the `%plea` message, it sends a
50message-acknowledgment packet over the wire back to the local
52message-acknowledgment packet over the wire back to the local
51−Ames. This "ack" can either be positive to indicate the request was
53+Ames. This "ack" can either be positive to indicate the request was
52processed, or negative to indicate the request failed, in which
54processed, or negative to indicate the request failed, in which
53−case it's called a "nack". (Don't confuse Ames nacks with TCP
55+case it's called a "nack". (Don't confuse Ames nacks with TCP
54nacks, which are a different concept).
56nacks, which are a different concept).
56When the local Ames receives either a positive message-ack or a
58When the local Ames receives either a positive message-ack or a
@@ -60,11 +62,11 @@ requested the original `%plea` message be sent.
61A local vane can give Ames zero or more `%boon` response messages in
63A local vane can give Ames zero or more `%boon` response messages in
62response to a `%plea`, on the same duct that Ames used to pass the
64response to a `%plea`, on the same duct that Ames used to pass the
63−`%plea` to the vane. Ames transmits a `%boon` over the wire to the
65+`%plea` to the vane. Ames transmits a `%boon` over the wire to the
64peer's Ames, which gives it to the destination vane on the same
66peer's Ames, which gives it to the destination vane on the same
65duct the vane had used to pass the original `%plea` to Ames.
67duct the vane had used to pass the original `%plea` to Ames.
67−`%boon` messages are acked automatically by the receiver Ames. They
69+`%boon` messages are acked automatically by the receiver Ames. They
68cannot be nacked, and Ames only uses the ack internally, without
70cannot be nacked, and Ames only uses the ack internally, without
69notifying the client vane that gave Ames the `%boon`.
71notifying the client vane that gave Ames the `%boon`.
@@ -74,15 +76,15 @@ indicating the `%boon` was missed.
75`%plea` messages can be nacked, in which case the peer will send
77`%plea` messages can be nacked, in which case the peer will send
76both a message-nack packet and a naxplanation message, which is
78both a message-nack packet and a naxplanation message, which is
77−sent in a way that does not interfere with normal operation. The
79+sent in a way that does not interfere with normal operation. The
78naxplanation is sent as a full Ames message, instead of just a
80naxplanation is sent as a full Ames message, instead of just a
79packet, because the contained error information can be arbitrarily
81packet, because the contained error information can be arbitrarily
80−large. A naxplanation can only give rise to a positive ack --
82+large. A naxplanation can only give rise to a positive ack --
81never ack an ack, and never nack a naxplanation.
83never ack an ack, and never nack a naxplanation.
83Ames guarantees a total ordering of messages within a "flow",
85Ames guarantees a total ordering of messages within a "flow",
84identified in other vanes by a duct and over the wire by a `bone`:
86identified in other vanes by a duct and over the wire by a `bone`:
85−an opaque number. Each flow has a FIFO (first-in-first-out) queue of `%plea` requests
87+an opaque number. Each flow has a FIFO (first-in-first-out) queue of `%plea` requests
86from the requesting ship to the responding ship and a FIFO queue
88from the requesting ship to the responding ship and a FIFO queue
87of `%boon`'s in the other direction.
89of `%boon`'s in the other direction.
@@ -94,23 +96,23 @@ destination vane.
95Ames encrypts every message using symmetric-key encryption by
97Ames encrypts every message using symmetric-key encryption by
96performing an elliptic curve Diffie-Hellman using our private key
98performing an elliptic curve Diffie-Hellman using our private key
97−and the public key of the peer. For ships in the Jael PKI
99+and the public key of the peer. For ships in the Jael PKI
98(public-key infrastructure), Ames looks up the peer's public key
100(public-key infrastructure), Ames looks up the peer's public key
99−from Jael. Comets (128-bit ephemeral addresses) are not
101+from Jael. Comets (128-bit ephemeral addresses) are not
100cryptographic assets and must self-attest over Ames by sending a
102cryptographic assets and must self-attest over Ames by sending a
101single self-signed packet containing their public key.
103single self-signed packet containing their public key.
103When a peer suffers a continuity breach, Ames removes all
105When a peer suffers a continuity breach, Ames removes all
104−messaging state related to it. Ames does not guarantee that all
106+messaging state related to it. Ames does not guarantee that all
105−messages will be fully delivered to the now-stale peer. From
107+messages will be fully delivered to the now-stale peer. From
106Ames's perspective, the newly restarted peer is a new ship.
108Ames's perspective, the newly restarted peer is a new ship.
107Ames's guarantees are not maintained across a breach.
109Ames's guarantees are not maintained across a breach.
109A vane can pass Ames a `%heed` `$task` to request Ames track a peer's
111A vane can pass Ames a `%heed` `$task` to request Ames track a peer's
110−responsiveness. If our `%boon`'s to it start backing up locally,
112+responsiveness. If our `%boon`'s to it start backing up locally,
111Ames will give a `%clog` back to the requesting vane containing the
113Ames will give a `%clog` back to the requesting vane containing the
112−unresponsive peer's urbit address. This interaction does not use
114+unresponsive peer's urbit address. This interaction does not use
113−ducts as unique keys. Stop tracking a peer by sending Ames a
115+ducts as unique keys. Stop tracking a peer by sending Ames a
114`%jilt` `$task`.
116`%jilt` `$task`.
116Debug output can be adjusted using `%sift` and `%spew` `$task`'s.
118Debug output can be adjusted using `%sift` and `%spew` `$task`'s.
@@ -128,46 +130,46 @@ There is a 32-bit header followed by a variable width body.
129The 32-bit header is given by the following data, presented in order:
131The 32-bit header is given by the following data, presented in order:
131− - 3 bits: reserved
133+- 3 bits: reserved
132− - 1 bit: is this Ames? (i.e. not using a different protocol, such as the
134+- 1 bit: is this Ames? (i.e. not using a different protocol, such as the
133− planned remote scry protocol)
135+ planned remote scry protocol)
134− - 3 bits: Ames protocol version (currently 0)
136+- 3 bits: Ames protocol version (currently 0)
135− - 2 bits: sender address size
137+- 2 bits: sender address size
136− - 2 bits: receiver address size
138+- 2 bits: receiver address size
137− - 20 bits: checksum (truncated insecure hash of the body, done with
139+- 20 bits: checksum (truncated insecure hash of the body, done with
138− [`+mug`](/docs/hoon/reference/stdlib/2e#mug)
140+ [`+mug`](/docs/hoon/reference/stdlib/2e#mug)
139− - 1 bit: is this relayed? (if set, `origin` will be present in the body)
141+- 1 bit: is this relayed? (if set, `origin` will be present in the body)
141− Every packet sent between ships is encrypted except for self-signed attestation packets from 128-bit comets.
143+Every packet sent between ships is encrypted except for self-signed attestation packets from 128-bit comets.
145The body is of variable length and consists of the following parts in this
147The body is of variable length and consists of the following parts in this
148− - 4 bits: sender life (mod 16)
150+- 4 bits: sender life (mod 16)
149− - 4 bits: receiver life (mod 16)
151+- 4 bits: receiver life (mod 16)
150− - variable: sender address
152+- variable: sender address
151− - variable: receiver address
153+- variable: receiver address
152− - 48 bits: (optional) 48-bit `origin`
154+- 48 bits: (optional) 48-bit `origin`
153− - 128 bits: `SIV`
155+- 128 bits: `SIV`
154− - 16 bits: ciphertext size
156+- 16 bits: ciphertext size
155− - variable: ciphertext
157+- variable: ciphertext
157− `origin` is the IP and port of the original sender if the packet was proxied
159+`origin` is the IP and port of the original sender if the packet was proxied
158− through a relay.
160+through a relay.
160− `SIV` is a "synthetic initialization vector" as defined in AES-256 SIV, the encryption
162+`SIV` is a "synthetic initialization vector" as defined in AES-256 SIV, the encryption
161− algorithm utilized to encrypt Ames packets (see the page on [Ames
163+algorithm utilized to encrypt Ames packets (see the page on [Ames
162− cryptography](/docs/arvo/ames/cryptography)). It is formed from the
164+cryptography](/docs/arvo/ames/cryptography)). It is formed from the
163− following noun: `~[sender=@p receiver=@p sender-life=@ receiver-life=@]` (see
165+following noun: `~[sender=@p receiver=@p sender-life=@ receiver-life=@]` (see
164− [Life and Rift](/docs/azimuth/life-and-rift) for information on what `life`
166+[Life and Rift](/docs/azimuth/life-and-rift) for information on what `life`
165− is). As this data is in Azimuth, it is not explicitly sent over the wire. Thus
167+is). As this data is in Azimuth, it is not explicitly sent over the wire. Thus
166− the mod 16 sender and receiver life in the first 8 bits are only for quick
168+the mod 16 sender and receiver life in the first 8 bits are only for quick
167− filtering of honest packets sent to or from a stale life.
169+filtering of honest packets sent to or from a stale life.
169− The ciphertext is formed by `+jam`ming a `$shut-packet` and then encrypting
171+The ciphertext is formed by `+jam`ming a `$shut-packet` and then encrypting
170− using [`+en:sivc:aes:crypto`](/docs/arvo/reference/cryptography#en).
172+using [`+en:sivc:aes:crypto`](/docs/arvo/reference/cryptography#en).
172### Packeting
174### Packeting
@@ -187,9 +189,7 @@ eventually get through, and when the other side gets them it can put them in the
187correct order. If Ames doesn't get an ack on a packet then it will resend it
189correct order. If Ames doesn't get an ack on a packet then it will resend it
188until it does. The logic for determining how many packets to send or re-send at what time is performed by an Ames-specific variant of TCP's "NewReno" congestion control algorithm.
190until it does. The logic for determining how many packets to send or re-send at what time is performed by an Ames-specific variant of TCP's "NewReno" congestion control algorithm.
190−As each packet in a message is received, Ames decrypts it and stores the message fragment. Once it's received every packet for a message, Ames concatenates the fragments back into a single large atom and uses `+cue` to deserialize that back into the original message noun.
192+As each packet in a message is received, Ames decrypts it and stores the message fragment. Once it's received every packet for a message, Ames concatenates the fragments back into a single large atom and uses `+cue` to deserialize that back into the original message noun.
194### Acks and Nacks
194### Acks and Nacks
@@ -221,7 +221,6 @@ Thus a message-level ack must be received before the next message on the flow
221can begin. The full story is more complicated than this; see the section on
221can begin. The full story is more complicated than this; see the section on
222[flows](#flows).
222[flows](#flows).
225#### Nacks
224#### Nacks
227A nack indicates a negative acknowledgement to a `%plea`, meaning that the
226A nack indicates a negative acknowledgement to a `%plea`, meaning that the
@@ -248,9 +247,11 @@ the receiver will never both perform a `%plea` and return a naxplanation.
249A fragment ack's contents (before encryption) are a pure function of the
248A fragment ack's contents (before encryption) are a pure function of the
250following noun:
249following noun:
252[our-life her-life bone message-num fragment-num]
252[our-life her-life bone message-num fragment-num]
254This means all re-sends of an ack packet will be bitwise identical to each other, unless one of the peers changes its encryption keys.
255This means all re-sends of an ack packet will be bitwise identical to each other, unless one of the peers changes its encryption keys.
256Each datum in this noun is an atom with the aura `@ud` or an aura that nests
257Each datum in this noun is an atom with the aura `@ud` or an aura that nests
@@ -269,11 +270,11 @@ A message (n)ack is a different kind of ack that is obtained by encrypting the
270[our-life her-life bone message-num ok=? lag=@dr]
271[our-life her-life bone message-num ok=? lag=@dr]
272`ok` is a flag that is set to `%.y` for a message ack and `%.n` for a message
274`ok` is a flag that is set to `%.y` for a message ack and `%.n` for a message
273nack. In the future, `lag` will be used to
275nack. In the future, `lag` will be used to
274describe the time it took to process a message, but for now it is always zero.
276describe the time it took to process a message, but for now it is always zero.
279Flows are asymmetric communication channels along which two ships send and
280Flows are asymmetric communication channels along which two ships send and
@@ -300,10 +301,10 @@ We give an example of such a partition. Let flow 12 be a flow between `~bacbel-t
300`~bacbel-tagfeg` as the `%plea` sender. Then bones 12-15 are associated with the
301`~bacbel-tagfeg` as the `%plea` sender. Then bones 12-15 are associated with the
301flow, and the types of packets for each bone are:
302flow, and the types of packets for each bone are:
303− - bone 12, `%plea`s and acks to `~worwel-sipnum`,
304+- bone 12, `%plea`s and acks to `~worwel-sipnum`,
304− - bone 13, `%boon`s and (n)acks to `~bacbel-tagfeg`,
305+- bone 13, `%boon`s and (n)acks to `~bacbel-tagfeg`,
305− - bone 14, acks of naxplanations to `~worwel-sipnum`,
306+- bone 14, acks of naxplanations to `~worwel-sipnum`,
306− - bone 15, naxplanations to `~bacbel-tagfeg`.
307+- bone 15, naxplanations to `~bacbel-tagfeg`.
308Each bone is handled separately by congestion control, and this is one reason
309Each bone is handled separately by congestion control, and this is one reason
309for their segregation. For example, say a two-packet `%plea` is sent on bone 12,
310for their segregation. For example, say a two-packet `%plea` is sent on bone 12,
@@ -379,16 +380,17 @@ private key and the public key of `~worwel-sipnum`, obtained via Jael. Then
379`~bacbel-tagfeb` sends a packet addressed to `~worwel-sipnum` to `~zod`.
380`~bacbel-tagfeb` sends a packet addressed to `~worwel-sipnum` to `~zod`.
381The packet has the following format:
382The packet has the following format:
382− - The standard Ames header described in [header](#header), where the checksum
384+- The standard Ames header described in [header](#header), where the checksum
383− is the `+mug` of the body, and the sender and receiver ship types are `01`,
385+ is the `+mug` of the body, and the sender and receiver ship types are `01`,
384− denoting that the sender and receiver are planets. The "is this relayed?" bit
386+ denoting that the sender and receiver are planets. The "is this relayed?" bit
385− is set to 0 since this is the first hop on the packet route.
387+ is set to 0 since this is the first hop on the packet route.
386− - The body of this packet will be the life of `~bacbel-tagfeg` mod 16, followed
388+- The body of this packet will be the life of `~bacbel-tagfeg` mod 16, followed
387− by the life of `~worwel-sipnum` mod 16, followed by `~bacbel-tagfeg`,
389+ by the life of `~worwel-sipnum` mod 16, followed by `~bacbel-tagfeg`,
388− followed by the receiver `~worwel-sipnum`, followed by the origin `~`
390+ followed by the receiver `~worwel-sipnum`, followed by the origin `~`
389− (denoting that the ship sending the packet is the origin). After this comes
391+ (denoting that the ship sending the packet is the origin). After this comes
390− the payload.
392+ the payload.
391− - The payload of this packet will be the `+jam` of the `content`, which is an encrypted fragment of the message `%watch /path/to/recipes`.
393+- The payload of this packet will be the `+jam` of the `content`, which is an encrypted fragment of the message `%watch /path/to/recipes`.
393`~zod` receives the packet and reads the body. It sees that it is not the
395`~zod` receives the packet and reads the body. It sees that it is not the
394intended recipient of the packet, and so gets ready to forward it to
396intended recipient of the packet, and so gets ready to forward it to
@@ -398,8 +400,7 @@ with the new mug. Since the packet is being relayed, `~zod` flips the "is it
398relayed?" bit to `%.y`. `~zod` then forwards the packet to `~worwel-sipnum`.
400relayed?" bit to `%.y`. `~zod` then forwards the packet to `~worwel-sipnum`.
400In order to decrypt the packet, `~worwel-sipnum` will need to calculate the
402In order to decrypt the packet, `~worwel-sipnum` will need to calculate the
401−associated data vector utilized by SIV, which consists of `~[sender=@p
402−receiver=@p sender-life=@ receiver-life=@]`. It then passes that along with the
403+associated data vector utilized by SIV, which consists of `~[sender=@p receiver=@p sender-life=@ receiver-life=@]`. It then passes that along with the
403SIV and ciphertext to the decryption function, and receives the unencrypted
404SIV and ciphertext to the decryption function, and receives the unencrypted
404packet as a return.
405packet as a return.
@@ -463,4 +464,3 @@ hands it off the the Unix network interface to be sent.
463Now the receiving King is handed a UDP packet by Unix. The King removes the UDP
464Now the receiving King is handed a UDP packet by Unix. The King removes the UDP
464wrapper, `+jam`s the `lane` on which it heard the packet, and delivers the packet
465wrapper, `+jam`s the `lane` on which it heard the packet, and delivers the packet
465to the Ames vane as an atom by copying the bytes it heard on the UDP port.
466to the Ames vane as an atom by copying the bytes it heard on the UDP port.