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.

2
  • 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
    Commented Jan 13, 2015 at 3:26
  • Via URI Scheme for the block chain. Commented Jan 13, 2015 at 3:46

1 Answer 1

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.

1
  • 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.
    – user11221
    Commented Jan 13, 2015 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.