<p>The ABNF in BIP21 indicates that the <code>bitcoinparam</code> can be in any order.</p>
<pre><code>bitcoinurn     = &quot;bitcoin:&quot; bitcoinaddress [ &quot;?&quot; bitcoinparams ]
bitcoinaddress = *base58
bitcoinparams  = bitcoinparam [ &quot;&amp;&quot; bitcoinparams ]
bitcoinparam   = [ amountparam / labelparam / messageparam / otherparam / reqparam ]
</code></pre>
<p>The third item in this list shows that ordering is not important. Any valid <code>bitcoinparam</code> can be first in the RHS expression. You can then prepend any other <code>bitcoinparam</code> using the same rule. Repeat as needed.</p>

CC BY-SA 4.0
2022-06-02T15:14:09.473Z
2022-06-02T15:14:09.473Z
RedGrittyBrick
<p>I need some help understanding a finer point of <a href="https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki" rel="nofollow noreferrer">BIP21 URIs</a>. Is there a required order for the parameters? I'm not very experienced with the concept of ABNF grammar, so I'm having trouble understanding.</p>
<p>For example, I know this is valid.</p>
<p><code>bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&amp;label=Luke-Jr</code></p>
<p>And I know this valid:</p>
<p><code>bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&amp;label=Luke-Jr&amp;optionalparam=blahblahblah</code></p>
<p>But is this valid?</p>
<p><code>bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?optionalparam=blahblahblah&amp;amount=20.3&amp;label=Luke-Jr</code></p>
<p>Very specifically, must the order of parameters always be amount, label, message, and then optional params? Or is it OK to include optional params before the amount?</p>

<bip21-uri>
Do BIP21 URIs have a required order for the parameters?
Stephen DeLorme
# Do BIP21 URIs have a required order for the parameters?

(Asked by: username_0 on 2022-06-02)

I need some help understanding a finer point of [BIP21 URIs](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki). Is there a required order for the parameters? I'm not very experienced with the concept of ABNF grammar, so I'm having trouble understanding.

For example, I know this is valid.

`bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr`

And I know this valid:

`bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr&optionalparam=blahblahblah`

But is this valid?

`bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?optionalparam=blahblahblah&amount=20.3&label=Luke-Jr`

Very specifically, must the order of parameters always be amount, label, message, and then optional params? Or is it OK to include optional params before the amount?

**Tags:** bip21-uri


---

## 1 answers

### Answer by username_1 on 2022-06-02. Score: 2 | Accepted answer

The ABNF in BIP21 indicates that the `bitcoinparam` can be in any order.

```
bitcoinurn     = "bitcoin:" bitcoinaddress [ "?" bitcoinparams ]
bitcoinaddress = *base58
bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]
bitcoinparam   = [ amountparam / labelparam / messageparam / otherparam / reqparam ]

```

The third item in this list shows that ordering is not important. Any valid `bitcoinparam` can be first in the RHS expression. You can then prepend any other `bitcoinparam` using the same rule. Repeat as needed.


---

