Initially, I was working locally with ganache and the smart contracts were working correctly. Then I tried to work on geth and I get the following error:

Traceback (most recent call last):
  File "manager.py", line 165, in <module>
  File "manager.py", line 142, in start_application
  File "manager.py", line 68, in register_user
  File "manager.py", line 16, in register_user
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/registrationContract.py", line 11, in registerUser
    tx_receipt= self.contract.functions.registerUser().transact({'from': User.address})
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/contract.py", line 1151, in transact
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/contract.py", line 1454, in transact_with_contract_function
    txn_hash = web3.eth.sendTransaction(transact_transaction)
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/eth.py", line 264, in sendTransaction
    get_buffered_gas_estimate(self.web3, transaction),
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/utils/transactions.py", line 84, in get_buffered_gas_estimate
    gas_estimate = web3.eth.estimateGas(gas_estimate_transaction)
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/eth.py", line 305, in estimateGas
  File "/mnt/c/Users/Achilleas/Dissertationnew/application/env/lib/python3.6/site-packages/web3/manager.py", line 112, in request_blocking
    raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'invalid opcode: SHR'}

The geth script I use is the following:

geth --rpc --rpccorsdomain "*" --rpcapi "db,eth,net,web3,personal" --datadir ./chaindata/
 --nodiscover --rpcport "port" --rpcaddr "address" --networkid "id" --identity "identity" --unlock 
"account_address" --allow-insecure-unlock --mine --minerthreads=1

"User.address" in the error message is the same address with "account_address" in geth script.

I did not change anything in the code. Do I need to sign the transaction (the account is unlocked)?

  • From the error message it seems newer opcodes are not enabled in you genesis file. See this answer ethereum.stackexchange.com/a/74103, how to modify your genesis file to enable required opcodes. – Ismael Jun 18 at 20:29
  • 1
    As @Ismael proposed I needed to change the genesis file. Everything is working fine now. – Yurogini Jun 19 at 9:20

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.