{"number":155,"title":"addrv2 message","authors":["Wladimir J. van der Laan"],"status":"Deployed","type":"Specification","layer":"Peer Services","created":"2019-02-27","license":"BSD-2-Clause","version":"2.1.1","requires":[],"replaces":[],"replacedBy":[],"discussion":[],"abstract":"This document proposes a new P2P message to gossip longer node addresses over the P2P network. This is required to support new-generation Onion addresses, I2P, and potentially other networks that have longer endpoint addresses than fit in the 128 bits of the current addr message.","eli5":"Adds a new message for sharing node addresses that are longer than the old format allows. This was necessary to support newer Tor onion addresses, I2P, and other privacy networks, helping nodes connect privately.","categories":["network"],"filename":"bip-0155.mediawiki","githubUrl":"https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki","format":"mediawiki","readingMinutes":5,"inbound":0,"revisions":25,"impact":34,"core":false,"references":[],"lastModified":"2026-08-08","html":"<h2 id=\"introduction\">Introduction</h2>\n<h3 id=\"abstract\">Abstract</h3>\n<p>This document proposes a new P2P message to gossip longer node addresses over the P2P network. This is required to support new-generation Onion addresses, I2P, and potentially other networks that have longer endpoint addresses than fit in the 128 bits of the current <code>addr</code> message.</p>\n<h3 id=\"copyright\">Copyright</h3>\n<p>This BIP is licensed under the 2-clause BSD license.</p>\n<h3 id=\"motivation\">Motivation</h3>\n<p>Tor v3 hidden services are part of the stable release of Tor since version 0.3.2.9. They have various advantages compared to the old hidden services, among which are better encryption and privacy <sup class=\"footnote-ref\"><a href=\"#fn-1\" id=\"fnref-1\">[1]</a></sup>. These services have 256 bit addresses and thus do not fit in the existing <code>addr</code> message, which encapsulates onion addresses in OnionCat IPv6 addresses.</p>\n<p>Other transport-layer protocols such as I2P have always used longer addresses. This change would make it possible to gossip such addresses over the P2P network, so that other peers can connect to them.</p>\n<h2 id=\"specification\">Specification</h2>\n<blockquote> The key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\", \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\",  \"MAY\", and \"OPTIONAL\" in this document are to be interpreted as described in RFC 2119<sup class=\"footnote-ref\"><a href=\"#fn-2\" id=\"fnref-2\">[2]</a></sup>. </blockquote>\n<p>The <code>addrv2</code> message is defined as a message where <code>pchCommand == \"addrv2\"</code>. It is serialized in the standard encoding for P2P messages. Its format is similar to the current <code>addr</code> message format, with the difference that the fixed 16-byte IP address is replaced by a network ID and a variable-length address, and the services format has been changed to <a href=\"https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer\">CompactSize</a>.</p>\n<p>This means that the message contains a serialized <code>std::vector</code> of the following structure:</p>\n<div class=\"table-wrap\"><table><tbody><tr><th>Type</th><th>Name</th><th>Description</th></tr><tr><td><code>uint32_t</code></td><td><code>time</code></td><td>Time that this node was last seen as connected to the network. A time in Unix epoch time format.</td></tr><tr><td><code>CompactSize</code></td><td><code>services</code></td><td>Service bits. A bit field that is 64 bits wide, encoded in <a href=\"https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer\">CompactSize</a>.</td></tr><tr><td><code>uint8_t</code></td><td><code>networkID</code></td><td>Network identifier. An 8-bit value that specifies which network is addressed.</td></tr><tr><td><code>std::vector&lt;uint8_t&gt;</code></td><td><code>addr</code></td><td>Network address. The interpretation depends on networkID.</td></tr><tr><td><code>uint16_t</code></td><td><code>port</code></td><td>Network port. If not relevant for the network this MUST be 0.</td></tr></tbody></table></div>\n<p>One message can contain up to 1,000 addresses. Clients SHOULD reject messages with more addresses.</p>\n<p>Field <code>addr</code> has a variable length, with a maximum of 512 bytes (4096 bits). Clients SHOULD reject messages with longer addresses, irrespective of the network ID.</p>\n<p>The list of reserved network IDs is as follows:</p>\n<div class=\"table-wrap\"><table><tbody><tr><th>Network ID</th><th>Enumeration</th><th>Address length (bytes)</th><th>Description</th></tr><tr><td><code>0x01</code></td><td><code>IPV4</code></td><td>4</td><td>IPv4 address (globally routed internet)</td></tr><tr><td><code>0x02</code></td><td><code>IPV6</code></td><td>16</td><td>IPv6 address (globally routed internet)</td></tr><tr><td><code>0x03</code></td><td><code>TORV2</code></td><td>10</td><td>Tor v2 hidden service address (no longer used<sup class=\"footnote-ref\"><a href=\"#fn-3\" id=\"fnref-3\">[3]</a></sup>)</td></tr><tr><td><code>0x04</code></td><td><code>TORV3</code></td><td>32</td><td>Tor v3 hidden service address</td></tr><tr><td><code>0x05</code></td><td><code>I2P</code></td><td>32</td><td>I2P overlay network address</td></tr><tr><td><code>0x06</code></td><td><code>CJDNS</code></td><td>16</td><td>Cjdns overlay network address</td></tr><tr><td><code>0x07</code></td><td><code>YGGDRASIL</code></td><td>16</td><td>Yggdrasil overlay network address</td></tr></tbody></table></div>\n<p>Clients are RECOMMENDED to gossip addresses from all known networks even if they are currently not connected to some of them. That could help multi-homed nodes and make it more difficult for an observer to tell which networks a node is connected to.</p>\n<p>Clients SHOULD NOT gossip addresses from unknown networks because they have no means to validate those addresses and so can be tricked to gossip invalid addresses.</p>\n<p>Further network ID numbers MUST be reserved in a new BIP document.</p>\n<p>Clients SHOULD reject messages that contain addresses that have a different length than specified in this table for a specific network ID, as these are meaningless.</p>\n<p>Some ranges of the <code>IPV6</code> address space are reserved for embedding addresses of other networks (for example the IPv4-in-IPv6 range <code>::ffff:0:0/96</code>). Such addresses already have a canonical encoding under their own network ID and MUST NOT be sent with the <code>IPV6</code> network ID. Clients SHOULD ignore <code>IPV6</code> addresses that fall into these reserved ranges on receive, since the same address received under two network IDs would otherwise be treated as two distinct peers.</p>\n<p>See the appendices for the address encodings to be used for the various networks.</p>\n<h2 id=\"signaling-support-and-compatibility\">Signaling support and compatibility</h2>\n<p>Introduce a new message type <code>sendaddrv2</code>. Sending such a message indicates that a node can understand and prefers to receive <code>addrv2</code> messages instead of <code>addr</code> messages. I.e. \"Send me addrv2\". Sending or not sending this message does not imply any preference with respect to receiving unrequested address messages.</p>\n<p>The <code>sendaddrv2</code> message MUST only be sent in response to the <code>version</code> message from a peer and prior to sending the <code>verack</code> message.</p>\n<p>For older peers, that did not emit <code>sendaddrv2</code>, keep sending the legacy <code>addr</code> message, ignoring addresses with the newly introduced address types.</p>\n<h2 id=\"reference-implementation\">Reference implementation</h2>\n<p>Original reference implementation in Bitcoin Core:</p>\n<ul><li>\n<a href=\"https://github.com/bitcoin/bitcoin/issues/18884\">https://github.com/bitcoin/bitcoin/issues/18884</a>\n</li></ul>\n<ul><li>\n<a href=\"https://github.com/bitcoin/bitcoin/pull/19954\">https://github.com/bitcoin/bitcoin/pull/19954</a>\n</li></ul>\n<ul><li>\n<a href=\"https://github.com/bitcoin/bitcoin/pull/20119\">https://github.com/bitcoin/bitcoin/pull/20119</a>\n</li></ul>\n<h2 id=\"acknowledgements\">Acknowledgements</h2>\n<p>- Jonas Schnelli: change <code>services</code> field to <a href=\"https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer\">CompactSize</a>, to make the message more compact in the likely case instead of always using 8 bytes.</p>\n<p>- Gregory Maxwell: various suggestions regarding extensibility</p>\n<h2 id=\"appendix-a-tor-v2-address-encoding-no-longer-used-3\">Appendix A: Tor v2 address encoding (no longer used <sup class=\"footnote-ref\"><a href=\"#fn-3\" id=\"fnref-3\">[3]</a></sup>)</h2>\n<p>The new message introduces a separate network ID for <code>TORV2</code>.</p>\n<p>Clients MUST send Tor hidden service addresses with this network ID, with the 80-bit hidden service ID in the address field. This is the same as the representation in the legacy <code>addr</code> message, minus the 6 byte prefix of the OnionCat wrapping.</p>\n<p>Clients SHOULD ignore OnionCat (<code>fd87:d87e:eb43::/48</code>) addresses on receive if they come with the <code>IPV6</code> network ID.</p>\n<h2 id=\"appendix-b-tor-v3-address-encoding\">Appendix B: Tor v3 address encoding</h2>\n<p>According to the spec <sup class=\"footnote-ref\"><a href=\"#fn-4\" id=\"fnref-4\">[4]</a></sup>, next-gen <code>.onion</code> addresses are encoded as follows:</p>\n<pre><code>onion_address = base32(PUBKEY | CHECKSUM | VERSION) + \".onion\"\n CHECKSUM = H(\".onion checksum\" | PUBKEY | VERSION)[:2]\n\n where:\n   - PUBKEY is the 32 bytes ed25519 master pubkey of the hidden service\n   - VERSION is a one byte version field (default value '\\x03')\n   - \".onion checksum\" is a constant string\n   - CHECKSUM is truncated to two bytes before inserting it in onion_address\n   - H() is the SHA3-256 cryptographic hash function</code></pre>\n<p>Tor v3 addresses MUST be sent with the <code>TORV3</code> network ID, with the 32-byte PUBKEY part in the address field. As VERSION will always be '\\x03' in the case of v3 addresses, this is enough to reconstruct the onion address.</p>\n<h2 id=\"appendix-c-i2p-address-encoding\">Appendix C: I2P address encoding</h2>\n<p>Like Tor, I2P naming uses a base32-encoded address format<sup class=\"footnote-ref\"><a href=\"#fn-5\" id=\"fnref-5\">[5]</a></sup>.</p>\n<p>I2P uses 52 characters (256 bits) to represent the full SHA-256 hash, followed by <code>.b32.i2p</code>.</p>\n<p>I2P addresses MUST be sent with the <code>I2P</code> network ID, with the decoded SHA-256 hash as address field.</p>\n<h2 id=\"appendix-d-cjdns-address-encoding\">Appendix D: Cjdns address encoding</h2>\n<p>Cjdns addresses are simply IPv6 addresses in the <code>fc00::/8</code> range<sup class=\"footnote-ref\"><a href=\"#fn-6\" id=\"fnref-6\">[6]</a></sup>. They MUST be sent with the <code>CJDNS</code> network ID.</p>\n<h2 id=\"appendix-e-yggdrasil-address-encoding\">Appendix E: Yggdrasil address encoding</h2>\n<p>Yggdrasil addresses are simply IPv6 addresses in the <code>0200::/7</code> range<sup class=\"footnote-ref\"><a href=\"#fn-7\" id=\"fnref-7\">[7]</a></sup>. They MUST be sent with the <code>YGGDRASIL</code> network ID.</p>\n<h2 id=\"changelog\">Changelog</h2>\n<ul><li>\n2.1.1 (2026-08-08):\n<ul><li>\nAdd links to reference implementation.\n</li></ul>\n</li><li>\n2.1.0 (2026-08-03):\n<ul><li>\nDocument that IPv4-in-IPv6 range MUST NOT be sent with the IPV6 network ID and SHOULD be ignored on receive.\n</li></ul>\n</li><li>\n2.0.0 (2025-10-01):\n<ul><li>\nAdd note that Tor v2 is no longer operational.\n</li></ul>\n</li><li>\n1.0.0 (2019-02-27):\n<ul><li>\nInitial version\n</li></ul>\n</li></ul>\n<h2 id=\"references\">References</h2>\n<ol class=\"footnotes\"><li id=\"fn-1\"><a href=\"https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt\">Tor Rendezvous Specification - Version 3</a> <a href=\"#fnref-1\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-2\"><a href=\"https://tools.ietf.org/html/rfc2119\">RFC 2119</a> <a href=\"#fnref-2\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-3\">Tor v2 is no longer operational; clients MUST NOT gossip or relay Tor v2 addresses and MUST ignore them on receive <a href=\"#fnref-3\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-4\"><a href=\"https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt\">Tor Rendezvous Specification - Version 3: Encoding onion addresses</a> <a href=\"#fnref-4\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-5\"><a href=\"https://geti2p.net/en/docs/naming#base32\">I2P: Naming and address book</a> <a href=\"#fnref-5\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-6\"><a href=\"https://github.com/cjdelisle/cjdns/blob/6e46fa41f5647d6b414612d9d63626b0b952746b/doc/Whitepaper.md#pulling-it-all-together\">Cjdns whitepaper: Pulling It All Together</a> <a href=\"#fnref-6\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li><li id=\"fn-7\"><a href=\"https://yggdrasil-network.github.io/faq.html#will-yggdrasil-conflict-with-my-network-routing\">Yggdrasil FAQ</a> <a href=\"#fnref-7\" class=\"footnote-back\" aria-label=\"Back to text\">↩</a></li></ol>","toc":[{"id":"introduction","title":"Introduction","level":2},{"id":"abstract","title":"Abstract","level":3},{"id":"copyright","title":"Copyright","level":3},{"id":"motivation","title":"Motivation","level":3},{"id":"specification","title":"Specification","level":2},{"id":"signaling-support-and-compatibility","title":"Signaling support and compatibility","level":2},{"id":"reference-implementation","title":"Reference implementation","level":2},{"id":"acknowledgements","title":"Acknowledgements","level":2},{"id":"appendix-a-tor-v2-address-encoding-no-longer-used-3","title":"Appendix A: Tor v2 address encoding (no longer used [3])","level":2},{"id":"appendix-b-tor-v3-address-encoding","title":"Appendix B: Tor v3 address encoding","level":2},{"id":"appendix-c-i2p-address-encoding","title":"Appendix C: I2P address encoding","level":2},{"id":"appendix-d-cjdns-address-encoding","title":"Appendix D: Cjdns address encoding","level":2},{"id":"appendix-e-yggdrasil-address-encoding","title":"Appendix E: Yggdrasil address encoding","level":2},{"id":"changelog","title":"Changelog","level":2},{"id":"references","title":"References","level":2}],"history":{"totalCommits":25,"firstCommit":"2019-07-18T00:17:55+02:00","lastUpdated":"2026-08-08T10:40:49-06:00","events":[{"sha":"8d4ccf6e0c9622f8f809f5fc6d21103a05378057","date":"2026-08-08T10:40:49-06:00","author":"Jon Atack","message":"bip 155: add reference implementation","url":"https://github.com/bitcoin/bips/commit/8d4ccf6e0c9622f8f809f5fc6d21103a05378057","kind":"edit"},{"sha":"8a4ed72e28004166608e2c461f53d8e555f93763","date":"2026-08-03T10:59:45-03:00","author":"Bruno Garcia","message":"BIP155: mention IPv4-in-IPv6 range MUST NOT be sent within IPV6","url":"https://github.com/bitcoin/bips/commit/8a4ed72e28004166608e2c461f53d8e555f93763","kind":"edit"},{"sha":"4486d6de91c9b46c256fec215f13fac818410a37","date":"2025-12-15T16:48:19-08:00","author":"Murch","message":"process: Backfill missing Version headers","url":"https://github.com/bitcoin/bips/commit/4486d6de91c9b46c256fec215f13fac818410a37","kind":"edit"},{"sha":"24e96e870fffaa257b465ce1f0370c14aac588e8","date":"2025-10-08T14:59:36-07:00","author":"Murch","message":"process: Created ↦ Assigned","url":"https://github.com/bitcoin/bips/commit/24e96e870fffaa257b465ce1f0370c14aac588e8","kind":"edit"},{"sha":"5207ef92a52d0b8902895b0dbb40823a4d698ec9","date":"2025-04-11T20:08:17-07:00","author":"Murch","message":"process: Author ↦ Authors","url":"https://github.com/bitcoin/bips/commit/5207ef92a52d0b8902895b0dbb40823a4d698ec9","kind":"edit"},{"sha":"59730dec4fb641a41589aa1b91d3c452f13e0e36","date":"2025-04-11T20:05:13-07:00","author":"Murch","message":"process: Remove Comments-URI and -Summary","url":"https://github.com/bitcoin/bips/commit/59730dec4fb641a41589aa1b91d3c452f13e0e36","kind":"edit"},{"sha":"a233bde4af52c6a11269e2e6dd9707abce441ffe","date":"2025-04-11T18:19:21-07:00","author":"Murch","message":"process: Standards Track ↦ Specification","url":"https://github.com/bitcoin/bips/commit/a233bde4af52c6a11269e2e6dd9707abce441ffe","kind":"edit"},{"sha":"5d3ceb37734f80b2ec206fc94245e3bfd6d5b0f0","date":"2025-04-11T18:08:44-07:00","author":"Murch","message":"process: Final/Active ↦ Deployed","url":"https://github.com/bitcoin/bips/commit/5d3ceb37734f80b2ec206fc94245e3bfd6d5b0f0","kind":"status"},{"sha":"7fd375c0e9242885f113db1c5aabc27a4cbbdbf8","date":"2025-10-01T14:55:18-03:00","author":"Bruno Garcia","message":"bip155: add changelog","url":"https://github.com/bitcoin/bips/commit/7fd375c0e9242885f113db1c5aabc27a4cbbdbf8","kind":"edit"},{"sha":"c85c818e3f18a14f0b9060f660059fe6995ce1ec","date":"2025-09-19T09:27:14-03:00","author":"Bruno Garcia","message":"bip155: torv2 is no longer operational","url":"https://github.com/bitcoin/bips/commit/c85c818e3f18a14f0b9060f660059fe6995ce1ec","kind":"edit"},{"sha":"862d9ca10613933dfb91a26962e46c8a906266d4","date":"2025-08-13T08:55:55-06:00","author":"Jon Atack","message":"BIP155: update Draft status to Final","url":"https://github.com/bitcoin/bips/commit/862d9ca10613933dfb91a26962e46c8a906266d4","kind":"status"},{"sha":"8137279570c2d38c8dda12c9654deed7f700c63c","date":"2025-04-17T15:46:10+08:00","author":"Jon Atack","message":"Monthly typo fixups","url":"https://github.com/bitcoin/bips/commit/8137279570c2d38c8dda12c9654deed7f700c63c","kind":"edit"},{"sha":"9a56d3544eac1f949a747c251810f7a440d63fb9","date":"2024-07-25T18:35:39+03:00","author":"Orfeas Stefanos Thyfronitis Litos","message":"Remove trailing whitespace from all BIPs","url":"https://github.com/bitcoin/bips/commit/9a56d3544eac1f949a747c251810f7a440d63fb9","kind":"edit"},{"sha":"4fb3cf55eb7a367cda86087d60f6c7f281ab08ae","date":"2021-11-18T23:55:55+01:00","author":"Pavol Rusnak","message":"BIP 155: add Yggdrasil","url":"https://github.com/bitcoin/bips/commit/4fb3cf55eb7a367cda86087d60f6c7f281ab08ae","kind":"edit"},{"sha":"337114b06eee649b5b2fe75dcbdcd7e5b984bbde","date":"2021-06-16T13:24:55+02:00","author":"Vasil Dimov","message":"BIP155: extra-clarify the semantic of sendaddrv2","url":"https://github.com/bitcoin/bips/commit/337114b06eee649b5b2fe75dcbdcd7e5b984bbde","kind":"edit"},{"sha":"cd1f225a0bd008efe1be5a1d60af3f68573b0ff4","date":"2020-12-15T10:02:17+01:00","author":"kiminuo","message":"BIP 155: Remove bitcoin.org link.","url":"https://github.com/bitcoin/bips/commit/cd1f225a0bd008efe1be5a1d60af3f68573b0ff4","kind":"edit"},{"sha":"e549ed36e8bbb0d15b1bd245cc5bb2c5664d5aa2","date":"2020-12-07T15:57:33+01:00","author":"Vasil Dimov","message":"BIP155: change when sendaddrv2 is to be sent","url":"https://github.com/bitcoin/bips/commit/e549ed36e8bbb0d15b1bd245cc5bb2c5664d5aa2","kind":"edit"},{"sha":"87ef5aaa7c10f4696d1fb0cc152bc3c0142acf8f","date":"2020-08-13T11:36:10+02:00","author":"Vasil Dimov","message":"BIP155: clarify that \"services\" uses CompactSize","url":"https://github.com/bitcoin/bips/commit/87ef5aaa7c10f4696d1fb0cc152bc3c0142acf8f","kind":"edit"},{"sha":"6ef71b344c51aebe1dab5ac47f87d8f926462a65","date":"2020-09-27T14:07:57+03:00","author":"Hennadii Stepanov","message":"BIP155: Small text improvements","url":"https://github.com/bitcoin/bips/commit/6ef71b344c51aebe1dab5ac47f87d8f926462a65","kind":"edit"},{"sha":"562f1d71883d1daa0dd5f438d25986fb18465800","date":"2020-09-27T14:06:19+03:00","author":"Hennadii Stepanov","message":"BIP155: Mention SHA3-256 explicitly","url":"https://github.com/bitcoin/bips/commit/562f1d71883d1daa0dd5f438d25986fb18465800","kind":"edit"},{"sha":"2c7630ec610712655119e40a218539e042c8d7b2","date":"2020-08-13T11:30:55+02:00","author":"Vasil Dimov","message":"BIP155: change \"time\" to fixed 32 bit unsigned","url":"https://github.com/bitcoin/bips/commit/2c7630ec610712655119e40a218539e042c8d7b2","kind":"edit"},{"sha":"350189ad489c99a426915b123502a8339ef8d1ba","date":"2020-06-09T09:36:26+02:00","author":"Vasil Dimov","message":"BIP155: use a dedicated message for signalling","url":"https://github.com/bitcoin/bips/commit/350189ad489c99a426915b123502a8339ef8d1ba","kind":"edit"},{"sha":"42ee3f5c15de34dfbe9473807d44685fa1354e86","date":"2020-04-10T09:46:48+02:00","author":"Vasil Dimov","message":"BIP155: include changes from followup discussions","url":"https://github.com/bitcoin/bips/commit/42ee3f5c15de34dfbe9473807d44685fa1354e86","kind":"edit"},{"sha":"e99347806027c63ac459c35ccda4abb1fa0b83c0","date":"2019-07-18T00:33:26+02:00","author":"Wladimir J. van der Laan","message":"bip155: Fix comments URL","url":"https://github.com/bitcoin/bips/commit/e99347806027c63ac459c35ccda4abb1fa0b83c0","kind":"edit"},{"sha":"34534b5ee1cf49cf67005b5457fce110ea6b0f4b","date":"2019-07-18T00:17:55+02:00","author":"Wladimir J. van der Laan","message":"bip155: fill in BIP number","url":"https://github.com/bitcoin/bips/commit/34534b5ee1cf49cf67005b5457fce110ea6b0f4b","kind":"edit"}]}}