1

My environment is Web3 Provider (127.0.0.1:8080) which is a private network in my Mac. I have tried to deploy and run transaction in Remix with a simple solidity as follows.

pragma solidity >=0.4.21 <0.6.0;
contract Simple {
   uint256 storedNumber;

   function setNumber(uint256 x) public {
        storedNumber = x;
   }
   function getNumber() public view returns (uint256) {
        return storedNumber;
   }
}

Deployed contract well, but it made error at transaction as follows.

"Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? gas required exceeds allowance (8000000) or always failling transaction."

My Genesis.json file as follows.

{
    "config": {
        "chainId" : 15,
        "homesteadBlock" : 0,
        "eip150Block" : 0,
        "eip155Block" : 0,
        "eip158Block" : 0,
        "constantinopleBlock": "0",  // Added here
    },
    "nonce" : "0x0000000000000042",
    "timestamp": "0x00",
    "parentHash":
    "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x00",
    "gasLimit": "0x800000",
    "difficulty": "0x400",
    "mixhash":
    "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
        "0x4D2A52F18D5dC0e2A0E44945D387346FdD4eCc2f": { 
            "balance": "10000000000000000000"
        }
    }
}
  • What is your genesis file? Do you have byzantium opcodes enabled? Which version of solidity are you using? – Ismael Dec 14 '19 at 5:04
  • My genesis file is added in the question above. Can you explain about byzantium opcodes enabled? Solidity version : 0.5.14+commit.01f1aaa4. – JongH Dec 14 '19 at 5:14
  • Since solc 0.5.7 code generated uses opcodes that appeared in Constantinople fork. You have to update your genesis with newer opcodes and regenerate your private blockchain ethereum.stackexchange.com/questions/69530/…. – Ismael Dec 14 '19 at 5:21
  • 1
    You should use puppeth to generate a genesis file. Also modifying genesis will not work you have to delete the whole blockchain and execute geth init again. – Ismael Dec 14 '19 at 6:09
  • 1
    Does this answer your question? Genesis.json in private (geth) network – Ismael Dec 17 '19 at 17:39

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.