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)
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
1 Asked on August 26, 2021 by notoriousj
3 Asked on August 26, 2021 by good_evening
2 Asked on August 26, 2021
1 Asked on August 26, 2021
1 Asked on August 25, 2021 by mkv
2 Asked on August 25, 2021 by nima
1 Asked on March 10, 2021 by radeg90
1 Asked on March 2, 2021 by sahitya-kumar-suman
1 Asked on February 27, 2021 by chenguang
1 Asked on February 27, 2021 by trevor-lee-oakley
0 Asked on February 23, 2021 by mario-roma
1 Asked on February 21, 2021 by john-murphy
1 Asked on February 21, 2021 by nealwalters
1 Asked on February 17, 2021 by nick-carraway
Get help from others!
Recent Answers
Recent Questions
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir