From 9f3dc5d7a556664cd7640b8cac4687cfb17f474b Mon Sep 17 00:00:00 2001
From: William Swanson <swansontec@gmail.com>
Date: Thu, 6 Mar 2014 17:15:33 -0800
Subject: BIP 21: Add a missing "&" rule to the ABNF grammar

The URI syntax uses an ampersand to separate query parameters,
but the ABNF grammar didn't reflect this fact.

Also, the type of grammar used here is "ABNF" and not "BNF".
---
 bip-0021.mediawiki | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'bip-0021.mediawiki')

diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki
index 8f2201b..9be8b9e 100644
--- a/bip-0021.mediawiki
+++ b/bip-0021.mediawiki
@@ -26,13 +26,13 @@ They SHOULD require the user to manually approve each payment individually, thou
 === Operating system integration ===
 Graphical bitcoin clients SHOULD register themselves as the handler for the "bitcoin:" URI scheme by default, if no other handler is already registered. If there is already a registered handler, they MAY prompt the user to change it once when they first run the client.
 
-=== BNF grammar ===
+=== ABNF grammar ===
 
 (See also [[#Simpler syntax|a simpler representation of syntax]])
 
  bitcoinurn     = "bitcoin:" bitcoinaddress [ "?" bitcoinparams ]
  bitcoinaddress = base58 *base58
- bitcoinparams  = *bitcoinparam
+ bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]
  bitcoinparam   = amountparam | labelparam | messageparam | otherparam | reqparam
  amountparam    = "amount=" *digit [ "." *digit ]
  labelparam     = "label=" *pchar
-- 
cgit v1.2.3


From 0ee7ff7beddeb9e4beb04a4fd9fd4071687963f1 Mon Sep 17 00:00:00 2001
From: William Swanson <swansontec@gmail.com>
Date: Thu, 6 Mar 2014 17:34:26 -0800
Subject: BIP 21: Mention RFC 3986 and character set

---
 bip-0021.mediawiki | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'bip-0021.mediawiki')

diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki
index 9be8b9e..5512a01 100644
--- a/bip-0021.mediawiki
+++ b/bip-0021.mediawiki
@@ -26,6 +26,12 @@ They SHOULD require the user to manually approve each payment individually, thou
 === Operating system integration ===
 Graphical bitcoin clients SHOULD register themselves as the handler for the "bitcoin:" URI scheme by default, if no other handler is already registered. If there is already a registered handler, they MAY prompt the user to change it once when they first run the client.
 
+=== General Format ===
+
+Bitcoin URIs follow the general format for URIs as set forth in RFC 3986. The path component consists of a bitcoin address, and the query component provides additional payment options.
+
+Elements of the query component may contain characters outside the valid range. These must first be encoded according to UTF-8, and then each octet of the corresponding UTF-8 sequence must be percent-encoded as described in RFC 3986.
+
 === ABNF grammar ===
 
 (See also [[#Simpler syntax|a simpler representation of syntax]])
-- 
cgit v1.2.3


From c823eeb5964be9abec8b146293ee82933be7ca72 Mon Sep 17 00:00:00 2001
From: William Swanson <swansontec@gmail.com>
Date: Thu, 6 Mar 2014 17:57:42 -0800
Subject: BIP 21: Precisely define the valid query characters

---
 bip-0021.mediawiki | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'bip-0021.mediawiki')

diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki
index 5512a01..fba47f3 100644
--- a/bip-0021.mediawiki
+++ b/bip-0021.mediawiki
@@ -41,10 +41,12 @@ Elements of the query component may contain characters outside the valid range.
  bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]
  bitcoinparam   = amountparam | labelparam | messageparam | otherparam | reqparam
  amountparam    = "amount=" *digit [ "." *digit ]
- labelparam     = "label=" *pchar
- messageparam   = "message=" *pchar
- otherparam     = pchar *pchar "=" *pchar
- reqparam       = "req-" pchar *pchar "=" *pchar
+ labelparam     = "label=" *qchar
+ messageparam   = "message=" *qchar
+ otherparam     = qchar *qchar "=" *qchar
+ reqparam       = "req-" qchar *qchar "=" *qchar
+
+Here, "qchar" corresponds to valid characters of an RFC 3986 URI query component, excluding the "=" and "&" characters, which this BIP takes as separators.
 
 === Query Keys ===
 
-- 
cgit v1.2.3


From 6f15f98b1256bfe097962b0e9ad56ed9c5e5ab7c Mon Sep 17 00:00:00 2001
From: William Swanson <swansontec@gmail.com>
Date: Mon, 10 Mar 2014 18:04:10 -0700
Subject: BIP 21: Clarify case-sensitivity

The "bitcoin:" URI scheme needs to be case-insensitive according to the RFC,
but the query parameters should be case-sensitive according to the bitcoin-qt
client implementation.
---
 bip-0021.mediawiki | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'bip-0021.mediawiki')

diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki
index fba47f3..44cca1f 100644
--- a/bip-0021.mediawiki
+++ b/bip-0021.mediawiki
@@ -48,6 +48,8 @@ Elements of the query component may contain characters outside the valid range.
 
 Here, "qchar" corresponds to valid characters of an RFC 3986 URI query component, excluding the "=" and "&" characters, which this BIP takes as separators.
 
+The scheme component ("bitcoin:") is case-insensitive, and implementations must accept any combination of uppercase and lowercase letters. The rest of the URI is case-sensitive, including the query parameter keys.
+
 === Query Keys ===
 
 *label: Label for that address (e.g. name of receiver)
-- 
cgit v1.2.3


From 116129c6878a14415afba89e90b8ddd3a12b477e Mon Sep 17 00:00:00 2001
From: William Swanson <swansontec@gmail.com>
Date: Mon, 10 Mar 2014 18:10:27 -0700
Subject: BIP 21: Allow empty addresses and query parameters

Empty addresses should be valid for compatibility with  BIP 72.

Empty query parameters should also be valid, since they are harmless,
and clients already accept them.

With these changes, bitcoin:?& would be a valid (but useless) URI.
---
 bip-0021.mediawiki | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'bip-0021.mediawiki')

diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki
index 44cca1f..e64a71e 100644
--- a/bip-0021.mediawiki
+++ b/bip-0021.mediawiki
@@ -37,14 +37,14 @@ Elements of the query component may contain characters outside the valid range.
 (See also [[#Simpler syntax|a simpler representation of syntax]])
 
  bitcoinurn     = "bitcoin:" bitcoinaddress [ "?" bitcoinparams ]
- bitcoinaddress = base58 *base58
+ bitcoinaddress = *base58
  bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]
- bitcoinparam   = amountparam | labelparam | messageparam | otherparam | reqparam
+ bitcoinparam   = [ amountparam / labelparam / messageparam / otherparam / reqparam ]
  amountparam    = "amount=" *digit [ "." *digit ]
  labelparam     = "label=" *qchar
  messageparam   = "message=" *qchar
- otherparam     = qchar *qchar "=" *qchar
- reqparam       = "req-" qchar *qchar "=" *qchar
+ otherparam     = qchar *qchar [ "=" *qchar ]
+ reqparam       = "req-" qchar *qchar [ "=" *qchar ]
 
 Here, "qchar" corresponds to valid characters of an RFC 3986 URI query component, excluding the "=" and "&" characters, which this BIP takes as separators.
 
-- 
cgit v1.2.3

