Python Forum
problems when running a signrawtransaction method
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems when running a signrawtransaction method
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  super() and order of running method in class inheritance akbarza 7 594 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  How to resolve 404 returned from web method when not running on localhost littleGreenDude 3 3,027 Feb-05-2019, 09:01 PM
Last Post: littleGreenDude
  Problems running exe file from pyinstaller ersa21 4 7,763 Jan-15-2019, 06:36 PM
Last Post: snippsat
  function method problems drchar 2 2,855 Dec-11-2018, 02:38 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020