0

Anyone know what causes this contract to not deploy on Ethereum Classic?

contract A{
    function b() public returns(uint) {return 4;}    
    uint public c = b();
}

Deploying the contract on Ethereum Classic with Remix and Nifty wallet gives the error,

enter image description here

While it works on the application rescue fork of Ethereum,

enter image description here

6
  • Have you tried to put the part c = b(); inside a constructor? Nov 20 '19 at 9:28
  • That gives the same error, "Internal JSON-RPC error." contract A{ function b() public returns(uint) {return 4;} uint public c; constructor() public { c = b(); } }
    – user56836
    Nov 20 '19 at 9:32
  • What about adding an appropriate pragma statement at the top of the file? Nov 20 '19 at 9:36
  • same error, pragma solidity ^0.5.11; contract A{ function b() public returns(uint) {return 4;} uint public c; constructor() public { c = b(); } }
    – user56836
    Nov 20 '19 at 9:37
  • How about adding pure in the declaration of function b? Nov 20 '19 at 9:39
2

Ethereum Classic is still on the Byzantium EVM, when I compiled it as Byzantium instead of Constantinople it worked fine. ETC should be on Constantinople in January.

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.