0

I am using Rinkeby in Ethereum Wallet and have created a crowdsale contract which created ERC20 tokens, assigned the crowdsale as the owner and then sold them to addresses which bought them using the buyToken function I coded into the crowdsale.

Now the accounts which purchased the tokens possess them and can transfer them to accounts via the "Transfer Ether and Tokens" button in Ethereum Wallet. But I don't know how to access any of the other functions (the ERC20 functions: totalSupply, balanceOf, allowance, approve, transferFrom).

I was able to do this for tokens where I just deployed the contract of the token by itself directly, but now using a crowdsale contract which creates the token contract and is assigned as the owner of the wallet, I don't know how token holders can access these functions in Ethereum wallet.

I appreciate any help in this. Thank you.

1

In order to interact with a contract you're going to need its ABI (JSON interface).

If you deployed the ERC20 token via Ethereum Wallet, you should see the contract under the custom contract list in the Contracts tab. That'll allow you to interact with the contract methods.

If the token contract is not in your custom contract list, you are going to have to generate the ABI with the contract's source code. A quick way to do that is to use the solidity remix browser IDE.

You can paste your code into the IDE and click on the Details button under the Compile tab. Then scroll down until you see ABI and then click on the copy button to copy the JSON code.

abi code

Go back into your Ethereum Wallet and click on the Watch Contract button. Add the token contract address, give it a name and paste in the ABI code.

enter image description here

This will allow you to interact with your contract methods.

  • Thank you for that. To add to the question, is there a way to use this ABI or JSON interface in a website or dApp that would allow my token holders to use these functions without going through Ethereum Wallet and having to provide them with the ABI for them to do this sort of thing? I'm wondering how to integrate token functions for users on websites and apps that may not use Ethereum Wallet or Mist. Thanks again. – John Murphy Feb 14 '18 at 14:00
  • 1
    Yes, there are ways to interact with a contract via a website. Look into implementing web3.js and extensions like metamask. – Shaun Bevan Feb 14 '18 at 14:06

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.