thanks all of guys help me. thanks very much. I created contract in rinkeby test network. the contract address is: https://rinkeby.etherscan.io/address/0x5dedcba9851e5c7ff464d5ee6ef75301a8c43d8b

I try to write code run contract transfrom method for move ERC2.0 token from A address to B address. but is always stop and show error message:Transaction has been reverted by the EVM. I am not sure what's trouble. hope someone help me.

fs = require("fs");
Web3 = require('web3');
url = "https://rinkeby.infura.io/v3/29129372289d49dca8ecec82d0aa8e7a";
web3 = new Web3(new Web3.providers.HttpProvider(url));
var contractAddress ="0x5DedCBa9851E5C7FF464D5Ee6Ef75301a8c43d8b";
var abiArray = JSON.parse(fs.readFileSync('kct.json', 'utf-8'));
abi = JSON.parse(abiArray.result);
var contract = new web3.eth.Contract(abi,contractAddress);

const gasLimit = block.gasLimit;
console.log('gas limit:',gasLimit);
data = contract.methods.transferFrom("0x410E6a1be27424091ABb15aA096D492958fD55f1","0xf17f52151EbEF6C7334FAD080c5704D77216b732","12").encodeABI();


    var tx = {
    gasPrice: web3.utils.toHex(4200000000),
    gasLimit: web3.utils.toHex(4300000),
    web3.eth.accounts.signTransaction(tx,prkey).then(tx => {
            console.log('Result++: ', tx);
            var raw = tx.rawTransaction;
            web3.eth.sendSignedTransaction(raw).on('receipt', res => {
            }).on('error', err => {
    }).then(receipt => console.log("Transaction succeeded", receipt)).catch(error => console.error(error))
  • usually this kind of errors is not meeting revert , assert or require conditions, so you must check what input are you giving to your contract, and you should post the method's source code if you want someone to help you.
    – Nulik
    Commented Sep 18, 2018 at 17:42
  • you have 3 requires there in transfer() method, some of them fails, post also the transaction hash, so we can check what input did you send to the contract
    – Nulik
    Commented Sep 18, 2018 at 17:44
  • and the most likely, it is that you don't have the balance
    – Nulik
    Commented Sep 18, 2018 at 17:45

1 Answer 1


It looks like you're calling transferFrom(), which is a way for address A to transfer tokens from address B to address C. In order to do that, address B must first authorize address A to do that by calling approve().

But it looks like you're just trying to transfer from your own account, so you should just use transfer():

data = contract.methods.transfer("0xf17f52151EbEF6C7334FAD080c5704D77216b732", "12").encodeABI();
  • thanks smarx! it is run right. I need read more code, need know more about contract code. Commented Sep 19, 2018 at 2:31

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.