Python Forum
problems when running a signrawtransaction method - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: problems when running a signrawtransaction method (/thread-14521.html)



problems when running a signrawtransaction method - wectri - Dec-04-2018

Trying to do a transaction via RPC in python. I'm getting the error - TypeError: unhashable type: 'list' - for the line with the private key entry, when running the method signrawtransaction. Does anybody know what is wrong with my code (or not wrong)?

def signrawtransaction(serialized_transaction):
    payload = {
        [
            {
                "method": "signrawtransaction",
                "params": [serialized_transaction],
                "txid": "52938c72e777d0cdd547337314aa8955c629d6e45d0119e05586c9aa1c1f6695",               
                "vout": 0,
                "scriptPubKey": "16ae4544b56c619e5624fa708c3b1887e785baa3e338be5c805ba3b39d0427e1", 
            }
        ],
        {
            "835c32d409a14cd042afc7d5b99031ced36ded276214b782e8a4b51c93feb838"  # private key  
        }
}
signed_transaction = requests.post(url, data=json.dumps(payload), headers=headers).json()['result']
return signed_transaction



RE: problems when running a signrawtransaction method - Larz60+ - Dec-04-2018

Please show full unmodified error traceback (in error tags), It contains valuable information needed to fully understand the problem.
on line 8, you have a digit which is unhashable for json.
Don't try to form the json structure yourself, let dump do it. (just general information, doesn't fix problem in this case).
you can use '0', to dump and convert it after load.