It seems like most OP_RETURN transactions include length as the first byte after the OP_RETURN code. Is this specified anywhere?

Also, the length is sometimes the entire length of the rest of the output, and other times, such as with memo.cash, it is only 2, but there are many more bytes than that. What is it supposed to be?

1 Answer 1


The length (amount of data to be pushed into the stack) typically comes directly after the OP_ code.

If the byte after OP_RETURN (0x6A) is between 0x01 and 0x4B, that is signaling the amount of data to push into the stack. This is defined in the Script language; a chart can be found here.

enter image description here

For example:


The first byte 0x6A decodes to OP_RETURN and the next byte is 0x24 signaling to push 36 bytes of data to the stack. (0x24 hexadecimal is 36 in decimal)

Our example therefore decodes to:


If there was any more data after the 36 bytes it would be interpreted in coordination with the proper OP_code.

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.