0

Here it is my called function.

pragma solidity ^0.4.19;

contract Called{

    string public name;

    function set(string _var) {
        name = _var;
    }

    function   get() view returns (string){
        return name;
    }


    function A () payable {

    }



}

Here it is my Caller function.

pragma solidity ^0.4.19;

interface Called{

    function set(string);

    function get() view returns (string);
}

contract Caller {

    string public new_name;

    Called public called_address;

    function set_address(address _addy) {
        called_address = Called(_addy);
    }

    function caller_set(string _var) {

        called_address.set(_var);
    } 
    function caller_get() {
        new_name= called_address.get();

    }


    function B () payable {

    }


}

Here is my genesis file

{
  "config": {
        "chainId": 8888,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
  "alloc"      : {},
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0xffffffffffffffff",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

I am here interacting with called contract using caller contract. It works fine with in remix browser(without connected to ethereum network). When i connect remix browser to my private ethereum network caller_set function of caller contract works fine but when i called caller_get function it gives the error "gas required exceeds allowance or always failing transaction". I have given more and more gas but it always failed. somebody please help.

4
  • if the contract works maybe the problem is not in its code
    – user38075
    Commented Jun 4, 2018 at 11:21
  • Then what problem can be there? Commented Jun 4, 2018 at 11:28
  • I don't know, add info about your private network or the way you are calling the contract
    – user38075
    Commented Jun 4, 2018 at 11:29
  • by adding info, did you mean genesis file? and i am calling contract by connecting the remix to private ethereum network using rpc and calling function form remix interface. Commented Jun 4, 2018 at 11:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.