I was trying to make a deal with another user and he sent me this address:
0xb1f4c727afa220eec5d218399eb443662ab2610e
But when I tried to do the transfer I received this error
TypeError: Transaction had invalid fields: {'to': '0xb1f4c727afa220eec5d218399eb443662ab2610e'}
Then I tried with another address and it worked. Then the user sent me a different address and it failed as well
TypeError: Transaction had invalid fields: {'to': '0xd33e044a3b60ab3a1c0b07ffe97a2a7fdf03d3f2'}
All other wallets I have tried to transfer to worked, except the two wallets sent by the user. This is the code for the transaction:
tx = dict(nonce=w3.eth.getTransactionCount(sourceAddress),
gasPrice = gasPrice, gas = 21000,
to = destAddress,
value=w3.toWei(value,'ether'))
print("\n", tx, "\n")
privateKey = input("enter " + sourceName + " private key to confirm: ")
signed_txn = w3.eth.account.signTransaction(tx,privateKey)
w3.eth.sendRawTransaction(signed_txn.rawTransaction)
And this are what the transaction look like just before signing them (as printed in the console)
Worked
{'nonce': 3, 'gasPrice': 42000000000, 'gas': 21000,
'to': '0x2bc6a086303F9F4A785daC94C0FC9a5A5Ada7a9c', 'value': 100000000000000000}
Failed
{'nonce': 3, 'gasPrice': 10000000000, 'gas': 21000,
'to': '0xb1f4c727afa220eec5d218399eb443662ab2610e', 'value': 139031000000000000}
Failed
{'nonce': 4, 'gasPrice': 43000000000, 'gas': 21000,
'to': '0xd33e044a3b60ab3a1c0b07ffe97a2a7fdf03d3f2', 'value': 139031000000000000}
Worked
{'nonce': 4, 'gasPrice': 42000000000, 'gas': 21000,
'to': '0x37482CBd05dd0B6557014ec9DFEEB380a522131d', 'value': 150000000000000000}
It could be the way I'm copying and pasting the address from telegram to the console, but the truth is in every case I am hardcoding the addresses in the source code. And, of course, the failing addresses do exist in etherscan.io
I'm really clueless...
Thank you.