invalid opcode "0x1c" during smart contract method execution

by iOS-Developer84   Last Updated May 15, 2019 21:28 PM

I have written a smart contract to test event from java project using web3j I have prepared the web3j wrapper java class using solc compiler version "0.5.7+commit.6da8b019.Linux.g++"

I am using a private ethereum network to deploy the smart contract and execute method in smart contract.

The smart contract source is

pragma solidity ^0.5.7;

contract TestEvent {

    // Test Event will be received by java application
    event testEvent(string indexed message);

    function emitTestEvent(
        string  calldata message
     emit testEvent(message);

Java code to execute the method is

// Load broken smart contract build by solc version 0.5.7
        TestEvent contract = TestEvent.load("0x673ccae08d3c3f50f111fb9e5870c76bbbf60938",
                web3, credentials,
                GAS_PRICE, GAS_LIMIT);  // contract instance
        if (contract != null){
            TransactionReceipt transactionReceipt = contract.emitTestEvent("Message").send();

When executing the emitTestEvent method geth log output shows an error

"err="invalid opcode 0x1c"

enter image description here

What is the problem with my source code?

Answers 1

Opcode 0x1c is SHR or right shift, which was introduced in the recent update (more here). It was not available prior to February, 2019.

It is likely that your Java tool (web3j?) is out dated and does not recognize this opcode. You may be able to upgrade to a newer version which has Constantinople/St. Petersburg support.

April 11, 2019 09:32 AM

Related Questions

Updated October 03, 2017 12:28 PM

Updated August 02, 2017 17:28 PM

Updated August 15, 2017 21:28 PM

Updated January 15, 2018 19:28 PM

Updated September 08, 2017 12:28 PM