delvingbitcoin

Revisiting BIP21

Revisiting BIP21

Original Postby MattCorallo

Posted on: March 7, 2024 15:02 UTC

The discussion revolves around the optimization and clarity of URI parsing for Bitcoin payment addresses, specifically in the context of a proposed change to BIP 21.

The debate centers on how best to handle the representation of different types of Bitcoin addresses to minimize ambiguity and ensure backward compatibility during upgrade cycles. One suggestion is that future address formats should be placed in query keys as optional payment instructions. This method aims to provide a clear distinction between where to look for any given address type, thereby simplifying the parsing process. According to the new wording suggested for BIP 21, there will be only one location to search for an address type, eliminating confusion about whether to look in the root or in the keys/values section.

Furthermore, the conversation touches upon the current handling of address types that are encoded in either bech32 or bech32m format but do not have an associated BIP21 extension key. The proposition emphasizes utilizing a standard approach across Bitcoin and Lightning networks, which supports these existing address formats efficiently and also accommodates any new address types that might emerge using the same encoding scheme. For address types that do not fall into the specified categories and lack a BIP21 extension key, the use of key-value pairs is suggested to maintain consistency.

The dialogue also examines the specific cases of BOLT 11 lightning payments and the consideration for Silent Payments and BOLT12. It is recognized that BOLT 11 payments will always use the key-value (K/V) format with the "lightning" key, indicating that this aspect is unlikely to change. However, there is some flexibility in how Silent Payments and BOLT12 might be handled, with the possibility of using either K/V or a non-K/V format. The preference leans slightly towards continuing the use of K/V pairs due to their compatibility with existing code that parses URI parameters into such pairs, despite a slight inefficiency in terms of byte usage.