I've successfully created my own custom token on the Rinkeby testnet. Upon creation of the token I sent all the new coins to my wallet. I can send the new token to other wallets just fine and it shows up.

However I'm having difficulty writing a smart contract to accept the new token. I've sent the token from my wallet to the contracts address and it's been confirmed. However within the contract I can't see that it has received the token.

2 Answers 2


You must read this

The process is more complicated but it still does its job so I think it's worth it


Currently the ERC-20 Token Standard do not specify how to notify a contract when tokens are send to them.

There's a proposal ERC-223 with a new specification that stablishes how to notify when funds are sent to a contract.

Workarounds using ERC-20, involve a two step procedure:

  1. token.approve(contractAddress, amount, { from: userAddress }) User approves the contract to retrieve a given amount of tokens
  2. contract.purchase(token, amount) User calls contract to indicate it has been approved (function name varies with contract)

    2.1 token.transferFrom(msg.sender, this, amount) Contract transfer token from the user to the contract in the specified amount

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.