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.
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);
}
}