3

Is there a limit to how many characters are allowed in the message parameter of a BIP21 URI? I tried searching on the subject, but found nothing about it.

Nick ODell
  • 29,184
  • 11
  • 69
  • 129

1 Answers1

4

There isn't a limit described by the BIP (https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki). In general, however, URIs might be encoded into QR codes, so their length should be kept as small as possible.

GET requests often have limits on the length of the encoded URLs, something like 2000 characters (https://stackoverflow.com/questions/266322/is-there-a-limit-to-the-length-of-a-get-request). This might be applicable depending on how you are using the URI.

As a guideline, however, I would say that messages in Bitcoin URIs should be fairly short. I'd probably try to stick to less than 200 characters.

morsecoder
  • 14,008
  • 2
  • 42
  • 92
  • 1
    Good answer. Also keep in mind that most modern browsers UTF8-encode an [IRI](http://en.wikipedia.org/wiki/Internationalized_resource_identifier) and then [percent-encode](http://en.wikipedia.org/wiki/Percent-encoding) the non-ASCII bytes while encoding it into a [URI](http://en.wikipedia.org/wiki/Uniform_resource_identifier) so when the message contains international characters its length should be even less than that. –  Jan 13 '15 at 04:28