What function that i should use? If you don't mind, please explain it in simple code.
Thanks
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityWhat function that i should use? If you don't mind, please explain it in simple code.
Thanks
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.