[Ethereum] Out of gas during contract creation

contract-deploymentexplorersjson-rpcout-of-gas

A few days ago, several attempts at creating a contract failed with out of gas errors (confirmed by etherscan/ethercamp and getBalance API), however it is not clear to me what failed exactly, and how it can be diagnosed.

Not enough gas for 'No gas to return just created contract' cause
spending

One such transaction is 0x47bf53491a14e64bc8938afa97d4b012677f465bddd7c3c0bbfb5df2baa99127

If you check it in Etherscan and ether.camp, it is listed with an error, but when looking at the vmtrace in both explorers, or when looking at the output of debug.traceTransaction, no error is reported.

The transaction receipt also shows no error and indicates a contract address as if everything worked.

What exactly went wrong?

(I tentatively declared an Issue for geth, but I am unsure of how it should be qualified)

edit AFAICT there four transactions with the same behavior, listed below, (they are not mine, nor my attempts, I am only interested in them because of the out of gas behavior)

  • 0x0b157cbbcca6079664e1f61e5f5e33241999c1cc1a7dbc1adad347b904c0fb65
  • 0xc712e39a316745d1c0154941bcd9c60eacaf6287596dd3e356249e69509d20c1
  • 0xaf071ce2147cc61d951a07c4e123c99f84b50e3656ceb07bba2c78796875626c
  • 0x47bf53491a14e64bc8938afa97d4b012677f465bddd7c3c0bbfb5df2baa99127

Best Answer

You only provided 500,000 gas when creating the transaction, and the transaction burned through all of it (see "Gas" and "Gas Used By Transaction" on Etherscan). You really just need to provide more gas.

As seen on Ethstats, the current gas limit (per block) is 4,712,388. You may want to try submitting the transaction on Testnet or using eth_estimategas to see exactly how much gas it's going to take to get this contract creation transaction to process before you go about spending that much gas on one transaction.