The contract code couldn't be stored, please check your gas amount. undefined
Getting this error while the gas is being is spent and transaction is being created. Not getting back the address and getting this error instead. Help me
Two years later and now I am having this problem too. What happened to the alleged sane answer that never got reposted? When I went to the trouble of compiling source in my program with solc, it worked fine. Then I got clever and tried to compile the contract once in remix, then use the ABI and bytecode to instantiate a copy when needed. The result is a horrible gasEstimate, and then when I gave it 2 million gas, the miner used 1.1 million, and then gave that message. I just updated to geth 1.8.9 and solc 0.4.24, and updated the contract code to make it happy. My constructor parameters are all correct too.
Okay, doing a little testing, I put back the compile and used solc's ABI and bytecode again to deploy the contract AND estimate gas. Using solc's bytecode is the only way I have come up with an estimate that's close, and for my contract it was over 3 million! So I apologize for not just keeping on adding gas.
I read elsewhere that the general rule for gas is a flat 21000 plus 68*. Looking at the block info, I see that I had misunderstood how many bytes my contract was trying to store, so live and learn. I still don't get why using the remix bytecode results in such a bad estimate compared to the solc. I thought remix was using solc, and it said it was v0.4.24, just like the solc I am using.
Comments
thks
One reason this can can happen if the constructor parameters aren't provided correctly.
What is this?
I read elsewhere that the general rule for gas is a flat 21000 plus 68*. Looking at the block info, I see that I had misunderstood how many bytes my contract was trying to store, so live and learn. I still don't get why using the remix bytecode results in such a bad estimate compared to the solc. I thought remix was using solc, and it said it was v0.4.24, just like the solc I am using.
The mysteries continue