{% extends "global/layout.html" %} {% block title %}I2NP Specification{% endblock %} {% block lastupdated %}January 2015{% endblock %} {% block accuratefor %}0.9.17{% 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.
All routers must publish their I2NP protocol version in the "router.version" field in the RouterInfo properties. This version field indicates their level of support for various I2NP protocol features, and is not necessarily the actual router version.
If alternative (non-Java) routers wish to publish any version information about the actual router implementation, they must do so in another property. Versions other than those listed below are allowed. Support will be determined through a numeric comparison; for example, 0.9.13 implies support for 0.9.12 features. Note that the "coreVersion" property is not used for determination of the I2NP protocol version.
A basic summary of the I2NP protocol versions is as follows. For details, see below.
Version | Required I2NP Features |
---|---|
0.9.18 | DSM type bits 7-1 ignored |
0.9.16 | RI key certs / ECDSA and EdDSA sig types Note: RSA sig types also supported as of this version, but currently unused DLM lookup types (DLM flag bits 3-2) |
0.9.15 | Dest/LS key certs w/ EdDSA Ed25519 sig type (if floodfill) |
0.9.12 | Dest/LS key certs w/ ECDSA P-256, P-384, and P-521 sig types (if floodfill) Note: RSA sig types also supported as of this version, but currently unused Nonzero expiration allowed in RouterAddress |
0.9.7 | Encrypted DSM/DSRM replies supported (DLM flag bit 1) (if floodfill) |
0.9.6 | Nonzero DLM flag bits 7-1 allowed |
0.9.3 | Requires zero expiration in RouterAddress |
0.9 | Supports up to 16 leases in a DSM LS store (6 previously) |
0.7.12 | VTBM and VTBRM message support |
0.7.10 | Floodfill supports encrypted DSM stores |
0.7.9 or lower | All messages and features not listed above |
0.6.1.10 | TBM and TBRM messages introduced Minimum version compatible with current network |
Note that there are also transport-related features and compatibility issues; see the NTCP and SSU transport documentation for details.
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.
This specification is for Delivery Instructions inside Garlic Cloves only. Note that "Delivery Instructions" are also used inside Tunnel Messages, where the format is significantly different. See the Tunnel Message documentation for details. Do NOT use the following specification for Tunnel Message Delivery Instructions! {% highlight lang='dataspec' %} +----+----+----+----+----+----+----+----+ |flag| | +----+ + | | + Session Key (optional) + | | + + | | + +----+----+----+----+--------------+ | | | +----+ + | | + To Hash (optional) + | | + + | | + +----+----+----+----+--------------+ | | Tunnel ID (opt) | Delay (opt) +----+----+----+----+----+----+----+----+ | +----+ {% endhighlight %}
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_tunnelId +----+----+----+----+----+----+----+----+ | SHA256 of the gateway RouterInfo | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | data ... +----+-// with reply token == 0: +----+----+----+----+----+----+----+----+ | SHA256 Hash as key | + + | | + + | | + + | | +----+----+----+----+----+----+----+----+ |type| 0 | data ... +----+----+----+----+----+-// {% endhighlight %}A request to look up an item in the network database. The response is either a DatabaseStore or a DatabaseSearchReply.
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_hashes | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | from | +----+ + | | + + | | + + | | + +----+----+----+----+----+----+----+ | | +----+ {% endhighlight %}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 %}A message sent from a tunnel's gateway or participant to the next participant or endpoint. The data is of fixed length, containing I2NP messages that are fragmented, batched, padded, and encrypted.
Wraps another I2NP message to be sent into a tunnel at the tunnel's inbound gateway.
Used by Garlic Messages and Garlic Cloves to wrap arbitrary data.
A length Integer, followed by opaque data.
{% highlight lang='dataspec' %} +----+----+----+----+----+-//-+ | length | data... | +----+----+----+----+----+-//-+ {% endhighlight %}