1

I've tried fix that problem. but still i don't know what was wrong

enter image description here

If someone can fix this problem, please save me. I'm still trying this.

below sample code

contract HelloWorld {
    uint private simpleInt;

    function GetValue() public view returns (uint) {
        return simpleInt;
    }

    function SetValue(uint _value) public {
        simpleInt = _value;
    }
}

contract client {
    address obj ;

    function setObject(address _obj) external {
        obj = _obj;
    }

    function UseExistingAddress() public payable returns (uint) {
        HelloWorld myObj = HelloWorld(obj);
        myObj.SetValue(10);
        return myObj.GetValue();
    }
}

when i tried to created contract HelloWorld first and next created contract client. I executed setValue method first with that parameter and I got error when i executed useExistingAddress method

enter image description here

I use Geth window version in my computer and show you genesis.json

{
  "config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "nonce": "0x0000000000000042",
  "timestamp": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0xffffffff",
  "difficulty": "0x200",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0100000000000000000000000000000000000000",
  "alloc": {}
}

this is my geth command in .bat file

start geth --networkid 15 --nodiscover --maxpeers 0 --datadir "D:\myeth\chaindata" --rpc --rpcapi "eth,web3,miner,admin,personal,net" --rpccorsdomain "*" --unlock 0,1,2,3 --password "D:\myeth\pass.txt"
start geth attach rpc:http://127.0.0.1:8545

and this is state when i executed setObject function.

enter image description here enter image description here

I have a question. I set gas limit 30000000. but when i executed setObject function and check logs, gas and transaction cost were same. Is this normal?

please help me.

  • 3
    Please share your actual code, not a screenshot. (Screenshots are not searchable, so they're of little use to future developers who have the same problem.) – smarx Sep 1 '18 at 8:18
  • I updated it. sorry. – graychocobo Sep 1 '18 at 15:11
  • "I got error when i executed useExistingAddress" What error did you get? – smarx Sep 1 '18 at 15:14
  • Gas requirement of function client.UseExistingAddress() high: infinite. If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage) – graychocobo Sep 1 '18 at 15:15
  • that is in my analysis tab – graychocobo Sep 1 '18 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.