{% extends "_layout.html" %} {% block title %}I2NP Specification{% endblock %} {% block content %}
The I2P Network Protocol (I2NP), which is sandwiched between I2CP and the various I2P transport protocols, manages the routing and mixing of messages between routers, as well as the selection of what transports to use when communicating with a peer for which there are multiple common transports supported.
Message | Type |
DatabaseStore | 1 |
DatabaseLookup | 2 |
DatabaseSearchReply | 3 |
DeliveryStatus | 10 |
with reply token: +----+----+----+----+----+----+----+----+ | SHA256 Hash as key | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |type| reply token | reply tunnel- +----+----+----+----+----+----+----+----+ Id | SHA256 of the gateway RouterInfo | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | data ... +----+--------\\ with reply token == 0: +----+----+----+----+----+----+----+----+ | SHA256 Hash as key | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |type| reply token | data ... +----+-------------------+---------\\
key: 32 bytes SHA256 hash type: 1 byte type identifier mapping: 0 RouterInfo 1 LeaseSet reply token: 4 bytes TODO: find out what this does reply tunnelId: 4 bytes only included if reply token > 0 TODO: what this tunnel information is needed for reply gateway: 32 bytes Hash of the routerInfo entry to reach the gateway only included if reply token > 0 TODO: what this tunnel information is needed for data: rest of the message(could be anything)
{% filter escape %} if flag==TRUE +----+----+----+----+----+----+----+----+ | SHA256 hash as the key to look up | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ | SHA256 hash of the routerInfo | + who is asking + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |flag| reply tunnelId |size | | +----+----+----+----+----+----+----+ + | SHA256 of $key1 to exclude | + + | | + + | | + +----+ | | | +----+----+----+----+----+----+----+ + | SHA256 of $key2 to exclude | .... {% endfilter %}
{% filter escape %} key: 32 bytes SHA256 hash of the object to lookup from: 32 bytes SHA256 hash of the routerInfo entry this request came from(and to which the reply should be sent) flag: 1 byte mapping: 0 FALSE => send reply directly 1 TRUE => send reply to some tunnel reply tunnelId: 2 bytes only included if flag==TRUE tunnelId of the tunnel to send the reply to size: 2 bytes number of peers to exclude from the lookup(TODO: whatever this means) excludedPeers: rest of the message are $size SHA256 hashes of 32 bytes each(total $size*32 bytes) {% endfilter %}
{% filter escape %} +----+----+----+----+----+----+----+----+ | SHA256 hash as query key | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |num | peer hash $1 | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | | +----+.... $num peer hashes + +----+----+----+----+----+----+----+ | | from | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | +----+ {% endfilter %}Definition
{% filter escape %} key: 32 bytes SHA256 of the object being searched num: 1 byte number of peer hashes that follow peer hash: 32 bytes SHA256 of the RouterInfo that the other router thinks are close to the key $num entries from: 32 bytes SHA256 of the RouterInfo of the router this reply was sent from {% endblock %}DeliveryStatus
{% filter escape %} +----+----+----+----+----+----+----+----+----+----+----+----+ |msg-id | arrival-time | +----+----+----+----+----+----+----+----+----+----+----+----+ {% endfilter %}Definition
{% filter escape %} msg-id: 4 bytes unique ID of the message we deliver the DeliveryStatus for(see common I2NP header for details) arrival-time: 8 bytes time the message was successfully delivered {% endfilter %}