4

I'm trying to deploy a contract into ethereum, but I keep getting "out of gas" error.

How can I know in advance how much ethers I need to deploy a contract?

  • 1
    Duplicate and answered here: ethereum.stackexchange.com/questions/799/… – Dakota Quint Apr 12 '17 at 11:42
  • Out of gas may be a manifestation of a constructor failure. If there are any required arguments or some other reason the constructor could fail or possibly invalid ByteCode, the error might bubble up and present as out of gas. Maybe post the source to see if someone can spot a problem. – Rob Hitchens - B9lab Apr 12 '17 at 12:00
  • It doesn't really answer my question, there is this spreadsheet in that answer that only mentions low level programming, how can I estimate my code based on that? Is there any tool that can pre calculate the cost or something? – Resten Apr 12 '17 at 12:00
  • @Rob there is no tool out there to calculate this? – Resten Apr 12 '17 at 12:01
  • The easiest way to tell is to just deploy the contract on testrpc or the testnet and see how much it costs – Tjaden Hess Apr 12 '17 at 12:48
6

One online tool (no syncing, no installing) is Remix a.k.a. Browser Solidity.

https://ethereum.github.io/browser-solidity

In screen shot below, a trivial contract called "Mortal" cost 319,273 gas to deploy.

enter image description here

Hope it helps.

  • But my contract includes other small contract, and other contracts that I have installed through npm. Looks like Remix doesn't useful in this case. – hqt Apr 28 '18 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.