I have deployed a contract for my custom ERC20 token. I am trying to send tokens using web3.py

contract.functions.transfer(address, 20000000000000000000).call()

Above code is giving error raise ContractLogicError('execution reverted') web3.exceptions.ContractLogicError: execution reverted

Same is the error for transferFrom() function. But it works totally fine with Remix IDE and metamask

1 Answer 1


The issue is that you're using .call() method which is meant to be used when you only want to read the blockchain. If you want to write on the blockchain ( and usually transfer method means you want to transfer particular amount from one wallet to another which is basically writing on the blockchain ) then you have to use the .transact() method. In your case you need to change the code to:

contract.functions.transfer(address, 20000000000000000000).transact({"from": <YOUR_ADDRESS>})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.