I am getting error while deploying smart contracts with web3.py. The error says "web3.exceptions.ContractLogicError: execution reverted: VM Exception while processing transaction: invalid opcode". I have included the solidity contract along with web3.py code and error logs. Am i doing the correct way or there is some other issues? Thanks in advance.
1 Answer
It's possible your blockchain doesn't support the Shanghai update. Since solidity v 0.8.20, the compiler implements the new opcode PUSH0, which your blockchain might think it's invalid.
So, change the solidity version from:
pragma solidity >=0.7.0 <0.9.0;
to:
pragma solidity >=0.7.0 <0.8.20;
-
i changed to version and got the following error "web3.exceptions.ContractLogicError: execution reverted: VM Exception while processing transaction: revert". Thanks. Commented Oct 13, 2023 at 5:25