I'm trying to sign a simple transfer transaction using digitalbitbox's python api (see here and code snippet below).

I send the following json to the HW wallet api:

Sending: {"sign":{"data":[{"keypath":"m/1/1/1/0", "hash":"f2243e10c5c4f4ca1ba2f4cac89e5996ede01c101c8f510440a027b5faaf96a7"}]}}

The signed TX hash returned by the HW wallet is:


However, when pasting this into etherscan I receive the following error:

Error! Unable to broadcast Tx : {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"rlp: expected input list for types.txdata"}}

I was expecting too see some error message like insufficient funds, but it seems like my encoding is wrong.

Does anybody know why this isn't working?

import sys
from dbb_utils import *
import time
import rlp

    password = 'password'

    # Start up options - factory reset; initial password setting
    if 0:
        hid_send_encrypt('{"reset":"__ERASE__"}', password)
        hid_send_plain('{"password":"' + password + '"}')

    import ethereum
    from ethereum.transactions import Transaction
    import hashlib

    # Create test TX
    testTx = Transaction(nonce=5, gasprice=24000000000, startgas=21000, to=int("0xfc5d975c3738b1eed1f072d72912bea31f9d1eb1", 16), value=1, data="")
    rawTx = ethereum.utils.encode_hex(ethereum.utils.sha3(rlp.encode(testTx))) #hashlib.sha256(rlp.encode(testTx)).hexdigest()
    message = '{"sign":{"data":[{"keypath":"m/1/1/1/0", "hash": "' + rawTx + '"}]}}'

    # Send a JSON command
    response = hid_send_encrypt(message, password)
    cmd = '{"sign":""}'
    response = hid_send_encrypt(message, password)

except IOError as ex:
except(KeyboardInterrupt, SystemExit):
    print("Exiting code")


1 Answer 1


Looks like I forgot to add the signature into the transaction object. After adding the associated v, r and s parameters to the raw TX and computing the corresponding hex of the rlp encoded TX it now seems to work!

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.