What are the difference between _from, _spender and _to address in these functions below?

function transferFrom(address _from, address _to, uint256 _value) public{/*...*/}
function approve(address _spender, uint256 _value) public{/*...*/}

2 Answers 2


These are the functions used in an ERC20 token contract.

  • _from : original owner of tokens who can himself transfer some tokens or approve any third party/person to spend the token

  • _spender : Spender who can transfer tokens on the behalf of someone only if approved by token owner

  • _to : Address who will receive the tokens in any case.

You can visit it the complete contract here . Comments are quite self-explanatory.


From the ERC20 specification:


Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.

The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw unless the _from account has deliberately authorized the sender of the message via some mechanism.


Allows _spender to withdraw from your account multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value.

Basically, you can use approve to allow someone else to spend/withdraw tokens from your balance. The transferFrom method is the function that is called by that person to actually spend tokens from your account.

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.