I don't understand what happened in this transaction:


The transaction created a contract, sent 1 ETH, supplied input data, and did not run out of gas, but the result was a contract with no code.


What happened here?

1 Answer 1


I'm new here, so I could definitely be wrong, but I suspect this may be related to an issue that EIP2 solves.

The change they describe is:

If contract creation does not have enough gas to pay for the final gas fee for adding the contract code to the state, the contract creation fails (ie. goes out-of-gas) rather than leaving an empty contract.

And the rationale for their solution is:

Making contract creation go out-of-gas if there is not enough gas to pay for the final gas fee has the benefits that (i) it creates a more intuitive "success or fail" distinction in the result of a contract creation process, rather than the current "success, fail, or empty contract" trichotomy, (ii) makes failures more easily detectable, as unless contract creation fully succeeds then no contract account will be created at all, and (iii) makes contract creation safer in the case where there is an endowment, as there is a guarantee that either the entire initiation process happens or the transaction fails and the endowment is refunded.

The transaction you mention has a block height less than 1,500,000 which means it happened before the homestead release and before this fix was implemented. I'm new enough that I don't know how to tell how much gas would have been required to put the code into the contract.

If anyone knows more, please comment or edit.

  • The transaction did not run out of gas: 300000 limit, 175192 used. Is that still consistent with the pre-EIP2 behavior?
    – pyggie
    Commented Jun 8, 2017 at 6:17
  • The 175192 was just to create the contract. Additional gas is needed to add the code. I'm not sure how to tell how much gas would have been needed to add the code in this case. So yes, it is consistent. Commented Jun 10, 2017 at 22:56
  • This gives the same answer, old behavior was to create empty contracts in when gas is not enough, but it didn't cause an exception solidity.readthedocs.io/en/latest/…
    – Ismael
    Commented Jun 15, 2017 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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