What function that i should use? If you don't mind, please explain it in simple code.


  • Which token exactly? – ivicaa Mar 5 '18 at 20:08

The Ethereum token standards e.g. ERC20 contain a balanceOf function:

function balanceOf(address tokenOwner) public constant returns (uint balance);

The simplest solution would be to call balanceOf with the address of the receiver as the argument - this can be done directly on the contract or via a library such as Web3JS.

One caveat is that the transaction (TX) has to be mined before you check the balance of the address - in order for it to reflect the fact of the transfer of the token. If you are using a library like Web3JS or Web3J then the library will handle polling for the TX to be mined and executing a callback for you. Otherwise, if you have the TX ID from sending the token, then you will have to monitor the status of the TX to see when it changes from 'Pending' to 'Successful' - and then check the balance.

  • Thanks Steve for the clue. I'm trying to use and test it... and read about library. interesting – Sea Wave Mar 5 '18 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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