Does the bitcoin URI message parameter have character limits?

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.

Anderson Juhasc

Posted 2015-01-13T03:11:35.740

Reputation: 51

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 2015-01-13T03:26:53.500

Via URI Scheme for the block chain.Anderson Juhasc 2015-01-13T03:46:13.047

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

Posted 2015-01-13T03:11:35.740

Reputation: 12 624

1

Good answer. Also keep in mind that most modern browsers UTF8-encode an IRI and then percent-encode the non-ASCII bytes while encoding it into a URI so when the message contains international characters its length should be even less than that.

George Kimionis 2015-01-13T04:28:33.227