I try to send Token based on Erc20.

and I can send Ether and something function but i dont know how to use transfer function in javascript like that.

 function transfer(address _to, uint256 _value) public returns (bool success) {
        _transfer(msg.sender, _to, _value);
        return true;

i did first.

const TokenInstance = new web3.eth.Contract(mhToken.abi, '0xC632ecfBBcee37b8061E59fcA11d9cB80DE08612')
this.setState({ web3: web3 , MhTokenInstance:MhTokenInstance})


using web3 instance i want to send custom token. plz help me how to use transfer function!

1 Answer 1


These are the steps. Create a web3 Instance

var web3 = new Web3(NODE)

Create a Token Instance

Const TokenInstance = new web3.eth.Contract(TokenABI, TokenAddress)

Sending Transcation

TokenInstance.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'})
.then((receipt) => {

Which in your case will be

TokenInstance.methods.transfer(address, amount).send({from: senderAddress}.then(receipt => {

Or can use

TokenInstance.methods.transfer(address, amount).send({from: senderAddress})
.on('transactionHash', (hash) => {
.on('receipt', (receipt) => {
.on('confirmation', (confirmationNumber, receipt) => {
.on('error', console.error);
  • Thanks bro!! you are my savior!!
    – minho
    Apr 15, 2019 at 9:50
  • If you find this answer to satisfy your question. Then please mark this question as correct and up vote so that other can find it easily Apr 15, 2019 at 10:04

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.