enter image description here

I am getting this error while migrating

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;



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

5 Answers 5


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).


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.


if you successfully migrated before..

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


Adding "byzantiumBlock": 0, and "constantinopleBlock": 0, to my genesis fixed the issued. My full genesis looks like:

  "config": {  
    "chainId": XXX, 
    "homesteadBlock": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "eip145Block": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0
  "difficulty": "0x400",
  "gasLimit": "0x8000000", 
  "alloc": {}

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.

  • Please, next time specify it as a comment on the answer of a user rather than in a separate answer. Jul 23, 2021 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.