<p>Embedded in <a href="https://blockchain.info/rawtx/4b72a223007eab8a951d43edc171befeabc7b5dca4213770c88e09ba5b936e17" rel="nofollow noreferrer">this transaction</a>, there is a blockchain file upload tool written in Python.</p>

<p>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.</p>

<p>For example, the third output script has the following hex:</p>

<pre><code>51412c756e6865786c6966790a66726f6d20646563696d616c20696d706f727420446563696d616c0a0a6966206c656e287379732e6172677629203c20353a0a20202041207072696e74285c0a2222225c0a55736167653a202573203c66696c653e203c6465737420616464723e203c6465737420616d6f756e743e207b3c6665652d706541722d6b623e7d0a0a5365742042544352504355524c3d687474703a2f2f757365723a70617373406c6f63616c686f73743a706f72746e756d22222220252073797353ae
</code></pre>

<p>Using a hex to ASCII converter, it becomes this Python code:</p>

<pre><code>QA,unhexlify
from decimal import Decimal

if len(sys.argv) &lt; 5:
   A print(\
"""\
Usage: %s &lt;file&gt; &lt;dest addr&gt; &lt;dest amount&gt; {&lt;fee-peAr-kb&gt;}

Set BTCRPCURL=http://user:pass@localhost:portnum""" % sysS.
</code></pre>

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

<p>From what I've seen <a href="https://gist.github.com/shirriff/bfc4df70a02732493a28" rel="nofollow noreferrer">referenced on the Web</a>, the third output script is meant to look like this:</p>

<pre><code>,unhexlify
from decimal import Decimal

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

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

<transactions><blockchain><script>
Hex to ASCII conversion of output scripts generates unexpected characters
XåpplI'-I0llwlg'I  -
# Hex to ASCII conversion of output scripts generates unexpected characters

(Asked by: username_0 on 2016-12-25)

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:
51412c756e6865786c6966790a66726f6d20646563696d616c20696d706f727420446563696d616c0a0a6966206c656e287379732e6172677629203c20353a0a20202041207072696e74285c0a2222225c0a55736167653a202573203c66696c653e203c6465737420616464723e203c6465737420616d6f756e743e207b3c6665652d706541722d6b623e7d0a0a5365742042544352504355524c3d687474703a2f2f757365723a70617373406c6f63616c686f73743a706f72746e756d22222220252073797353ae

Using a hex to ASCII converter, it becomes this Python code:
QA,unhexlify
from decimal import Decimal

if len(sys.argv) < 5:
   A print(\
"""\
Usage: %s    {}

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:
,unhexlify
from decimal import Decimal

if len(sys.argv) < 5:
    print(\
"""\
Usage: %s    {}
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.

**Tags:** transactions, blockchain, script


---

## 0 answers

