TL:DR My first contract fails to deploy reporting variously:

  • Error: intrinsic gas too low undefined
  • Error: The contract code couldn't be stored, please check your gas amount. undefined

Having just investigated Hyperledger Fabric, I thought I'd try my hand at converting it's fabcar example to Ethereum.

I'm running an Ethereum private network with:

geth --dev --ipcpath ${HOME}/Library/Ethereum/geth.ipc

and then attaching to this with:

geth attach ipc://${HOME}/Library/Ethereum/geth.ipc

I wrote fabcarSource.sol using an example (link) and taking some feedback from solc. The original uses an associative array (JavaScript object here) but the sample I followed uses a regular array and so I am here at least to get this deployed. [Feedback welcome.]

pragma solidity ^0.4.9;

contract Fabcar {

    struct Car {
        string colour;
        string make;
        string model;
        string owner;

    Car[] cars;

    function changeCarOwner (uint k, string newOwner)
        if (k<cars.length) {
            cars[k].owner = newOwner;
            return true;
        } else {
            return false;
    function createCar(string colour, string make, string model, string owner)
        returns (uint)
        return cars.push(Car(colour,make,model,owner));
    function initLedger() {
        cars.push(Car("Dark Gray","Ford","Escape","Daz"));
    function queryCar(uint k)
        returns (Car)
        if (k<cars.length) {
            return cars[k];
    function queryAllCars()
        returns (Car[])
        return cars;


Per my guide (link):

echo var fabcarSource = > fabcarSource.js && \
solc --combined-json abi,bin,interface fabcarSource.sol >> fabcarSource.js

and then:

var fabcarContract = web3.eth.contract(
var gasValue = eth.estimateGas({

and a check:

> gasValue

and, after more Googling:

> eth.getBlock("latest").gasLimit
> eth.getBalance(eth.coinbase)


var fabcar=fabcarContract.new(
    if (typeof contract.address !== "undefined") {
        "Contract mined! Address: " + contract.address + 
        " transactionHash: " + contract.transactionHash

and using gasValue, gasValue+50000, 300000 (tutorial), 500000 results in the errors up-top.

Any help would be much appreciated!

As others have pointed out, the getting started instructions are frustratingly out-of-date and increase abandonment. Please fix!


I found several very helpful links: one on StackExchange for using a private network (link) and another that got me a sample deployed (link) and I was able to get greeter deployed thanks to them. But this took time and I remain close to giving up.

  • Aha! Perhaps partly a consequence of (a) indeterminate string sizes with the Car struct (and functions)? I found this question regarding Solidity examples using bytes32 instead of string; (b) missing 'payable' for mutators. I will see whether these make a difference to the Deployment. (ethereum.stackexchange.com/questions/3795/…)
    – DazWilkin
    Commented Oct 31, 2017 at 23:28
  • These did not make a difference :-(
    – DazWilkin
    Commented Oct 31, 2017 at 23:44
  • I was able to use ethereum.github.io/browser-solidity to create a web3deploy that I was (!) able to deploy. It has gas: '4700000' (string) but... I then encounter problems with an inability to return Structs from functions etc.
    – DazWilkin
    Commented Nov 1, 2017 at 0:44
  • I am able to deploy using my example above by setting gas to 4.7m as with the web3deploy but as an int value not a string. So, that's one problem solved.
    – DazWilkin
    Commented Nov 1, 2017 at 0:48

1 Answer 1


I believe my deployment errors were solely related to an incorrect gas value.

It remains unclear to me how to determine the gas value for deployments when eth.estimateGas was so far from the value I needed.

Setting the gas value to 4.7m (in this case) works, reliably.

The value is approximately eth.getBlock("latest").gasLimit (4,712,388) and I assume that's relevant.

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.