I tried contract interaction using following code:

contract C2 { 
    function aFunction(uint aParameter) returns(uint) {
    return (10);
contract C1 { 
    function call (uint aParameter) returns(uint){
        C2 c2 = new C2();
    return c2.aFunction(aParameter);

It worked for me. Then i changed return c2.aFunction(aParameter); to return c2; It returned me an address (suppose c2_addr). I executed eth.getCode(c2_addr); It just returned "0x". Now i have following questions:

  1. I just called the "call" function of C1 without using sendTransaction(). So how the line C2 c2 = new C2(); is executed.
  2. Contract C2 is mined or not.If yes, then who deployed it as i invoked the function as .call() and why there is no bytecode in blockchain regarding this contract. And if C2 is not mined, how it is possible to invoke its function.

What client are you using?


return c2.aFunction(aParameter);


return c2;

in contract C1 does not compile since it's an object type returned by a method declared to return unsigned integers (uint).

As of now, you can return objects only within internal function calls and not to a remote client.


I've run the code. The "address" that you are getting is not an address, but a conversion to bytes of the c2 contract instance.

  • I am using GETH. I changed return type as "address" and i checked it from online solidity browser, there was no compilation error.
    – Aniket
    Jul 29 '16 at 6:18
  • I have attached the screenshot in the question. @Sebi
    – Aniket
    Jul 29 '16 at 6:31
  • See edit. The address returned does not belong to any contract but it's a sequence of bytes of the contract's instance c2.
    – Sebi
    Jul 29 '16 at 8:57
  • Contract C2 is mined or not? if not then how its functions are available, if yes what is its contract address?
    – Aniket
    Jul 29 '16 at 9:36
  • Both contracts are mined. You can see their address in the lower right pane in solidity browser (for example: C1 at 0x692a70d2e424a56d2c6c27aa97d1a86395877b3a (memory))
    – Sebi
    Jul 29 '16 at 9:38

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.