I'm kind of new to Ethereum network. I used to implement Stellar before. I have successfully implemented my JavaScript app to transfer Eth already. Therefore, I want to expand my above app to accept/transfer ERC20 tokens on the markets, by still using web3js, I wonder

  1. Do I have to implement web3.eth.Contract for my app wallet to achieve ERC20 tokens compatible ?
  2. If not, is there any other easy ways to implement this ?
  3. What is the SOME_ERC20_FILE.json file as shown in code below (that is related to ABI) ? Where can I get an example of this JSON file ?

    const fs = require('fs');
    const parsedFile = JSON.parse(fs.readFileSync(SOME_ERC20_FILE.json));
    const abi = parsedFile.abi;    
    const myContract = new web3.eth.Contract(abi, 0x012345678912345678012345678012345678012);

Thank you in advance.


1 Answer 1


To use ERC20 tokens you will want to construct a Contract object for the smart contract corresponding to each ERC20 token. You can then use the methods of the object to do things like myContract.methods.balanceOf(addr)

All ERC20 tokens must (by definition) follow the ERC20 ABI, which you can get here. The SOME_ERC20_FILE.json in your example is just a file containing the ABI. You can read it from a file or just hard code it.

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.