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.
Asked
Active
Viewed 344 times
3
-
Could you be more specific about where you're trying to embed a message? Is it inside an OP_RETURN, inside a coinbase, or as a 160 bit hash? – Nick ODell Jan 13 '15 at 03:26
-
Via URI Scheme for the block chain. – Anderson Juhasc Jan 13 '15 at 03:46
1 Answers
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
-
1Good 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