3

I'm trying to deploy a contract on a private blockchain network. My solidity code has a lot of variables used in it. The deployment does give me a contract address, however, when trying to retrieve the bytecode from eth.getCode()(by passing the contract address which was generated from the transaction receipt), it returns 0x.

I tried increasing the gas limit in the solidity browser and created the contract. The contract does get created, however, the functions in the code does not return any value (i.e. it is not writing any data to the block). I assume, this boils down to the insufficient gas problem. The question is, how/where do i increase the gas? Why isnt my gasEstimate giving a proper estimate sufficient enough to execute the contract?

if anyone had a similar issue and found a solution for this, please help.

Thanks, Jacob


Below given is the format in which the code is written. However, it does have much more get and set functions and 2 more structs used. Around 20 variables in each struct. The code when put into the solidity compiler shows 20404 bytes and when created use 4689378 amount of gas.

Solidity Compiler Screenshot

 pragma solidity ^0.4.0;
contract ABC{
        uint i;
        uint rowCount = 0;
        User userObj;

 function ABC() {}
        struct User{ 
            uint rowCount;
            string id; 
            string ABCData;
            string DEFData;
            ......
            ......
            ......
            around 20 variables.
    }

     mapping(uint => User) ABClist; 
    function setABCData(string uid,string ABCData,string DEFData,........) { 

        rowCount = rowCount + 1;
        ABClist[rowCount].rowCount = rowCount;
        ABClist[rowCount].id = uid;
        ABClist[rowCount].ABCData = ABCData;
        ABClist[rowCount].DEFData = DEFData;
        ...........
        ...........
        ...........
        ...........

    }



        function getABCData(string uid) constant returns ( string _id, string _ABCData, string _DEFData, ........)
    {
        uint rowNumber;
        for(i = 0; i <=rowCount; i++){
            if(stringsEqual(ABClist[i].id, uid) || stringsEqual(ABClist[i].ABCData, uid) || stringsEqual(ABClist[i].DEFData, uid)){
                userObj.id = ABClist[i].id;
                userObj.ABCData = ABClist[i].ABCData;
                userObj.DEFData = ABClist[i].DEFData;
                rowNumber = i;
            }
        }
        return (userObj.id, userObj.ABCData, userObj.DEFData, rowNumber);
    }

    }
  • please share your code, if the contract is deployed on the testnet or mainnet share its link – Badr Bellaj May 24 '17 at 8:56
  • Have edited my question with the code sample. – Jacob May 24 '17 at 11:36
  • Is there a way, I can increase the Block Gas limit on a private blockchain network? – Jacob May 24 '17 at 11:46
1

If you use the ethereum wallet you can increase the gas in the window that opens when you press deploy. If you click on the blue underlined text you can type in it

The slider changes the gas price, not the gas amount

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.