Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendSignedTransaction returns Transaction has been reverted by the EVM even though the transaction has succeeded #2518

Closed
Emad-salah opened this issue Mar 15, 2019 · 15 comments
Labels
Needs Clarification Requires additional input

Comments

@Emad-salah
Copy link

Description

I've been trying to perform a signed transaction using Web3 (connected to a Parity ETC Node) but I keep getting this error even though the transaction goes successfully once I check the wallet on gastracker.io: Transaction has been reverted by the EVM

Here's the part where I try to perform the transaction:

      const trxData = {
        chainId: web3.utils.toHex(61),
        from: "0x.....",
        to: "0x....",
        value: web3.utils.toHex("97534000000000000"),
        gasLimit: web3.utils.toHex(21000),
        gasPrice: web3.utils.toHex(41 * 1e9), // 41 Gwei
        nonce: web3.utils.toHex(transactionsNumber)
      };

      // Signs the transaction with the wallet's private key and sends it
      const signedTransaction = await web3.eth.accounts.signTransaction(
        trxData,
        "0x..." // private key
      );
      const receipt = await web3.eth
        .sendSignedTransaction(
          signedTransaction.rawTransaction,
          async (err, data) => {
            if (err) {
              console.error("sendSignedTransaction error", err);
            }
          }
        )
        .on("receipt", receipt => console.log("receipt", receipt));

Expected behavior

Calling web3.eth.sendSignedTransaction() should return the transaction receipt

Actual behavior

Calling web3.eth.sendSignedTransaction() returns the error below even though it successfully transfers the specified amount to the target account.

Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0x285b03ddae27704d736091eefdba8172719800fe015b71ef756315cd9c96e5fa",
  "blockNumber": 7667741,
  "contractAddress": null,
  "cumulativeGasUsed": 21000,
  "from": "0x215331e7dded3088154ed1c15a6b0fa7f6b9955b",
  "gasUsed": 21000,
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": "0x5d572b06b611703101102c1175cc06e9df04e2dee16bdd9ee40fc4b6fe48af09",
  "status": false,
  "to": "0x30a515b26d2bfba302f7cd009105f2363235b130",
  "transactionHash": "0x4500bbc7feb9e9ed6d1df78dbff92b0881c564f7321c2083c68b3f090e74b7cf",
  "transactionIndex": 0
}

Steps to reproduce the behavior

  1. Import web3
  2. Create a new transaction object
  3. Sign the transaction object using your address' private key with signTransaction
  4. Send the signed raw transaction using sendSignedTransaction
const receipt = await web3.eth
    .sendSignedTransaction(
      signedTransaction.rawTransaction,
      async (err, data) => {
        if (err) {
          console.error("sendSignedTransaction error", err);
        }
      }
    )
    .on("receipt", receipt => console.log("receipt", receipt));
  1. Instead of the transaction receipt, you'll receive the error above: Transaction has been reverted by the EVM

Versions

  • web3.js: 1.0.0-beta.36
  • nodejs: 11.11.0
  • browser: N/A
  • ethereum node: Parity-Ethereum/v2.4.0-beta-c7d8ee1-20190227/x86_64-linux-gnu/rustc1.32.0
@nivida nivida added the Needs Clarification Requires additional input label Mar 18, 2019
@nivida
Copy link
Contributor

nivida commented Mar 18, 2019

Could you test this with the latest version of Web3.js?
Btw.: I'll release in the next days some improvements regarding the transaction handling of Web3.js.

@nivida
Copy link
Contributor

nivida commented Mar 18, 2019

This is a duplication of #2441 and will be fixed with #2511

@nivida nivida closed this as completed Mar 18, 2019
@Emad-salah
Copy link
Author

Sounds great! Also, I couldn't try it out using the latest version because I'm encountering the same issue as described in #2459

Thanks!

@amitkot
Copy link

amitkot commented Mar 20, 2019

This still happens with web3.js 1.0.0-beta.49.

@RostyslavBortman
Copy link

The same issue web3js 1.0.0-beta.48

@poserr
Copy link

poserr commented Mar 20, 2019

Unfortunately same problem with 1.0.0-beta.50

@AyushyaChitransh
Copy link

Lets reopen this issue until a fixed version is released

@Emad-salah
Copy link
Author

Emad-salah commented Mar 20, 2019

I'm not sure if this will work for everyone's use case but I've been trying to use web3 just to subscribe to the "pendingTransactions" event and transfer money from a user's wallet to another. And from what I've found so far, the "pendingTransactions" subscription doesn't work when using a GETH node as a WebSocket provider but it does work when using a Parity node as a WebSocket provider and GETH nodes do work when attempting to sign and send a transaction but Parity nodes don't.

So in order for it to work for you, you can use a Parity node for Websockets and a GETH node for RTC.

Hopefully, this might help other users who are stuck with the same issue until a fix for it is released 😃

@dileepfrog
Copy link

The root cause of this issue is actually described in #2542 - the status field of the receipt is being handled as an int instead of a boolean, so true is interpreted as falsy. A PR is also included there which fixes the issue

@huainanhaoyuelengqianshan

This question can be solved by installing 1.0.0-beta.34. I solve this problem by use 'npm install web3@1.0.0-beta.34 --save'.

@patitonar
Copy link

Running into this issue on Beta 50

@krychla1 krychla1 mentioned this issue Mar 28, 2019
12 tasks
@icervot
Copy link

icervot commented May 2, 2019

npm install web3@1.0.0-beta.34 --save

THIS

@parin13
Copy link

parin13 commented Oct 6, 2019

same issue with 1.0.0-beta.37

@RjtSinghal
Copy link

Has anyone find the solution for this ? I am using web3@1.3.0

@AlexHladun
Copy link

Does someone solve this using web3@1.7.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Clarification Requires additional input
Projects
None yet
Development

No branches or pull requests