Post
Topic
Board Armory
Re: SOLVED - MADE SCRIPT: signing raw transactions from bitcoind with armory
by
PhantomPhreak
on 11/07/2014, 16:09:12 UTC
binascii.hexlify() returns ASCII-encoded hex only, at least in Python 3:

Code:
Python 3.4.1 (default, May 19 2014, 17:23:49)
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import binascii
>>> foo = binascii.hexlify(b'\x00')
>>> foo
b'00'
>>>
>>> foo.decode('utf-8')
'00'
>>>

Why do you need the last line?  Wouldn't you end up with some of the binary chars being converted to ASCII/unicode characters?   My apologies for being naive about python3 ... I'm not actually that familiar with it, beyond the fact that if I were to rewrite Armory from scratch, I'd use python3 from the start.  

Going back and forth between Python 2 and Python 3 is a mindfuck. Wink

binascii.hexlify() returns ASCII-encoded binary of the hexadecimal string (I don't know why). When you try to print that directly, Python prints the binary as binary (EDIT: implicitly converting to ASCII literal characters, wherever it can, just for display).

Applying this to the code I wrote...

With:
Code:
_TXDIST_f9beb4d9_ENeepxUG_0164

Without:
Code:
_TXDIST_b'f9beb4d9'_ENeepxUG_b'0164'