1

enter image description here

I am getting this error while migrating

Contract:
pragma solidity ^0.5.16;
contract Hello {
   string message;

   constructor() public {

   message = "Hello, World";

   }
   function getGreetings() public view returns (string memory)
   {
     return message;
   }
   function setGreetings(string memory _message) public{
     message = _message;
   }

}

2_deploy_contracts.js

var Hello = artifacts.require("./Hello.sol");
module.exports = function(deployer) {
   deployer.deploy(Hello);
};
2
  • And Yes I am Deploying it on local ethereum. not in ganache-cli Sep 6 '20 at 13:03
  • What is your genesis file? It should be missing the fork that enabled SHR opcode.
    – Ismael
    Sep 6 '20 at 17:55
3

Indeed adding

"byzantiumBlock": 0,
"constantinopleBlock": 0

to genesis.json fixed the problem for me, as the SHR opcode is a recent addition to geth in the Constantinople release (and byzantiumBlock must be added in order to add constantinopleBlock).

2

SO the Problem was in my genesis block, I wrote genesis.json myself so some parameters were missing. then I used puppeth to create new genesis block and that how i solve.

1

if you successfully migrated before..

Delete all files in --> truffle/build/contracts

-1

Following up with @tqd's answer, please put it in the "config" block of the genesis.json, not in the root. Wasted so much of my time.

1
  • Please, next time specify it as a comment on the answer of a user rather than in a separate answer. Jul 23 at 7:58

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.