{% extends "global/layout.html" %} {% block title %}I2NP Specification{% endblock %} {% block lastupdated %}June 2013{% endblock %} {% block accuratefor %}0.9.6{% 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.
Common header to all I2NP messages, which contains important information like a checksum, expiration date, etc.
1 byte Integer specifying the type of this message, followed by a 4 byte Integer specifying the message-id. After that there is an expiration Date, followed by a 2 byte Integer specifying the length of the message payload, followed by a Hash, which is truncated to the first byte. After that the actual message data follows.
{% highlight lang='dataspec' %} Standard (16 bytes): +----+----+----+----+----+----+----+----+ |type| msg_id | expiration +----+----+----+----+----+----+----+----+ | size |chks| +----+----+----+----+----+----+----+----+ Short (SSU, 5 bytes): +----+----+----+----+----+ |type| short_expiration | +----+----+----+----+----+ {% endhighlight %}One Record in a set of multiple records to request the creation of one hop in the tunnel. For more details see the tunnel overview and the tunnel creation specification.
TunnelId to receive messages on, followed by the Hash of our RouterIdentity. After that the TunnelId and the Hash of the next router's RouterIdentity follow.
unencrypted: Delivery Instructions :: as defined here Length varies but is typically 39, 43, or 47 bytes I2NP Message :: Any I2NP Message Clove ID :: 4 byte Integer Expiration :: Date (8 bytes) Certificate :: Always NULL in the current implementation (3 bytes total, all zeroes)
Message | Type |
---|---|
DatabaseStore | 1 |
DatabaseLookup | 2 |
DatabaseSearchReply | 3 |
DeliveryStatus | 10 |
Garlic | 11 |
TunnelData | 18 |
TunnelGateway | 19 |
Data | 20 |
TunnelBuild | 21 |
TunnelBuildReply | 22 |
VariableTunnelBuild | 23 |
VariableTunnelBuildReply | 24 |
An unsolicited database store, or the response to a successful Database Lookup Message
An uncompressed LeaseSet or a compressed RouterInfo
{% highlight lang='dataspec' %} 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| 0 | data ... +----+----+----+----+----+-// {% endhighlight %}key: 32 bytes SHA256 hash type: 1 byte type identifier mapping: 0 RouterInfo 1 LeaseSet reply token: 4 bytes If greater than zero, a Delivery Status Message is requested with the Message ID set to the value of the Reply Token. A floodfill router is also expected to flood the data to the closest floodfill peers if the token is greater than zero. reply tunnelId: 4 byte Tunnel ID only included if reply token > 0 This is the tunnel ID of the inbound gateway of the tunnel the response should be sent to reply gateway: 32 bytes Hash of the routerInfo entry to reach the gateway only included if reply token > 0 This is the router hash of the inbound gateway of the tunnel the response should be sent to data: If type == 0, data is a 2-byte integer specifying the number of bytes that follow, followed by a gzip-compressed RouterInfo. If type == 1, data is an uncompressed LeaseSet.
The response to a failed Database Lookup Message
A list of router hashes closest to the requested key
{% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+ | SHA256 hash as query key | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |num | peer_hash $1 | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | | +----+ $num peer_hashes + + +----+----+----+----+----+----+----+ | | from | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | +----+ {% endhighlight %}The 'from' hash is unauthenticated and cannot be trusted.
A simple message acknowledgment. Generally created by the message originator, and wrapped in a Garlic Message with the message itself, to be returned by the destination.
The ID of the delivered message, and the creation or arrival time.
{% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+----+----+----+----+ |msg_id | time_stamp | +----+----+----+----+----+----+----+----+----+----+----+----+ {% endhighlight %}Used to wrap multiple encrypted I2NP Messages
When decrypted, a series of Garlic Cloves.
{% highlight lang='dataspec' %} encrypted: +----+----+----+----+----+----+----+----+ | length | data | +----+----+----+----+ + | | ~ ~ ~ ~ | | +----+----+----+----+----+----+----+----+ unencrypted data: +----+----+----+----+----+----+----+----+ |num | clove 1 | +----+ + | | ~ ~ ~ ~ | | +----+----+----+----+----+----+----+----+ | clove 2 ... | ~ ~ ~ ~ | | +----+----+----+----+----+----+----+----+ | Certificate | Message_ID | +----+----+----+----+----+----+----+----+ Expiration | +----+----+----+----+----+----+----+ {% endhighlight %}Used as a wrapper for encrypted Garlic Messages and Garlic Cloves. Also used previously for network load testing.
A length Integer, followed by opaque data.
{% highlight lang='dataspec' %} +----+----+----+----+----+-// | length | data... +----+----+----+----+----+-// {% endhighlight %}See also the tunnel creation specification.
See also the tunnel creation specification.