AnswerBun.com

web3 erroneously returning error

Ethereum Asked by bitsanity on January 5, 2022

This is strange. My web3 script to deploy a contract seems to work, but always activates the .on(‘error’, fcn) clause even though there is no error.

The message says Transaction has been reverted by the EVM but it has not really been reverted. It returns the contract address, the contract is there and I can call it with other scripts.

Code:

con
  .deploy({data:getBinary()} )
  .send({from: eb, gas: 1000000, gasPrice: gprice}, (err, txhash) => {
    if (txhash) console.log( "sent txhash: ", txhash );
  } )
  .on('error', (err) => { console.log("borked: ", err); })
  .on('transactionHash', (h) => { console.log( "hash: ", h ); } )
  .on('receipt', (r) => { console.log( 'rcpt: ' + r.contractAddress); } )
  .on('confirmation', (cn, rcpt) => { console.log( 'cn: ', cn ); } )
  .then( (con) => {
    console.log( "SCA", con.options.address );
    process.exit(0);
  } )
  .catch( err => { console.log } );

Result:

$ node cli.js 0 0 0 deploy
sent txhash:  0x73c25e524056d76937429a92349f019d436c452b006cb4178e4170e5b24aa5b4
hash:  0x73c25e524056d76937429a92349f019d436c452b006cb4178e4170e5b24aa5b4
borked:  Error: Transaction has been reverted by the EVM:
{
  "transactionHash": "0x73c25e524056d76937429a92349f019d436c452b006cb4178e4170e5b24aa5b4",
  "transactionIndex": 0,
  "blockHash": "0xa7afc701efd8fcc397536f018a3307c5d38d6031431c3887298693a9b11edfc0",
  "blockNumber": 6,
  "gasUsed": "0x0b60fa",
  "cumulativeGasUsed": "0x0b60fa",
  "contractAddress": "0x786a010206921e8ea1181d86da22adbd87259d33",
  "logs": [],
  "status": "0x01",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "to": null
}
    at TransactionReceiptValidator.validate (/home/skull/node_modules/web3-core-method/dist/web3-core-method.cjs.js:146:16)
    at /home/skull/node_modules/web3-core-method/dist/web3-core-method.cjs.js:44:68
    at process._tickCallback (internal/process/next_tick.js:109:7)

2 Answers

Had the same problem but I needed to upgrade Ganache 1.1.0 to 1.3.0 until I got rid of the EVM error message.

Answered by Pertti 'Petteri' Martikainen on January 5, 2022

upgrade ganache-cli separately from web3 and truffle

Answered by bitsanity on January 5, 2022

Add your own answers!

Related Questions

part of private blockchain disapear

1  Asked on January 5, 2022 by tomas-batrla

       

web3 erroneously returning error

2  Asked on January 5, 2022 by bitsanity

   

How can I distribute funds to present stakers efficiently?

1  Asked on January 3, 2022 by fariha-abbasi

     

It is possible to register a name in ENS (Ethereum Name Service) from Mist Wallet?

1  Asked on January 1, 2022 by moiss-briseo-estrello

   

Viewing transaction events by using web3 on geth console

1  Asked on January 1, 2022 by juan-ignacio-prez-sacristn

         

.toml stream did not contain valid UTF-8

1  Asked on December 30, 2021 by chaitanya-bapat

   

Acceptable Gas Usage of Smart Contract functions

3  Asked on December 30, 2021 by wbt_

 

Use Values Returned from One Function in Another

1  Asked on December 27, 2021 by kevin-phillips

         

What is the v part of transaction signature?

1  Asked on December 27, 2021 by anh-dng-l

   

How to convert hashed result into readable format?

1  Asked on December 25, 2021 by sowmay-jain

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP