Gas estimation failed error while invoking a simple function
pragma solidity ^0.5.9;
contract sample{
uint number;
function setNumber(uint _number) public{
number = _number;
}
function getNumber() view public returns(uint){
return number;
}
}
It's deployed successfully on localhost:8545
. But while checking the function from remix it gave me error.
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? VM Exception while processing transaction: invalid opcode
while working fine on javascript VM.