0

I'm trying to transfer token using ERC20 token transfer method using web3.js (version: 1.0.0-beta.37). I could successfully transfer tokens with Remix as the method is working fine. However, I got the following error when calling transfer method with web3.js and private parity chain. My frontend code is:

MyContract.methods
 .transfer('0x190EdB3a40f2dB499D4C0EcC986A9A188C7d896C', 10)
 .send({
     from: "0x062c52E81f8ce863BE079CB88cbbe877799f694A",
      gasPrice: "3000000"
  })
  .then(receipt => {
      console.log(receipt);
 });

and the error message in the console is:

Uncaught (in promise) Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0x9c2f0c389d9ceeb99af439d33654d58d5e9069d461e3ebde72f378228b9bc77e",
  "blockNumber": 23021,
  "contractAddress": null,
  "cumulativeGasUsed": 36644,
  "gasUsed": 36644,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000020000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000040000000000000000002000000000000000000000000000000400000008000000000000100000000000000000040020000000000000000000000000000000000000000000000",
  "root": null,
  "status": false,
  "transactionHash": "0xc5c2c9d6ac04b32fb0cd36fc9ce7a2db086cb6481602a2622c396cba95a4c47d",
  "transactionIndex": 0,
  "events": {
    "Transfer": {
      "address": "0xF7E58B02d62f75e9e53330965Ff57E0390780fe8",
      "blockHash": "0x9c2f0c389d9ceeb99af439d33654d58d5e9069d461e3ebde72f378228b9bc77e",
      "blockNumber": 23021,
      "logIndex": 0,
      "removed": false,
      "transactionHash": "0xc5c2c9d6ac04b32fb0cd36fc9ce7a2db086cb6481602a2622c396cba95a4c47d",
      "transactionIndex": 0,
      "transactionLogIndex": "0x0",
      "type": "mined",
      "id": "log_0348365b",
      "returnValues": {
        "0": "0x062c52E81f8ce863BE079CB88cbbe877799f694A",
        "1": "0x190EdB3a40f2dB499D4C0EcC986A9A188C7d896C",
        "2": "10",
        "_from": "0x062c52E81f8ce863BE079CB88cbbe877799f694A",
        "_to": "0x190EdB3a40f2dB499D4C0EcC986A9A188C7d896C",
        "_tokens": "10"
      },
      "event": "Transfer",
      "signature": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "raw": {
        "data": "0x000000000000000000000000000000000000000000000000000000000000000a",
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000062c52e81f8ce863be079cb88cbbe877799f694a",
          "0x000000000000000000000000190edb3a40f2db499d4c0ecc986a9a188c7d896c"
        ]
      }
    }
  }
}

However, if I check the balance of respective accounts the amount is successfully transferred and also deducted from sender's account. I also tried web.utils.toWei(10) but no luck. Any help, please?

  • I think some versions of web3 erroneously report a failure event when the transaction was successful. You might trying with and older version like beta34 or checking if it was fixed in recent versions. – Ismael Apr 2 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.