First time newbie eth contract question. I'm using remix to compile the ethereum.com greeter example. I'm having problems with the gas when I deploy the contract.

if I specify :

gas: eth.getBlock(eth.defaultBlock).gasLimit -1

I get

Error: insufficient funds for gas * price + value

But if I bump it up to

gas: eth.getBlock(eth.defaultBlock).gasLimit +1

ask expected, I get

Error: exceeds block gas limit

my test balance is 22905390000000000, way over the gas limit. I'm clearly not understanding something here.

I've gutted my code, this is the contract in its entirety:

pragma solidity ^0.4.11;
contract greeter {
    /* main function */
    function greet() constant returns (string) {
        return "greeting" ;

When I submit this contract I get the error "Error: The contract code couldn't be stored, please check your gas amount"

Update: I printed out my eth.getBalance() before and after sending the contract. I still get the error "couldn't be stored" but I notice that my balance is going down by my gas*gasPrice.

  • Sometimes you can get errors completely unrelated to the real reason why this failed during deployment. Double-check the rest of your code if you're completely sure that you are sending the right amount of gas. Also, try to tweak the gas sent more. Jun 11, 2017 at 19:56
  • I've gutted my code to a single function that returns a static string. The gas estimate is about 70000, I upped that to 80000 and I'm getting the error: Error: The contract code couldn't be stored, please check your gas amount
    – simusid
    Jun 11, 2017 at 21:02

1 Answer 1


In your Genesis.json file check the gas limit value if it was less, increase it to 2,10,000. In ethereum for sending transaction, it requires minimum 21,000 gas units.

Your Answer

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

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