1

Firstly, thank you for helping me out in understand this. Suppose, if I have an ERC20 token contract (with all the required functions implemented including Transfer() function) deployed on the blockchian and a wallet implemented with basic functionality, say send tokens from my address to another wallet address.

To send tokens, my wallet creates a transaction, signs it and sends it to the blockchain. If I am not wrong, this transaction invokes Transfer() function which subtract tokens in my account and adds them to the receiver account. On successful invocation, the tokens are transferred.

Similarly, all the other functions are invoked through my wallet right? Sorry, if it is a silly question to ask.

Thanks Muni

1 Answer 1

2

To send tokens you call the transfer function of the contract. This is done by sending a transaction with a value of 0 ETH to the token contract, with transaction data containing the function identifier, address to send the tokens to and the number of tokens to send. This is done through your own wallet.

Note that transfer and Transfer are two different things. transfer is a function, and Transfer is an event that is called when you make a transaction (either through transfer or transferFrom).

Functions like transfer, approve, allowance and transferFrom have to be called in a transaction (since they're "write" functions). Other functions, like balanceOf for example, can be called without sending a transaction, using eth_call. You don't need a wallet to call these functions.

A more detailed explanation of how transaction data and token transactions in particular work, can be found here:

https://medium.com/mycrypto/why-do-we-need-transaction-data-39c922930e92 https://medium.com/mycrypto/the-technology-behind-ethereum-tokens-5615527e1af8

1
  • Hi Morten, thank you for clarifying my questions.
    – Muni V K
    Commented May 20, 2020 at 16:54

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.