0

I have created two Contract to separate out storage and validation rules.

ValidationService.sol

pragma solidity ^0.4.16;
import "./Storage.sol";

contract ValidationService {

Storage public store;


 constructor(address add) public{
    store=Storage(add);
 }


 function getMyNumber() public constant returns (uint) {

     return store.getNumber();

 }


}

Storage.sol

pragma solidity ^0.4.16;

contract Storage {

uint public mynum = 5;


  function getNumber() public constant returns (uint) {
    return mynum;
  }

 }

I have called getMyNumber method which called getNumber method of Storage contract and it should return 5 as a output.

validationservice.getMyNumber.call()

The above code is working fine in remix and truffle development environment but it is not working in private blockhain network using Geth.

If i call getNumber method of Storage contract directly from geth console, It's working fine.

Can anyone please guide where is my mistake

  • I have found the error in the miner console, after enable verbosity option. Ethereum threw "Invalid opcode 0x3d" error message whenever, I call getMyNumber Method. Please help me if anyone know about this error and how to resolve it. – Gunavant Jun 20 '18 at 9:55
2

I have resolved the issue. I have used "byzantiumBlock": 0 into genesis.json file and recreated private blockchain.

For more detail, please refer

Invalid opcode 0x3d

Thanks you all

0

This works fine. The only case in which it won't work is if you are not passing the correct address when deploying validationService.

Hope this helps

  • I am passing the correct address. The method has been executed successfully without any error but always returns 0 instead of 5. – Gunavant Jun 19 '18 at 6:06
0

If you are getting below error-

call to ValidationService.getMyNumber errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value. Debug the transaction to get more information. 

then you are using the incorrect address. It would be great if you can share some more information about the error you are facing.

  • Method is executed successfully without any error. It returns 0 instead of 5 on Geth console. – Gunavant Jun 19 '18 at 6:07
  • I ran miner using Verbosity level 5 and I have found that, It gave "Invalid opcode 0x3d" error message whenever, I call getMyNumber Method. Please guide me what this error is and how to solve it – Gunavant Jun 20 '18 at 9:51

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.