Pardon my ignorance, as I have very less knowledge of ERC20 and Ethereum.

I am part of an exchange development and we have successfully integrated coins but when it came to ERC20 tokens, we are having no luck.

So far our understanding is that we need to run a full node using geth, enable RPC and use web3j for our wrapper.

The things that I don't understand is that how do I integrate a specific smart conract, let's say TrueUSD is what we plan to integrate right now.

I know that we will need contract address, ABI and account address. The place I am stucked is how to make call to Geth for calling a specific function of a specific contract. in this case, TUSD.

I have been reading around from almost a month, tried different things, but may be lack of experience working with Ethereum is causing the issue.

Is there anyone here who can help develop it, we can discuss the commercials. If not, is there any "dummies" kinds of guide for integrating ERC20 tokens.


  • 1
    If you are building an exchange, you almost certainly want to hire someone with a better grasp of these things. – Raghav Sood Oct 24 '18 at 8:31
  • yes, we are open to that as well. So I mentioned a line if anyone is willing to take up this job and we can discuss money matter. – Kaushal Thakker Oct 24 '18 at 14:42

ERC20 is a standard that exposes some functions you can use directly without having access to the ABI. The only thing you need is the address of the ERC20 contract.

I deployed two ERC20 contracts on Rinkeby network at addresses 0x508ce9c3c5219fc1cd08a448a247c08c707c6eb1 and 0xf5de6643a3e30462e0ef34dc3fb3905a7824043b.

I can now use an Exchange contract like the following one to easily exchange tokens at a fixed exchange rate:

pragma solidity ^0.4.25;

interface IERC20 {
    function name() external view returns (string _name);
    function symbol() external view returns (string _symbol);
    function decimals() external view returns (uint8 _decimals);
    function totalSupply() external view returns (uint256 _totalSupply);
    function balanceOf(address _owner) external view returns (uint256 balance);
    function transfer(address _to, uint256 _value) external returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
    function approve(address _spender, uint256 _value) external returns (bool success);
    function allowance(address _owner, address _spender) external view returns (uint256 remaining);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

contract TokenExchange {
    IERC20 token1;
    IERC20 token2;
    address owner;
    uint exchangeRate;
    //data for pending transfer
    address trnFrom;
    uint trnAmount;

    constructor() public {
        token1 = IERC20(0x508ce9c3c5219fc1cd08a448a247c08c707c6eb1);
        token2 = IERC20(0xf5de6643a3e30462e0ef34dc3fb3905a7824043b);
        owner = msg.sender;
        exchangeRate = 2;

    function askConversionTNK1toTKN2 (uint256 _amount) public {
        trnFrom = msg.sender;
        trnAmount = _amount;

    function executeConversionTKN1toTKN2 () public { 
        token1.transferFrom(trnFrom, this, trnAmount);
        token2.transfer(trnFrom, trnAmount*exchangeRate);

Prerequisites are that both the user requesting the exchange owns some TKN1 tokens and the TokenExchange contract owns some TKN2 tokens. The flow would then become:

  1. the user calls the function approve of the TKN1 contract to allow the TokenExchange contract to transfer an amount of token to itself
  2. the user calls the function askConversionTNK1toTKN2 specifying the amount of TKN1 tokens he wants to convert to TKN2
  3. the owner of the TokenExchange contract calls the function executeConversionTKN1toTKN2 to complete the transfer of the tokens.

The function executeConversionTKN1toTKN2 is the heart of this contract:

  1. it transfers TNK1 tokens from the user account to itself
  2. it transfer TKN2 tokens from its account to the user one

Beware that this code is just to demonstrate a concept and cannot be used in a production environment. It doesn't implement any basic security to keep the code as clean as possibile.

  • Thanks a lot. Noted your points. But I think am not qualified enough to execute this things without the help of an expert. So as of now, we are planning to outsource this task to someone who is experienced enough. – Kaushal Thakker Oct 24 '18 at 14:45

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