summaryrefslogtreecommitdiff
path: root/draft-schanzen-r5n.xml
diff options
context:
space:
mode:
Diffstat (limited to 'draft-schanzen-r5n.xml')
-rw-r--r--draft-schanzen-r5n.xml240
1 files changed, 121 insertions, 119 deletions
diff --git a/draft-schanzen-r5n.xml b/draft-schanzen-r5n.xml
index 3e9a86c..7219a26 100644
--- a/draft-schanzen-r5n.xml
+++ b/draft-schanzen-r5n.xml
@@ -186,7 +186,7 @@ Connectivity | |Underlay| |Underlay|
186 <dt>Block Storage</dt> 186 <dt>Block Storage</dt>
187 <dd> 187 <dd>
188 The Block Storage component is used to persist and manage data 188 The Block Storage component is used to persist and manage data
189 by peers. It includes logic for quotas, caching stragegies and 189 by nodes. It includes logic for quotas, caching stragegies and
190 data validation. 190 data validation.
191 </dd> 191 </dd>
192 <dt>Message Processing</dt> 192 <dt>Message Processing</dt>
@@ -197,13 +197,13 @@ Connectivity | |Underlay| |Underlay|
197 <dt>Routing</dt> 197 <dt>Routing</dt>
198 <dd> 198 <dd>
199 The Routing component includes the routing table as well as 199 The Routing component includes the routing table as well as
200 routing and peer selection logic. It facilitates the R5N routing 200 routing and node selection logic. It facilitates the R5N routing
201 algorithm with required data structures and algorithms. 201 algorithm with required data structures and algorithms.
202 </dd> 202 </dd>
203 <dt>Underlay Interface</dt> 203 <dt>Underlay Interface</dt>
204 <dd> 204 <dd>
205 The DHT Underlay Interface is an abstraction layer on top of the 205 The DHT Underlay Interface is an abstraction layer on top of the
206 supported links of a peer. Peers may be linked by a variety of 206 supported links of a node. Nodes may be linked by a variety of
207 different transports, including "classical" protocols such as 207 different transports, including "classical" protocols such as
208 TCP, UDP and TLS or advanced protocols such as GNUnet, L2P or Tor. 208 TCP, UDP and TLS or advanced protocols such as GNUnet, L2P or Tor.
209 </dd> 209 </dd>
@@ -212,10 +212,12 @@ Connectivity | |Underlay| |Underlay|
212 <section anchor="overlay" numbered="true" toc="default"> 212 <section anchor="overlay" numbered="true" toc="default">
213 <name>Overlay</name> 213 <name>Overlay</name>
214 <t> 214 <t>
215 In the DHT overlay, a peer is addressable by its Peer ID. 215 In the DHT overlay, a node is addressable by its <tt>NodeID</tt>.
216 The Peer ID is the 256-bit hash of the peer public key. 216 The <tt>NodeID</tt> is a 512-bit hash of the <tt>NodeKey</tt>.
217 The peer public key is the public key of the corresponding 217 <!-- FIXME should the node ID be agile? Should the signature then
218 Ed25519<xref target="ed25519" /> peer private key. 218 also be agile?-->
219 <!--The node public key is the public key of the corresponding
220 Ed25519<xref target="ed25519" /> node private key.-->
219 </t> 221 </t>
220 <t> 222 <t>
221 Any implementation of this specification MUST expose the two API 223 Any implementation of this specification MUST expose the two API
@@ -266,16 +268,16 @@ GET(Key[, GetParams]) -> Results as List
266 <dl anchor="route_options"> 268 <dl anchor="route_options">
267 <dt>DemultiplexEverywhere</dt> 269 <dt>DemultiplexEverywhere</dt>
268 <dd> 270 <dd>
269 indicates that each peer along the way should process the request. 271 indicates that each node along the way should process the request.
270 </dd> 272 </dd>
271 <dt>RecordRoute</dt> 273 <dt>RecordRoute</dt>
272 <dd> 274 <dd>
273 indicates to keep track of the route that the message takes 275 indicates to keep track of the route that the message takes
274 in the P2P network. 276 in the P2P network.
275 </dd> 277 </dd>
276 <dt>FindPeer</dt> 278 <dt>FindNode</dt>
277 <dd> 279 <dd>
278 indicates that this is a request used to find additional peers. 280 indicates that this is a request used to find additional nodes.
279 This is a special flag which modifies the message processing to 281 This is a special flag which modifies the message processing to
280 allow approximate results. 282 allow approximate results.
281 </dd> 283 </dd>
@@ -326,13 +328,13 @@ PUT(Key, Block, BlockType[, PutParams])
326 <section anchor="underlay" numbered="true" toc="default"> 328 <section anchor="underlay" numbered="true" toc="default">
327 <name>Underlay</name> 329 <name>Underlay</name>
328 <t> 330 <t>
329 In the network underlay, a peer is addressable by traditional 331 In the network underlay, a node is addressable by traditional
330 means out of scope of this document. For example, the peer may 332 means out of scope of this document. For example, the node may
331 have a TCP/IP address, or a HTTPS endpoint. 333 have a TCP/IP address, or a HTTPS endpoint.
332 While the specific addressing options and mechanisms are out of scope 334 While the specific addressing options and mechanisms are out of scope
333 for this document, it is necessary to define a universal addressing 335 for this document, it is necessary to define a universal addressing
334 format in order to facilitate the distribution of connectivity 336 format in order to facilitate the distribution of connectivity
335 information to other peers in the DHT overlay. 337 information to other nodes in the DHT overlay.
336 This format is the "HELLO" message. 338 This format is the "HELLO" message.
337 </t> 339 </t>
338 340
@@ -349,57 +351,57 @@ PUT(Key, Block, BlockType[, PutParams])
349 be the same keys??? 351 be the same keys???
350 352
3513) I think we may want to mandate that the lower layer at least 3533) I think we may want to mandate that the lower layer at least
352authenticate the other peer (i.e. every UDP message could be in 354authenticate the other node (i.e. every UDP message could be in
353cleartext, but would need to come with an EdDSA signature, alas 92 byte 355cleartext, but would need to come with an EdDSA signature, alas 92 byte
354overhead and a signature verification _required_). Otherwise, I don't 356overhead and a signature verification _required_). Otherwise, I don't
355see how we can offer even the most minimal protections against peer 357see how we can offer even the most minimal protections against node
356 impersonation attacks. WDYT? 358 impersonation attacks. WDYT?
357 359
358 Security considerations? Prerequisites? 360 Security considerations? Prerequisites?
359 --> 361 -->
360 <t> 362 <t>
361 It is expected that there are basic mechanisms available to 363 It is expected that there are basic mechanisms available to
362 manage peer connectivity and addressing. 364 manage node connectivity and addressing.
363 The required functionality are abstracted through the following 365 The required functionality are abstracted through the following
364 procedures and events: 366 procedures and events:
365 </t> 367 </t>
366 <dl> 368 <dl>
367 <dt>PEER_CONNECTED(phash,address)</dt> 369 <dt>NODE_CONNECTED(NodeID, Address)</dt>
368 <dd> 370 <dd>
369 is a signal that allows the DHT to react to peers which connect. 371 is a signal that allows the DHT to react to nodes which connect.
370 Such an event triggers, for example, updates in the 372 Such an event triggers, for example, updates in the
371 routing table. 373 routing table.
372 </dd> 374 </dd>
373 <dt>PEER_DISCONNECTED(phash,address)</dt> 375 <dt>NODE_DISCONNECTED(NodeID, Address)</dt>
374 <dd> 376 <dd>
375 is a signal that allows the DHT to react to peers which disconnect. 377 is a signal that allows the DHT to react to nodes which disconnect.
376 Such an event triggers, for example, updates in the 378 Such an event triggers, for example, updates in the
377 routing table. 379 routing table.
378 </dd> 380 </dd>
379 <dt>TRY_CONNECT(pid, address)</dt> 381 <dt>TRY_CONNECT(NodeID, Address)</dt>
380 <dd> 382 <dd>
381 A function which allows a peer to attempt the establishment of 383 A function which allows a node to attempt the establishment of
382 a connection to another peer using an address. 384 a connection to another node using an address.
383 </dd> 385 </dd>
384 <dt>HOLD(pash)</dt> 386 <dt>HOLD(NodeID)</dt>
385 <dd> 387 <dd>
386 A function which tells the underlay to keep a hold on the connection 388 A function which tells the underlay to keep a hold on the connection
387 to another peer. 389 to another node.
388 </dd> 390 </dd>
389 <dt>DROP(pash)</dt> 391 <dt>DROP(NodeID)</dt>
390 <dd> 392 <dd>
391 A function which tells the underlay to drop the connection to another 393 A function which tells the underlay to drop the connection to another
392 peer. 394 node.
393 </dd> 395 </dd>
394 <dt>RECEIVE(source, message)</dt> 396 <dt>RECEIVE(NodeID, Message)</dt>
395 <dd> 397 <dd>
396 A function or event that allows the peer to receive protocol 398 A function or event that allows the node to receive protocol
397 messages as defined in this document from a connected peer. 399 messages as defined in this document from a connected node.
398 </dd> 400 </dd>
399 <dt>SEND(target, message)</dt> 401 <dt>SEND(NodeID, Message)</dt>
400 <dd> 402 <dd>
401 A function that allows a peer to send protocol messages as defined 403 A function that allows a node to send protocol messages as defined
402 in this document to a connected peer. If call to SEND fails, 404 in this document to a connected node. If call to SEND fails,
403 the message has not been sent. 405 the message has not been sent.
404 </dd> 406 </dd>
405 <dt>NETWORK_SIZE_ESTIMATE(N)</dt> 407 <dt>NETWORK_SIZE_ESTIMATE(N)</dt>
@@ -407,13 +409,13 @@ see how we can offer even the most minimal protections against peer
407 A function or event that provides estimates on the network size 409 A function or event that provides estimates on the network size
408 for use in the DHT routing algorithms. 410 for use in the DHT routing algorithms.
409 </dd> 411 </dd>
410 <dt>ADDRESS_ADD(pk, address)</dt> 412 <dt>ADDRESS_ADD(NodeID, address)</dt>
411 <dd> 413 <dd>
412 The underlay signals us that an address was added. 414 The underlay signals us that an address was added.
413 This information is used, for example, to publish 415 This information is used, for example, to publish
414 connectivity as part of the bootstrapping and overlay creation. 416 connectivity as part of the bootstrapping and overlay creation.
415 </dd> 417 </dd>
416 <dt>ADDRESS_DELETE(pk, address)</dt> 418 <dt>ADDRESS_DELETE(NodeID, address)</dt>
417 <dd> 419 <dd>
418 The underlay signals us that an address was removed. 420 The underlay signals us that an address was removed.
419 This information is used, for example, to publish 421 This information is used, for example, to publish
@@ -450,46 +452,46 @@ see how we can offer even the most minimal protections against peer
450 <section anchor="routing_table"> 452 <section anchor="routing_table">
451 <name>Routing Table</name> 453 <name>Routing Table</name>
452 <t> 454 <t>
453 R5N stores the information of all connected peers in a a set of lists 455 R5N stores the information of all connected nodes in a a set of lists
454 similar to the k-buckets data structure of <xref target="Kademlia"/>. 456 similar to the k-buckets data structure of <xref target="Kademlia"/>.
455 The size of this set is determined by the number of connected peers. 457 The size of this set is determined by the number of connected nodes.
456 A k-bucket contains a list of connected node IDs which share the same 458 A k-bucket contains a list of connected node IDs which share the same
457 bit prefix length with the local <tt>PeerID</tt>. 459 bit prefix length with the local <tt>nodeID</tt>.
458 This number is called the <tt>index</tt> of the k-bucket. 460 This number is called the <tt>index</tt> of the k-bucket.
459 The index which determines in which of the k-buckets to add a given 461 The index which determines in which of the k-buckets to add a given
460 peer is calculated using the <tt>FindBucket</tt> procedure. 462 node is calculated using the <tt>FindBucket</tt> procedure.
461 </t> 463 </t>
462 <t> 464 <t>
463 In order to select peers from the routing table which are suitable 465 In order to select nodes from the routing table which are suitable
464 destinations for sending messages, R5N uses a hybrid approach: 466 destinations for sending messages, R5N uses a hybrid approach:
465 Given an estimated network size N, the peer selection for the 467 Given an estimated network size N, the node selection for the
466 first N hops is random. After the initial N hops, peer selection 468 first N hops is random. After the initial N hops, node selection
467 follows an XOR-based peer distance calculation. 469 follows an XOR-based node distance calculation.
468 </t> 470 </t>
469 <t> 471 <t>
470 As the message traverses a random path through the network for the 472 As the message traverses a random path through the network for the
471 first N hops, it is essential that routing loops are avoided. 473 first N hops, it is essential that routing loops are avoided.
472 In R5N, a bloomfilter is used as part of the routing metadata in 474 In R5N, a bloomfilter is used as part of the routing metadata in
473 messages. The bloomfilter is updates at each hop with the hops 475 messages. The bloomfilter is updates at each hop with the hops
474 peer identity. 476 node identity.
475 For the next hop selection in both the random and the deterministic 477 For the next hop selection in both the random and the deterministic
476 case, any peer which is in the bloomfilter for the respective message 478 case, any node which is in the bloomfilter for the respective message
477 is not included in the peer selection process. 479 is not included in the node selection process.
478 </t> 480 </t>
479 <!-- Fixme: We may want to propose our modified, optimized XOR metric here or reference Kademlia --> 481 <!-- Fixme: We may want to propose our modified, optimized XOR metric here or reference Kademlia -->
480 <t> 482 <t>
481 The buckets serve implicitly as a routing table for messages by 483 The buckets serve implicitly as a routing table for messages by
482 calculating the shortest distance from a message key to node ID. 484 calculating the shortest distance from a message key to node ID.
483 In order to select a peer for a given message key and bloomfilter, 485 In order to select a node for a given message key and bloomfilter,
484 the <tt>PEER-SELECT</tt> is used (see <xref target="peer-select"/>. 486 the <tt>node-select</tt> is used (see <xref target="node-select"/>.
485 </t> 487 </t>
486 <figure anchor="peer-select"> 488 <figure anchor="node-select">
487 <artwork name="" type="" align="left" alt=""><![CDATA[ 489 <artwork name="" type="" align="left" alt=""><![CDATA[
488PEER-SELECT(key, bloomfilter) 490node-SELECT(key, bloomfilter)
489 peers := <Select all known peers NOT in message bloomfilter> 491 nodes := <Select all known peers NOT in message bloomfilter>
490 IF hops >= N 492 IF hops >= N
491 dist := MAX_VALUE 493 dist := MAX_VALUE
492 FOR EACH p IN peers 494 FOR EACH p IN nodes
493 IF XOR(p, key) < dist 495 IF XOR(p, key) < dist
494 dist := XOR(p, key) 496 dist := XOR(p, key)
495 target := p 497 target := p
@@ -497,7 +499,7 @@ PEER-SELECT(key, bloomfilter)
497 END 499 END
498 ELSE 500 ELSE
499 r := rand() 501 r := rand()
500 target := peers[r] 502 target := nodes[r]
501 END 503 END
502END 504END
503 ]]></artwork> 505 ]]></artwork>
@@ -507,36 +509,36 @@ END
507 the R5N routing component MUST implement the following functions: 509 the R5N routing component MUST implement the following functions:
508 </t> 510 </t>
509 <dl> 511 <dl>
510 <dt><tt>FindBucket(PeerID, Key) -> k-bucket as List</tt></dt> 512 <dt><tt>FindBucket(NodeID, Key) -> k-bucket as List</tt></dt>
511 <dd> 513 <dd>
512 The <tt>FindBucket</tt> function determines how many low 514 The <tt>FindBucket</tt> function determines how many low
513 order bits succesively match between a <tt>PeerID</tt> and a 515 order bits succesively match between a <tt>nodeID</tt> and a
514 <tt>Key</tt> starting from the first bit. The procedure returns 516 <tt>Key</tt> starting from the first bit. The procedure returns
515 the k-bucket for this index. 517 the k-bucket for this index.
516 </dd> 518 </dd>
517 <dt><tt>GetDistance(NodeKey_A, NodeKey_B) -> Distance as Integer</tt></dt> 519 <dt><tt>GetDistance(NodeID_A, NodeID_B) -> Distance as Integer</tt></dt>
518 <dd> 520 <dd>
519 FIXME: We do NOT do XOR here. We do some kind of 521 FIXME: We do NOT do XOR here. We do some kind of
520 fancy calculation. See get_distance() 522 fancy calculation. See get_distance()
521 </dd> 523 </dd>
522 <dt><tt>SelectClosestPeer(Key) -> NodeID</tt></dt> 524 <dt><tt>SelectClosestNode(Key) -> NodeID</tt></dt>
523 <dd> 525 <dd>
524 This function determines the closest node ID to <tt>Key</tt> 526 This function determines the closest node ID to <tt>Key</tt>
525 of all connected nodes using <tt>GetDistance</tt>. 527 of all connected nodes using <tt>GetDistance</tt>.
526 FIXME: Also has a bloomfilter. Isn't AmClosestNode simply 528 FIXME: Also has a bloomfilter. Isn't AmClosestNode simply
527 !SelectClosestPeer == myID ? 529 !SelectClosestnode == myID ?
528 </dd> 530 </dd>
529 <dt><tt>SelectRandomPeer() -> NodeID</tt></dt> 531 <dt><tt>SelectRandomnode() -> NodeID</tt></dt>
530 <dd> 532 <dd>
531 This function selects a random node ID from all connected 533 This function selects a random node ID from all connected
532 nodes. FIXME find elegant way to handle bloomfilter 534 nodes. FIXME find elegant way to handle bloomfilter
533 </dd> 535 </dd>
534 <dt><tt>SelectPeer(Key, NumberOfHops)</tt></dt> 536 <dt><tt>Selectnode(Key, NumberOfHops)</tt></dt>
535 <dd> 537 <dd>
536 This function selects a peer depending on the <tt>NumberOfHops</tt> 538 This function selects a node depending on the <tt>NumberOfHops</tt>
537 Parameter. If <tt>NumberOfHops &lt; NETWORK_SIZE_ESTIMATE</tt> 539 Parameter. If <tt>NumberOfHops &lt; NETWORK_SIZE_ESTIMATE</tt>
538 this function returns <tt>SelectRandomPeer()</tt> and 540 this function returns <tt>SelectRandomnode()</tt> and
539 <tt>SelectClosestPeer(Key)</tt> otherwise. 541 <tt>SelectClosestnode(Key)</tt> otherwise.
540 </dd> 542 </dd>
541 <dt><tt>AmClosestNode(NodeID, Key, Bloom) -> true | false</tt></dt> 543 <dt><tt>AmClosestNode(NodeID, Key, Bloom) -> true | false</tt></dt>
542 <dd> 544 <dd>
@@ -546,7 +548,7 @@ END
546 If there is a node ID <tt>NodeID'</tt> in the k-bucket where 548 If there is a node ID <tt>NodeID'</tt> in the k-bucket where
547 <tt>GetDistance(NodeID, Key) > GetDistance(NodeID', Key)</tt>, 549 <tt>GetDistance(NodeID, Key) > GetDistance(NodeID', Key)</tt>,
548 then <tt>false</tt> is returned, otherwise <tt>true</tt>. 550 then <tt>false</tt> is returned, otherwise <tt>true</tt>.
549 FIXME: Currently, GDS_am_closest_peer checks for longer matching 551 FIXME: Currently, GDS_am_closest_node checks for longer matching
550 bits. Not GetDistance. Why? 552 bits. Not GetDistance. Why?
551 </dd> 553 </dd>
552 </dl> 554 </dl>
@@ -559,7 +561,7 @@ END
559 <t> 561 <t>
560 In order to prevent circular routes, GET and PUT messages contain 562 In order to prevent circular routes, GET and PUT messages contain
561 a 128-bit Bloom filter (m=128). The Bloom filter is used to detect duplicate 563 a 128-bit Bloom filter (m=128). The Bloom filter is used to detect duplicate
562 peer IDs along the route. 564 node IDs along the route.
563 A Bloom filter "bf" is initially empty, consisting only of zeroes. 565 A Bloom filter "bf" is initially empty, consisting only of zeroes.
564 There are two functions which can be invoked on the Bloom filter: 566 There are two functions which can be invoked on the Bloom filter:
565 BF-SET(bf, e) and BF-TEST(bf, e) where "e" is an element which is to added 567 BF-SET(bf, e) and BF-TEST(bf, e) where "e" is an element which is to added
@@ -667,7 +669,7 @@ END
667 </dd> 669 </dd>
668 <dt>BLOOMFILTER</dt> 670 <dt>BLOOMFILTER</dt>
669 <dd> 671 <dd>
670 A bloomfilter (for peer identities) to stop circular routes. 672 A bloomfilter (for node identities) to stop circular routes.
671 </dd> 673 </dd>
672 <dt>KEY</dt> 674 <dt>KEY</dt>
673 <dd> 675 <dd>
@@ -677,7 +679,7 @@ END
677 <dt>PUTPATH</dt> 679 <dt>PUTPATH</dt>
678 <dd> 680 <dd>
679 the variable-length PUT path. 681 the variable-length PUT path.
680 The path consists of a list of PATH_LEN peer IDs. 682 The path consists of a list of PATH_LEN node IDs.
681 </dd> 683 </dd>
682 <dt>BLOCK</dt> 684 <dt>BLOCK</dt>
683 <dd> 685 <dd>
@@ -689,7 +691,7 @@ END
689 <section anchor="p2p_put_processing"> 691 <section anchor="p2p_put_processing">
690 <name>Processing</name> 692 <name>Processing</name>
691 <t> 693 <t>
692 Upon receiving a <tt>PutMessage</tt> from a connected peer. 694 Upon receiving a <tt>PutMessage</tt> from a connected node.
693 An implementation MUST process it step by step as follows: 695 An implementation MUST process it step by step as follows:
694 </t> 696 </t>
695 <ol> 697 <ol>
@@ -710,26 +712,26 @@ END
710 it MUST be discarded. 712 it MUST be discarded.
711 </li> 713 </li>
712 <li> 714 <li>
713 The sender peer ID SHOULD be in the BLOOMFILTER. If not, the 715 The sender node ID SHOULD be in the BLOOMFILTER. If not, the
714 implementation MAY log an error, but MUST continue. 716 implementation MAY log an error, but MUST continue.
715 </li> 717 </li>
716 <li> 718 <li>
717 If the <tt>RecordRoute</tt> flag is set in OPTIONS, the local peer ID 719 If the <tt>RecordRoute</tt> flag is set in OPTIONS, the local node ID
718 MUST be appended to the <tt>PUTPATH</tt> of the message. 720 MUST be appended to the <tt>PUTPATH</tt> of the message.
719 </li> 721 </li>
720 <li> 722 <li>
721 If the local peer is the closest peer (<tt>AM-CLOSEST-PEER</tt> is true) or the 723 If the local node is the closest node (<tt>AM-CLOSEST-NODE</tt> is true) or the
722 <tt>DemultiplexEverywhere</tt> options flag ist set, the message MUST 724 <tt>DemultiplexEverywhere</tt> options flag ist set, the message MUST
723 be stored locally in the block storage. 725 be stored locally in the block storage.
724 </li> 726 </li>
725 <li> 727 <li>
726 Given the value in REPL_LVL, the number of peers to forward to 728 Given the value in REPL_LVL, the number of nodes to forward to
727 MUST be calculated (NUM-FORWARD-PEERS). If there is at least one 729 MUST be calculated (NUM-FORWARD-nodeS). If there is at least one
728 peer to forward to, the implementation SHOULD select up to this 730 node to forward to, the implementation SHOULD select up to this
729 number of peers to forward the message to. The implementation MAY 731 number of nodes to forward the message to. The implementation MAY
730 forward to fewer or no peers in order to handle resource constraints 732 forward to fewer or no nodes in order to handle resource constraints
731 such as bandwidth. 733 such as bandwidth.
732 The message BLOOMFILTER MUST be updated with the local peer ID. 734 The message BLOOMFILTER MUST be updated with the local node ID.
733 </li> 735 </li>
734 </ol> 736 </ol>
735 </section> 737 </section>
@@ -798,7 +800,7 @@ END
798 </dd> 800 </dd>
799 <dt>BLOOMFILTER</dt> 801 <dt>BLOOMFILTER</dt>
800 <dd> 802 <dd>
801 A bloomfilter (for peer identities) to stop circular routes. 803 A bloomfilter (for node identities) to stop circular routes.
802 </dd> 804 </dd>
803 <dt>KEY</dt> 805 <dt>KEY</dt>
804 <dd> 806 <dd>
@@ -822,7 +824,7 @@ END
822 <section anchor="p2p_get_processing"> 824 <section anchor="p2p_get_processing">
823 <name>Processing</name> 825 <name>Processing</name>
824 <t> 826 <t>
825 Upon receiving a <tt>GetMmessage</tt> from a connected peer an 827 Upon receiving a <tt>GetMmessage</tt> from a connected node an
826 implementation MUST process it step by step as follows: 828 implementation MUST process it step by step as follows:
827 </t> 829 </t>
828 <ol> 830 <ol>
@@ -835,18 +837,18 @@ END
835 the message MUST be discarded. 837 the message MUST be discarded.
836 </li> 838 </li>
837 <li> 839 <li>
838 The sender peer ID SHOULD be in the BLOOMFILTER. If not, the 840 The sender node ID SHOULD be in the BLOOMFILTER. If not, the
839 implementation MAY log an error, but MUST continue. 841 implementation MAY log an error, but MUST continue.
840 </li> 842 </li>
841 <li> 843 <li>
842 <t> 844 <t>
843 If the local peer is the closest peer (AM-CLOSEST-PEER) or the 845 If the local node is the closest node (AM-CLOSEST-NODE) or the
844 <tt>DemultiplexEverywhere</tt> options flag is set, a reply 846 <tt>DemultiplexEverywhere</tt> options flag is set, a reply
845 MUST be produced: 847 MUST be produced:
846 </t> 848 </t>
847 <ol> 849 <ol>
848 <li> 850 <li>
849 If OPTIONS indicate a <tt>FindPeer</tt> request, FIXME the peer selection 851 If OPTIONS indicate a <tt>Findnode</tt> request, FIXME the node selection
850 foo from buckets that probably needs fixing. Take into account 852 foo from buckets that probably needs fixing. Take into account
851 <tt>REPLY_BF</tt> 853 <tt>REPLY_BF</tt>
852 </li> 854 </li>
@@ -864,13 +866,13 @@ END
864 <tt>BTYPE</tt> 866 <tt>BTYPE</tt>
865 </li> 867 </li>
866 <li> 868 <li>
867 Given the value in REPL_LVL, the number of peers to forward to 869 Given the value in REPL_LVL, the number of nodes to forward to
868 MUST be calculated (NUM-FORWARD-PEERS). If there is at least one 870 MUST be calculated (NUM-FORWARD-nodeS). If there is at least one
869 peer to forward to, the implementation SHOULD select up to this 871 node to forward to, the implementation SHOULD select up to this
870 number of peers to forward the message to. The implementation MAY 872 number of nodes to forward the message to. The implementation MAY
871 forward to fewer or no peers in order to handle resource constraints 873 forward to fewer or no nodes in order to handle resource constraints
872 such as bandwidth. 874 such as bandwidth.
873 The message BLOOMFILTER MUST be updated with the local peer ID. 875 The message BLOOMFILTER MUST be updated with the local node ID.
874 </li> 876 </li>
875 </ol> 877 </ol>
876 </section> 878 </section>
@@ -950,12 +952,12 @@ END
950 <dt>PUTPATH</dt> 952 <dt>PUTPATH</dt>
951 <dd> 953 <dd>
952 the variable-length PUT path. 954 the variable-length PUT path.
953 The path consists of a list of PATH_LEN peer IDs. 955 The path consists of a list of PATH_LEN node IDs.
954 </dd> 956 </dd>
955 <dt>GETPATH</dt> 957 <dt>GETPATH</dt>
956 <dd> 958 <dd>
957 the variable-length PUT path. 959 the variable-length PUT path.
958 The path consists of a list of PATH_LEN peer IDs. 960 The path consists of a list of PATH_LEN node IDs.
959 </dd> 961 </dd>
960 <dt>BLOCK</dt> 962 <dt>BLOCK</dt>
961 <dd> 963 <dd>
@@ -967,7 +969,7 @@ END
967 <section anchor="p2p_result_processing"> 969 <section anchor="p2p_result_processing">
968 <name>Processing</name> 970 <name>Processing</name>
969 <t> 971 <t>
970 Upon receiving a <tt>ResultMessage</tt> from a connected peer. 972 Upon receiving a <tt>ResultMessage</tt> from a connected node.
971 An implementation MUST process it step by step as follows: 973 An implementation MUST process it step by step as follows:
972 </t> 974 </t>
973 <ol> 975 <ol>
@@ -979,12 +981,12 @@ END
979 If the MTYPE of the message indicates a HELLO block, it 981 If the MTYPE of the message indicates a HELLO block, it
980 must be validated according to <xref target="hello_block"/>. 982 must be validated according to <xref target="hello_block"/>.
981 The payload MUST be considered for the local routing table by 983 The payload MUST be considered for the local routing table by
982 trying to establish a connection to the peer using the information 984 trying to establish a connection to the node using the information
983 from the HELLO block. If a connection can be established, 985 from the HELLO block. If a connection can be established,
984 the peer is added to the <tt>KBuckets</tt> routing table. 986 the node is added to the <tt>KBuckets</tt> routing table.
985 </li> 987 </li>
986 <li> 988 <li>
987 If the sender peer of the message is already found in the 989 If the sender node of the message is already found in the
988 GETPATH, the path MUST be truncated at this position. 990 GETPATH, the path MUST be truncated at this position.
989 The implementation MAY log a warning in such a case. 991 The implementation MAY log a warning in such a case.
990 </li> 992 </li>
@@ -1002,12 +1004,12 @@ END
1002 </li> 1004 </li>
1003 <li> 1005 <li>
1004 <t> 1006 <t>
1005 If requests by other peers for this KEY or BTYPE are known, 1007 If requests by other nodes for this KEY or BTYPE are known,
1006 the result block is validated against each request using 1008 the result block is validated against each request using
1007 the respective <tt>ValidateBlockReply</tt> function. 1009 the respective <tt>ValidateBlockReply</tt> function.
1008 </t> 1010 </t>
1009 <t> 1011 <t>
1010 If the request options include <tt>FindPeer</tt> and the result 1012 If the request options include <tt>Findnode</tt> and the result
1011 message block type is HELLO the block validation must use the 1013 message block type is HELLO the block validation must use the
1012 key derived using <tt>DeriveBlockKey</tt> as the key included in 1014 key derived using <tt>DeriveBlockKey</tt> as the key included in
1013 the request is only approximate. (FIXME: So we extract the key 1015 the request is only approximate. (FIXME: So we extract the key
@@ -1020,7 +1022,7 @@ END
1020 </t> 1022 </t>
1021 <t> 1023 <t>
1022 For each pending request the reply is sent to the requesting 1024 For each pending request the reply is sent to the requesting
1023 peer. 1025 node.
1024 </t> 1026 </t>
1025 </li> 1027 </li>
1026 </ol> 1028 </ol>
@@ -1080,7 +1082,7 @@ END
1080 is used to evaluate a block including its <tt>Key</tt> and payload. 1082 is used to evaluate a block including its <tt>Key</tt> and payload.
1081 It is used as part <tt>ResultMessage</tt> processing. 1083 It is used as part <tt>ResultMessage</tt> processing.
1082 The validation of the respective <tt>Block</tt> requires a pending local query 1084 The validation of the respective <tt>Block</tt> requires a pending local query
1083 or a previously routed request of another peer and its associated 1085 or a previously routed request of another node and its associated
1084 XQuery data and Key. 1086 XQuery data and Key.
1085 The validation MUST include a check of the block payload against the 1087 The validation MUST include a check of the block payload against the
1086 key under which it is requested to be stored. 1088 key under which it is requested to be stored.
@@ -1088,7 +1090,7 @@ END
1088 <dt>DeriveBlockKey(Block) -> Key</dt> 1090 <dt>DeriveBlockKey(Block) -> Key</dt>
1089 <dd> 1091 <dd>
1090 is used to synthesize the block key from the block payload 1092 is used to synthesize the block key from the block payload
1091 and metadata. It is used as part of FIND-PEER message processing. 1093 and metadata. It is used as part of FIND-node message processing.
1092 </dd> 1094 </dd>
1093 <dt>FilterResult(Block, XQuery, Key) -> ReplyEvaluationResult</dt> 1095 <dt>FilterResult(Block, XQuery, Key) -> ReplyEvaluationResult</dt>
1094 <dd> 1096 <dd>
@@ -1106,13 +1108,13 @@ END
1106 <t> 1108 <t>
1107 Applications can and should define their own block types. 1109 Applications can and should define their own block types.
1108 The block type determines the format and handling of the block 1110 The block type determines the format and handling of the block
1109 payload by peers in PUT and RESULT messages. 1111 payload by nodes in PUT and RESULT messages.
1110 Block types MUST be registered with GANA <xref target="gana"/>. 1112 Block types MUST be registered with GANA <xref target="gana"/>.
1111 </t> 1113 </t>
1112 <t> 1114 <t>
1113 For bootstrapping and peer discovery, the DHT implementation uses 1115 For bootstrapping and node discovery, the DHT implementation uses
1114 its own block type called "HELLO". A block with this block type 1116 its own block type called "HELLO". A block with this block type
1115 contains the peer ID of the peer initiating the GET request. 1117 contains the NodeID of the node initiating the GET request.
1116 </t> 1118 </t>
1117 <section anchor="hello_block"> 1119 <section anchor="hello_block">
1118 <name>HELLO</name> 1120 <name>HELLO</name>
@@ -1127,7 +1129,7 @@ END
1127 <artwork name="" type="" align="left" alt=""><![CDATA[ 1129 <artwork name="" type="" align="left" alt=""><![CDATA[
11280 8 16 24 32 40 48 56 11300 8 16 24 32 40 48 56
1129+-----+-----+-----+-----+-----+-----+-----+-----+ 1131+-----+-----+-----+-----+-----+-----+-----+-----+
1130| TYPE | SIZE | NODEID / 1132| TYPE | SIZE | NODEKEY /
1131+-----+-----+-----+-----+ (variable length) / 1133+-----+-----+-----+-----+ (variable length) /
1132/ / 1134/ /
1133+-----+-----+-----+-----+-----+-----+-----+-----+ 1135+-----+-----+-----+-----+-----+-----+-----+-----+
@@ -1148,10 +1150,10 @@ END
1148 is the SIZE of the following fields NODEID and ADDRESSES in bytes. 1150 is the SIZE of the following fields NODEID and ADDRESSES in bytes.
1149 In network byte order. 1151 In network byte order.
1150 </dd> 1152 </dd>
1151 <dt>NODEID</dt> 1153 <dt>NODEKEY</dt>
1152 <dd> 1154 <dd>
1153 is the Node ID of the peer which has generated this HELLO. 1155 is the NodeKey of the node which has generated this HELLO.
1154 The length content of the NODEID is determined by the TYPE field. 1156 The length content of this field is determined by the TYPE.
1155 Usually, this is a cryptographic public key which allows the 1157 Usually, this is a cryptographic public key which allows the
1156 Underlay to uniquely identify and authenticate the node. 1158 Underlay to uniquely identify and authenticate the node.
1157 </dd> 1159 </dd>
@@ -1168,7 +1170,7 @@ END
1168 HELLO of a node. 1170 HELLO of a node.
1169 </t> 1171 </t>
1170 <t> 1172 <t>
1171 For the string representation of the peer public key, 1173 For the string representation of the node public key,
1172 the base-32 encoding "StringEncode" is used. 1174 the base-32 encoding "StringEncode" is used.
1173 However, instead of following <xref target="RFC4648"/> the 1175 However, instead of following <xref target="RFC4648"/> the
1174 character map is based on the optical character recognition friendly 1176 character map is based on the optical character recognition friendly
@@ -1179,7 +1181,7 @@ END
1179 <t> 1181 <t>
1180 The <tt>ADDRESSES</tt> part of the <tt>HELLO</tt> indicate endpoints 1182 The <tt>ADDRESSES</tt> part of the <tt>HELLO</tt> indicate endpoints
1181 which can be used by the Underlay in order to establish a connection 1183 which can be used by the Underlay in order to establish a connection
1182 with the node identified by <tt>NODEID</tt>. 1184 with the node identified by <tt>NODEKEY</tt>.
1183 An example of an addressing scheme used throughout 1185 An example of an addressing scheme used throughout
1184 this document is "ip+tcp", which refers to a standard TCP/IP socket 1186 this document is "ip+tcp", which refers to a standard TCP/IP socket
1185 connection. The "hier"-part of the URI must provide a suitable 1187 connection. The "hier"-part of the URI must provide a suitable
@@ -1200,23 +1202,23 @@ tor+onionv3://rasdflkjasdfliasduf.onion/
1200 <section> 1202 <section>
1201 <name>Bootstrapping</name> 1203 <name>Bootstrapping</name>
1202 <t> 1204 <t>
1203 It is assumed that the peer is already connected to at least 1205 It is assumed that the node is already connected to at least
1204 one other peer. 1206 one other node.
1205 First, those initial peers are sorted into their respective buckets. 1207 First, those initial nodes are sorted into their respective buckets.
1206 </t> 1208 </t>
1207 <t> 1209 <t>
1208 In order to find the closest peers in the network to itself, an 1210 In order to find the closest nodes in the network to itself, an
1209 implementation MUST now periodically send HELLO GET queries for its own 1211 implementation MUST now periodically send HELLO GET queries for its own
1210 peer ID. 1212 node ID.
1211 Both the "record route" and "find peer" message options are set in the 1213 Both the "record route" and "find node" message options are set in the
1212 GET queries in order to learn peers and network topology from the 1214 GET queries in order to learn nodes and network topology from the
1213 message route and in order to receive approximate replies to the 1215 message route and in order to receive approximate replies to the
1214 query key (the peer ID). 1216 query key (the node ID).
1215 </t> 1217 </t>
1216 <t>FIXME: Periodically -> more specific? No. Frequency may be adapted depending on network conditions, known peers, busy/idle etc.</t> 1218 <t>FIXME: Periodically -> more specific? No. Frequency may be adapted depending on network conditions, known nodes, busy/idle etc.</t>
1217 <t> 1219 <t>
1218 Any implementation encountering a HELLO GET request initially 1220 Any implementation encountering a HELLO GET request initially
1219 sends its own peer ID if it. 1221 sends its own node ID if it.
1220 </t> 1222 </t>
1221 </section> 1223 </section>
1222 <section anchor="security" numbered="true" toc="default"> 1224 <section anchor="security" numbered="true" toc="default">
@@ -1254,7 +1256,7 @@ Number | Name | Contact | References | Description
1254-------+--------+---------+------------+------------------------- 1256-------+--------+---------+------------+-------------------------
12550 ANY N/A [This.I-D] Reserved 12570 ANY N/A [This.I-D] Reserved
12567 HELLO N/A [This.I-D] Type of a block that contains 12587 HELLO N/A [This.I-D] Type of a block that contains
1257a HELLO for a peer 1259a HELLO for a node
125811 GNS N/A GNS Block for storing record data 126011 GNS N/A GNS Block for storing record data
1259]]> 1261]]>
1260 </artwork> 1262 </artwork>