ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
5.01k stars 1.71k forks source link

sendRowTransactions (invalid argument 0: json: cannot unmarshal hex string without 0x prefix) #651

Closed smartDev22 closed 2 years ago

smartDev22 commented 6 years ago

Good evening, tell me how to send a transaction by signing it locally

I do this: `import json import time from eth_account import Account from web3 import Web3, HTTPProvider, IPCProvider, eth w3 = Web3(HTTPProvider('https://rinkeby.infura.io/EAGgjypt3XXLDYWK9B4W'))

to_addr = 0xbd0fc0e8245D099b751CF6437cc32385347F2251 from_addr = 0x00E49ef94dc7e798f4332e8E95303b24984F2c5e key = '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318' # transaction = { 'to': to_addr, 'from': from_addr, 'value': 100, 'gas': 200000, 'gasPrice': 100000000, 'chainId': 4, 'nonce': int(time.time()) } print(w3.eth.accounts) gas_limit = 250000 signed_transaction = Account.signTransaction(transaction, key)

print(signed_transaction)

transaction_id = w3.eth.sendRawTransaction(signed_transaction.rawTransaction) quit() print('\nhttps://etherscan.io/tx/{0}'.format(transaction_id.hex())) `

but in return I get such:

ValueError error: {'code': -32602, 'message': 'invalid argument 0: json: can not unmarshal non-string into Go struct field SendTxArgs.to of type common.Address'}

web3 == 3.16.4

already tried everything, and could not send the transaction

kclowes commented 2 years ago

Stale issue, closing.