title: Transfer ERC20 Token from Address A to Adress B with web3
body: <p>1.2.6 of the web3 library and I am trying to interact with a standard ERC-20 token on the Ropsten Text net using the infura node. Even though I manage to succesfully broadcast the transaction it gets reverted. The error message I constantly receive is the following: "Error: Transaction has been reverted by the EVM:"</p>
  
  <p>When I am interracting with the contract via remix it works fine. Please see the full code below:</p>
  
  <pre><code>const path = require('path');
  const fs = require('fs');
  const Web3 = require('web3');
  const provider = new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/cb1****");
  const web3 = new Web3(provider);
  
  
  /* NETWORK AND LIB VERSION CHECKS*/
  web3.eth.net.isListening()
     .then(() =&gt; console.log('web3 is connected'))
     .catch(e =&gt; console.log('Wow. Something went wrong'));
  var Tx = require('ethereumjs-tx');
  web3.eth.net.getNetworkType()
  .then(console.log);
  
  // Create an async function so I can use the "await" keyword to wait for things to finish
  const main = async () =&gt; {
    // This code was written and tested using web3 version 1.0.0-beta.26
    console.log(`web3 version: ${web3.version}`)
  
   /* ADDRESSES */ 
  
    var myAddress = "0x77Bd******"; 
    var destAddress = "0x4f*****";
    var contractAddress = "0x67b7fecf8b02506d4692d9895959c42d7e7511bb";
    var abiArray = JSON.parse(fs.readFileSync(path.resolve(__dirname, './abi.json'), 'utf-8'));
    // var contract = new web3.eth.Contract(abiArray, contractAddress, { from: myAddress });
    var contract = new web3.eth.Contract(abiArray, contractAddress);
  
  
  /* INPUTS TO RAW TRANSACTION */ 
  
   // 1.Nonce: Determine the nonce
   var count = await web3.eth.getTransactionCount(myAddress);
   console.log(`num transactions so far: ${count}`);
  
    // 2.token amount - token is divisible to 0 decimals hence 1 = 1 token
    var transferAmount = 10000;
  
  
    // How many tokens do I have before sending?
    var balance = await contract.methods.balanceOf(myAddress).call();
    console.log(`Balance before send: ${balance}`);
  
    // I chose gas price and gas limit based on what ethereum wallet was recommending for a similar transaction. You may need to change the gas price!
    var rawTransaction = {
        "from": myAddress,
        "nonce": "0x" + count.toString(16),
        "gasPrice": "0x003B9ACA00",
        "gasLimit": "0x250CA",
        "to": contractAddress,
        "value": "0x09",
        "data": contract.methods.transfer(destAddress, transferAmount).encodeABI(),
        "chainId": 0x04
    };
  
    let privKey_ = "CDA******";
    let privKey = new Buffer.from(privKey_, "hex")
    var tx = new Tx(rawTransaction);
      //var tx = new Tx(rawTransaction,{chain:'rinkeby', hardfork: 'petersburg'} ); // https://ethereum.stackexchange.com/questions/61771/error-returned-error-invalid-sender
      tx.sign(privKey);
      var serializedTx = tx.serialize();
  
  
   console.log(`Attempting to send signed tx:  ${serializedTx.toString('hex')}`);
    var receipt = await web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'));
    console.log(`Receipt info:  ${JSON.stringify(receipt, null, '\t')}`);
  
  
    // The balance may not be updated yet, but let's check
    balance = await contract.methods.balanceOf(myAddress).call();
    console.log(`Balance after send: ${balance}`);
  }
  
  main();
  </code></pre>
  
  <p>Do you know how to solve this?</p>