From 8a62d12217311e1de850682c4e4c8efa51986bf8 Mon Sep 17 00:00:00 2001 From: Jochen Hoenicke Date: Mon, 5 Mar 2018 13:09:57 +0100 Subject: [PATCH] Update ethereum_sign_tx to python3 (#227) --- trezorctl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trezorctl b/trezorctl index 7646d4439..f890a2ae2 100755 --- a/trezorctl +++ b/trezorctl @@ -582,9 +582,9 @@ def ethereum_sign_message(connect, address, message): def ethereum_decode_hex(value): if value.startswith('0x') or value.startswith('0X'): - return value[2:].decode('hex') + return binascii.unhexlify(value[2:]) else: - return value.decode('hex') + return binascii.unhexlify(value) @cli.command(help='Verify message signed with Ethereum address.') @@ -731,7 +731,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri client = connect() address_n = client.expand_path(address) - address = '0x%s' % (binascii.hexlify(client.ethereum_get_address(address_n)),) + address = '0x%s' % (binascii.hexlify(client.ethereum_get_address(address_n)).decode()) if gas_price is None or gas_limit is None or nonce is None: host, port = host.split(':') @@ -749,7 +749,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri to_address=to, from_address=address, value=('0x%x' % value), - data='0x' + data) + data='0x%s' % (binascii.hexlify(data).decode())) if nonce is None: nonce = eth.eth_getTransactionCount(address) @@ -766,7 +766,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri transaction = rlp.encode( (nonce, gas_price, gas_limit, to_address, value, data) + sig) - tx_hex = '0x%s' % binascii.hexlify(transaction) + tx_hex = '0x%s' % binascii.hexlify(transaction).decode() if publish: tx_hash = eth.eth_sendRawTransaction(tx_hex)