1

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?

Kiminuo
  • 78
  • 5
  • FWIW, I created a PR (https://github.com/bitcoin/bitcoin/pull/27928) and it shows how BIP21 is implemented in Bitcoin Core. – Kiminuo Jun 22 '23 at 05:35

1 Answers1

0

Per ABNF 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.

Raghav Sood
  • 16,869
  • 3
  • 21
  • 42
  • 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 Jun 19 '23 at 06:32