web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

Cannot deploy empty contract

Open michaelerose opened this issue 8 years ago • 1 comments

When I try to deploy an empty Solidity contract to a local Geth blockchain using either a web3js or ethers.js node.js application, the contract is not deployed. Web3js throws a “contract cannot be stored” exception, ethers.js returns a transaction receipt with status 0x0, getCode returns 0x0, and geth displays the “stack underflow” VM error message. However, I have no trouble deploying the same contract from the Geth console using the same ABI and byte code data generated by the Solidity compiler in the applications.

The only explanation I can think of is that the ABI or bytecode data is corrupted in the JSON-RPC layer between the application and the ethereum node. Has anyone else experienced this problem? Is there any guidance you can give me concerning how to isolate, debug, and fix this?

Except from [email protected] code: exception thrown on second callback invocation

var theContract = web3.eth.contract ( JSON.parse(compile.interface) ) ; var transObj = { from: accounts [0] , gas: … , gasPrice: … , data: byteCode } ;

var contractInstance = theContract.new ( transObj , function(err, myContract){ console.log ( " Inside callback ..... " ) ; // NOTE: The callback will fire twice! // Once the contract has the transactionHash property set and once its deployed on an address });

I would be happy to supply more detail ... and thanks in advance for your help

michaelerose avatar Apr 27 '18 17:04 michaelerose

Version 0.20.x got his last maintenance release with v0.20.7. Please update your code to the latest 1.0 version of Web3.js. Further details about the current project state are explained in the release announcement of version 1.0.0-beta.38.

nivida avatar Mar 25 '19 19:03 nivida