I have this sample contract that I am trying to run. The function getvalues returns me correct values set earlier, when the setvalues function was written to set 2 values. when i modified the contract to set & return 3 values instead of 2, contract was mined successfully, but getvalues function returns only zeros.

Sample run:




When the contract was written to set and return 2 values:




Here is the contract that returns 3 values:

contract sampcont2{

    struct customer{
        uint custid;
        uint custvalue1;
        uint custvalue2;
        uint custvalue3;
        string comments;


    mapping(uint => customer) customers;

      function setvalues(uint cid,uint a,uint b,uint c) {
        customers[cid].custid = cid;
        customers[cid].custvalue1 = a;
        customers[cid].custvalue2 = b;
        customers[cid].custvalue3 = c;


    function getvalues(uint id) constant returns (uint x,uint y,uint z) {

         return (customers[id].custvalue1,customers[id].custvalue2,

Edit: This is what I see:

I0922 13:49:51.737177 core/database_util.go:353] stored block receipts [01f78178.] I0922 13:49:51.737177 core/tx_pool.go:547] removed tx ( TX(c56cb49dcfd4828ea4bc7dd903de834b4119dbf6d368d9015df423dff11d82f4) Contract: false From: 85e148c97b24c1c1a3bfe91782cb2c9831c38b98 To: 4d37aa6cc5c73464265faefe668d5beb8f517edd Nonce: 248 GasPrice: 20000000000 GasLimit 90000 Value: 0 Data: >0x4378d76f00000000000000000000000000000000000000000000000000000000000003ec00000>00000000000000000000000000000000000000 0000000000000000000660000000000000000000000000000000000000000000000000000000000>00010e00000000000000000000000000000000000000000000000000 0000000000010e V: 0x1b R: >0xb52e254bb50c4c244124b9ac96b215b0d3265bd5bb676b22a8c081801c715037 S: >0x42889e66fcdcb0734dc78f081b598b0a3b467cf3e13d14cfa832035a19309163 Hex: >f8eb81f88504a817c80083015f90944d37aa6cc5c73464265faefe668d5beb8f517edd80b884437>8d76f000000000000000000000000000000000 00000000000000000000000000003ec000000000000000000000000000000000000000000000000>00000000000000660000000000000000000000000000000000000000 00000000000000000000010e0000000000000000000000000000000000000000000000000000000>00000010e1ba0b52e254bb50c4c244124b9ac96b215b0d3265bd5bb6 76b22a8c081801c715037a042889e66fcdcb0734dc78f081b598b0a3b467cf3e13d14cfa832035a>19309163 ) from pool: low tx nonce or out of funds

So is it actually a gas problem?

  • I suggest trying with more gas.
    – kobigurk
    Sep 15 '16 at 9:36
  • thx , I will try that, but I am already using 4700000 in the contract, while the transaction and execution costs are as below: Transaction cost: 172257 gas. Execution cost: 92317 gas.
    – eNVy
    Sep 15 '16 at 9:40
  • I am using Broswer-solidity, i tried copying the text within Web3 deploy box, increased the gas amount there which was previously set to 4700000. however, anything greater than 4700000 throws an error : "Exceeds Block Gas Limit undefined"
    – eNVy
    Sep 15 '16 at 10:47
  • Can you confirm that your contract was deployed with eth.getCode(addressOfContract)? Sep 15 '16 at 11:17
  • Yes Xavier, it did. I got the Bytecode.
    – eNVy
    Sep 15 '16 at 11:22

Updated 11:53 Sep 22 2016

Yes it is a gas problem. Your setvalues(2500,100,120,130) transaction was sent with the default gas of 90,000. This transaction requires at least 102,768 gas.

Details Below

I'm testing out using the latest Solidity realtime compiler and geth 1.4.11-stable in local dev mode with the following command:

geth --datadir ~/EtherDev/data --dev --nodiscover --mine --minerthreads 1 --port 30301 --maxpeers 0 --verbosity 3 --unlock 0 --password ~/EtherDev/etc/passwordfile --rpc --rpccorsdomain '*' console

I deployed your contract as shown in the following screen:

enter image description here

I called setvalues(2500,100,120,130) as shown in the following screen:

enter image description here

You can see that 102,768 gas was used in sending the transaction.

And I queried getvalues(2500) as shown in the following screen:

enter image description here

  • I was hoping upgrading to latest geth would work, but looks like it doesn't help :(
    – eNVy
    Sep 20 '16 at 9:56
  • thx @BokkyPooBah , so I tried changing gaslimit with --targetgaslimit as well, but on trying to setvalues, i still get gas limit as 90000, how can i get around this?
    – eNVy
    Sep 26 '16 at 9:58
  • How are you deploying your contract, and how are you sending the transaction? Using geth command line?
    Sep 26 '16 at 10:00
  • Yes @BokkyPooBah
    – eNVy
    Sep 27 '16 at 8:12
  • The syntax is like c.stateChanger(3, {from:eth.accounts[0], gas: 400000}) from ethereum.stackexchange.com/questions/7557/…
    Sep 27 '16 at 8:41

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.