how to send an erc20 in web3py please, I have that :
tx_hash = contract.functions.transfer(destination_address, value).transact({'from': myaddress })
and I get this error :
ValueError: {'code': -32601, 'message': 'The method eth_sendTransaction does not exist/is not available'}
I guess am missing signing that or something like that, how can I make a successful erc20 transfer.
Best Answer
transact()
asks the node to sign your transaction usingeth_sendTransaction
. Infura can't do that, because they don't have your keys.Instead, you can use the contract object to create an unsigned transaction like:
Then you can sign the transaction with your private key, and broadcast it: