0

I'm currently running a geth node in full mode. Later on, I've succesfully deployed this contract in Ropsten network.

> deployed_contract
{
   abi: [{
    anonymous: false,
    inputs: [{...}, {...}],
    name: "Tic",
    type: "event"
    }, {
    inputs: [],
    name: "incr",
    outputs: [],
    stateMutability: "nonpayable",
    type: "function"
   }, {
    inputs: [{...}],
    name: "set",
    outputs: [],
    stateMutability: "nonpayable",
    type: "function"
    }, {
   inputs: [],
   name: "valor",
   outputs: [{...}],
   stateMutability: "view",
   type: "function"
   }, {
   stateMutability: "payable",
   type: "receive"
   }],
  address: "0xff72a3170b78c0f2d872048c8af91747a9022b6c",
  transactionHash: "0xc506d2a060cb67f918ad1993adf637447466ba8e40ebfd897c9b1e6614fd96f7",
  Tic: function bound(),
  allEvents: function bound(),
  incr: function bound(),
  set: function bound(),
  valor: function bound()
}

Then, I've create as always an instance of my contract with the following statement.

> var instance = contract.at("0xff72a3170b78c0f2d872048c8af91747a9022b6c")
undefined

But, when I tried to call the "valor" method the following happened.

> instance.valor().call()
Error: invalid opcode: SHR
    at web3.js:6365:9(45)
    at send (web3.js:5099:62(34))
    at web3.js:4155:41(50)
    at apply (native)
    at web3.js:4241:75(21)
    at bound  (native)
    at <eval>:1:1(2)

I think the problem is that the methods are bound functions. What's going on here? Any guesses? Thanks in advance.

1
  • Can you share the contract code? Ropsten testnetwork was deprecated last month, you should try to use sepolia or goerli.
    – Ismael
    Nov 9, 2022 at 6:19

1 Answer 1

0

Maybe your genesis file is missing the fork that enabled SHR opcode

Try adding:

"byzantiumBlock": 0, "constantinopleBlock": 0

to genesis.json file.

Hope this helps!

3
  • Thanks Olivier, where is that file? Nov 7, 2022 at 18:09
  • Should be somewhere in your geth files. See this "The genesis block is configured using a genesis.json file whose path must be provided to Geth on start-up" Nov 7, 2022 at 18:13
  • But, that is for private network not for Ropsten Network Nov 7, 2022 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.