CRYPTO NEWS

Sending an ERC20 tokens from one wallet to another using web3-py not working

I’m trying to send an ERC20 token(USDC) from my ethereum wallet to other wallet, however the transfer happens from my wallet to the smart contract instead of the other wallet.

Below is the code

    w3_client = get_web3_client(3) # ropsten infura client          smart_contact_address = "0xFE724a829fdF12F7012365dB98730EEe33742ea2" # ropsten USDC       # abi as per https://github.com/carver/ethtoken.py/blob/master/ethtoken/abi.py     smart_contract = w3_client.eth.contract(         address=smart_contact_address, abi=EIP20_ABI          )     nonce = w3_client.eth.getTransactionCount(w3_client.toChecksumAddress(my_wallet_address))      txn_dict = smart_contract.functions.transfer(         receiver_wallet_address, 1000     ).build_transaction(         {             "chainId": 3,             "nonce": nonce,             "maxFeePerGas": w3_client.eth.max_priority_fee                             + (2 * w3_client.eth.get_block("latest")["baseFeePerGas"]),             "maxPriorityFeePerGas": w3_client.eth.max_priority_fee,             "type": 2,             "gas": 21584         }     )     signed = w3_client.eth.account.sign_transaction(txn_dict, my_wallet_private_key)     return w3_client.eth.send_raw_transaction(signed.rawTransaction) 

After I execute this. It shows an error on etherscan: https://ropsten.etherscan.io/tx/0x452012fab042528c17bab06595d6e47fa635d0b027083cfbfe94c40e7313e45c

Warning! Error encountered during contract execution [execution reverted]

ERC-20 Token Transfer Error (Unable to locate corresponding Transfer Event Logs), Check with Sender.

So I wanted to understand what am I missing here?

Thanks,

What is the process through which transactions and transaction receipts are found on a Ethereum database

Transactions and transaction receipts are constructed into Merkle Patricia Tries using the rlp encoded index with which they appear in a block. Once all tx information is rlp & hex prefix encoded a hash is generated to use as the key in a key value store such as leveldb or rocksdb. If the look up::Listen

Transactions and transaction receipts are constructed into Merkle Patricia Tries using the rlp encoded index with which they appear in a block. Once all tx information is rlp & hex prefix encoded a hash is generated to use as the key in a key value store such as leveldb or rocksdb. If the look up isn’t the transaction hash itself (but a hash of more complex info), what is the underlying process through which transactions and receipts are located?

Or more plainly if you call ethersjs provider.getTransaction( hash ) or alternatively for example you make the rpc call eth_getTransactionReceipt passing a tx hash what are the steps for locating this data on a trie backed by levelDB?

Sending an ERC20 tokens from one wallet to another using web3-py not working

Shopping cart
There are no products in the cart!
Continue shopping
0