Skip to content

Commit 555dff7

Browse files
committed
Specify lexicographical order for fragment params
The rationale for this change is that since `-` instead of `+` breaks compatibility anyway, the marginal cost of removing this unusual/surprising requirement for reverse lexicographical ordering is zero.
1 parent 7ea6cfe commit 555dff7

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

bip-0077.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Post-History: https://github.com/bitcoin/bips/pull/1483
99
https://gnusha.org/pi/bitcoindev/[email protected]/#t
1010
https://gnusha.org/pi/bitcoindev/[email protected]/#t
11+
Version: 0.2.0
1112
Status: Draft
1213
Type: Standards Track
1314
Created: 2023-08-08
@@ -234,26 +235,30 @@ These session-specific parameters use a bech32-inspired encoding.
234235
The HRP is used as the parameter key, followed by the '1' separator,
235236
followed by the parameter value encoded using the bech32 character set in
236237
[uppercase](#uppercase-url). No checksum is used. Parameters are separated
237-
by a `-` character (previously a `+` separator [was specified](#bip-77)).
238+
by a `-` character.
238239

239-
The following parameters are defined, and must be provided in reverse
240-
lexicographical order:
240+
The following parameters are defined, and must be provided in lexicographical
241+
order:
241242

242-
- `RK`: encodes the *receiver key* as a 33-byte compressed public key.
243-
Senders will initiate HPKE with the receiver using this key.
243+
- `EX`: specifies a [session
244+
expiration](#session-expiration) in [unix
245+
time](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16).
244246
- `OH`: encodes an alternate format of the OHTTP Key Configuration of
245247
the directory. It consists of a 33-byte compressed public key of the
246248
directory's OHTTP Gateway, prefixed by the 2-byte Key Identifier. A [
247249
RFC 9458 Key
248250
Configuration](https://www.ietf.org/rfc/rfc9458.html#section-3.1)
249251
is reconstructed by assuming the HPKE KEM ID and Symmetric Algorithms
250252
are [fixed](#secp256k1-hybrid-public-key-encryption).
251-
- `EX`: specifies a [session
252-
expiration](#session-expiration) in [unix
253-
time](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16).
253+
- `RK`: encodes the *receiver key* as a 33-byte compressed public key.
254+
Senders will initiate HPKE with the receiver using this key.
254255

255256
For example, a properly encoded endpoint Bitcoin URI looks like this
256-
`bitcoin:tb1q6q6de88mj8qkg0q5lupmpfexwnqjsr4d2gvx2p?amount=0.00666666&pjos=0&pj=HTTPS://PAYJO.IN/TXJCGKTKXLUUZ%23RK1Q0DJS3VVDXWQQTLQ8022QGXSX7ML9PHZ6EDSF6AKEWQG758JPS2EV-OH1QYPM59NK2LXXS4890SUAXXYT25Z2VAPHP0X7YEYCJXGWAG6UG9ZU6NQ-EX1WKV8CEC`
257+
`bitcoin:tb1q6q6de88mj8qkg0q5lupmpfexwnqjsr4d2gvx2p?amount=0.00666666&pjos=0&pj=HTTPS://PAYJO.IN/TXJCGKTKXLUUZ%23EX1WKV8CEC-OH1QYPM59NK2LXXS4890SUAXXYT25Z2VAPHP0X7YEYCJXGWAG6UG9ZU6NQ-RK1Q0DJS3VVDXWQQTLQ8022QGXSX7ML9PHZ6EDSF6AKEWQG758JPS2EV`
258+
259+
Until 2026 implementations SHOULD also accept `+` as a fragment parameter
260+
separator and not enforce parameter ordering requirements, for compatibility
261+
with the [previous version of this document](#changelog).
257262

258263
### Sender Original PSBT Messaging
259264

@@ -711,8 +716,6 @@ receiver also specifies the directory.
711716

712717
## Backwards compatibility
713718

714-
### BIP 78
715-
716719
Senders not supporting Payjoin will just ignore the `pj` parameter and
717720
proceed to typical address-based transaction flows.
718721

@@ -728,18 +731,6 @@ seconds or else the directory should respond with an `unavailable` JSON
728731
error code as [defined in BIP
729732
78](https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#receivers-well-known-errors).
730733

731-
### BIP 77
732-
733-
A previous version of this document specified `+` as the fragment parameter
734-
separator. This can cause issues due to a common convention (not specified in
735-
RFC 3986, but in RFC 1866 in relation to HTML form submission and query
736-
parameters, not URI fragments) of representing ` ` with `+` in URI query
737-
parameters.
738-
739-
As a result of this change implementations are encouraged to still accept `+`
740-
delimited fragment parameters for during 2026 (a grace period of just under 6
741-
months).
742-
743734
## Reference implementation
744735

745736
A production reference implementation client can be found at
@@ -748,3 +739,15 @@ directory, and development kit may be found here:
748739
<https://github.com/payjoin/rust-payjoin>. Source code for an Oblivious
749740
HTTP relay implementation may be found here:
750741
<https://github.com/payjoin/ohttp-relay>.
742+
743+
## Changelog
744+
745+
- 0.2.0 Jul 8 2025
746+
- Change fragment parameter delimiter from `+` to `-` to improve
747+
compatibility with generic URI parsing libraries, and order them
748+
lexicographically. `+` can cause issues due to a common convention (not
749+
specified in RFC 3986, but in RFC 1866, in relation to HTML form
750+
submission and query parameters) of interperting `+` as ` ` when decoding
751+
URIs.
752+
- 0.1.0 May 28 2025
753+
- First merged Draft version of BIP 77

0 commit comments

Comments
 (0)