Embedded in this transaction, there is a blockchain file upload tool written in Python.

I'm trying to convert the hex of the output scripts to ASCII, so I can assemble it all into an actual runnable Python script. However doing a direct hex to ASCII conversion generates some unexpected characters.

For example, the third output script has the following hex:


Using a hex to ASCII converter, it becomes this Python code:

from decimal import Decimal

if len(sys.argv) < 5:
   A print(\
Usage: %s <file> <dest addr> <dest amount> {<fee-peAr-kb>}

Set BTCRPCURL=http://user:pass@localhost:portnum""" % sysS.

Why is the character A preceding print for no reason? As well as QA and S at the beginning and ends, respectively?

From what I've seen referenced on the Web, the third output script is meant to look like this:

from decimal import Decimal

if len(sys.argv) < 5:
Usage: %s <file> <dest addr> <dest amount> {<fee-per-kb>}
Set BTCRPCURL=http://user:pass@localhost:portnum""" % sys.

What am I missing here? I'm completely new to Bitcoin, so I'm guessing it's something obvious.

1 Answer 1


Apparently, the ASCII text is split between multiple TX output scripts, and each one is actually a multisig script with the data bytes inserted in place of the public keys.

The letters actually correspond to ASCII symbols which are the opcodes forming a multi signature script, see https://blockchain.info/tx/4b72a223007eab8a951d43edc171befeabc7b5dca4213770c88e09ba5b936e17 "Output Scripts".

Only the data between the opcodes should be treated as text if you want to decode it.

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.