<p>Per <a href="https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form" rel="nofollow noreferrer">ABNF</a> grammar, this would evaluate to a single amount field.</p>
<p>If it were to allow more 1 or more amount fields, it would be represented as <code>1*amount</code>. If it were to allow 1 OR two amount fields, it would be represented as <code>1*2amount</code>.</p>

CC BY-SA 4.0
2023-06-19T06:32:11.660Z
I see what you are saying. However, there is also: `bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]` and so I can place `bitcoinparam` as many times as I want and not necessarily different ones. Right?
Kiminuo
CC BY-SA 4.0
2023-06-16T15:14:58.903Z
2023-06-16T15:14:58.903Z
Raghav Sood
<p><a href="https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki" rel="nofollow noreferrer">BIP21</a> includes the following grammar rule:</p>
<pre><code>bitcoinparam   = [ amountparam / labelparam / messageparam / otherparam / reqparam ]
</code></pre>
<p>I'm not sure if this grammar rule allows to specify <code>amountparam</code> multiple times or not. An example might be:</p>
<p><code>bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&amp;amount=21&amp;label=Luke-Jr</code> (amount twice intentionally)</p>
<p>The <code>amount</code> parameter is specified twice and I'm not sure what BIP21 parsers are supposed to do in this case. Personally, I would reject the URI as &quot;not valid&quot; because it feels like the safest option for payers. However, maybe only the first value (ie <code>20.3</code>) is to be considered or the latest one (ie <code>21</code>).</p>
<p>Could anyone clarify this for me please?</p>

CC BY-SA 4.0
2023-06-22T05:35:26.947Z
FWIW, I created a PR (https://github.com/bitcoin/bitcoin/pull/27928) and it shows how BIP21 is implemented in Bitcoin Core.
Kiminuo
<bip21-uri>
How to interpret BIP21 URI with `amount` specified twice?
Kiminuo
# How to interpret BIP21 URI with `amount` specified twice?

(Asked by: username_0 on 2023-06-16)

BIP21 includes the following grammar rule:
bitcoinparam   = [ amountparam / labelparam / messageparam / otherparam / reqparam ]

I'm not sure if this grammar rule allows to specify amountparam multiple times or not. An example might be:
bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&amount=21&label=Luke-Jr (amount twice intentionally)
The amount parameter is specified twice and I'm not sure what BIP21 parsers are supposed to do in this case. Personally, I would reject the URI as "not valid" because it feels like the safest option for payers. However, maybe only the first value (ie 20.3) is to be considered or the latest one (ie 21).
Could anyone clarify this for me please?

**Tags:** bip21-uri

> **Comments:**
> **username_0**: FWIW, I created a PR (https://github.com/bitcoin/bitcoin/pull/27928) and it shows how BIP21 is implemented in Bitcoin Core.  

---

## 1 answers

### Answer by username_1 on 2023-06-16. Score: 1

Per [ABNF](https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form) grammar, this would evaluate to a single amount field.

If it were to allow more 1 or more amount fields, it would be represented as `1*amount`. If it were to allow 1 OR two amount fields, it would be represented as `1*2amount`.

> **Comments:**
> **username_0**: I see what you are saying. However, there is also: `bitcoinparams  = bitcoinparam [ "&" bitcoinparams ]` and so I can place `bitcoinparam` as many times as I want and not necessarily different ones. Right?  

---

