If your deployment fails with invalid opcode: PUSH0, the bytecode you compiled uses an instruction the target chain (or local node) does not recognise.
Quick answer: Solidity 0.8.20 and newer compile for the Shanghai EVM or later by default, which emits the PUSH0 opcode (0x5f). Any network still running pre-Shanghai rules rejects it. Fix it by recompiling with evmVersion: "paris" (or by moving to a network that supports Shanghai). Core mainnet does support PUSH0: we tested it on 18 November 2026.
What the “invalid opcode: PUSH0” error means
PUSH0 was introduced by EIP-3855. It is a single-byte instruction at 0x5f that pushes the value 0 onto the stack for 2 gas. Before it existed, compilers used PUSH1 0x00, which costs 3 gas and takes two bytes of code. Ethereum activated it in the Shanghai upgrade.
The Solidity compiler started using it in version 0.8.20 (May 2023), the same release that made “Shanghai” the default EVM target, according to the Solidity changelog. Later releases moved the default forward again: cancun in 0.8.25, prague in 0.8.30 and osaka in 0.8.31. All of these targets include PUSH0.
The text of the error comes from Geth-style clients. In go-ethereum, the invalid-opcode error is formatted as invalid opcode: %s, where %s is the opcode’s name. A node that knows the name PUSH0 but hasn’t enabled it for the current fork reports invalid opcode: PUSH0. You’ll usually see it during gas estimation, which is why Remix shows “Gas estimation errored” before you even sign anything.
Where you can still hit it
- Private or local Geth networks whose genesis file doesn’t schedule the Shanghai fork.
- Local dev nodes pinned to an old hardfork, for example Anvil started with
--hardfork parisor a Hardhat network configured with an olderhardfork. - Forks, sidechains and app-chains that haven’t adopted Shanghai yet. Check the chain’s own docs. Don’t assume support just because it’s “EVM compatible”.
- Pre-built bytecode from someone else’s repo compiled with a newer default than the target network supports.
Does Core support PUSH0? (Tested result)
Yes. Core activated the Shanghai fork as part of the Fusion upgrade. The core-chain v1.0.12 release notes list Shanghai as scheduled for 19 November 2024. The Core smart contract guidelines say Core’s EVM matches Shanghai and tell developers to set evmVersion: "shanghai" for Core mainnet (1116) and Testnet2 (1114).
We also checked the live chain directly rather than relying on the docs alone. On 18 November 2026 we sent a contract-creation eth_estimateGas to https://rpc.coredao.org (chain ID 1116, block ~40,564,665). The init code was 0x5f5ff3 (PUSH0, PUSH0, RETURN):
curl -s -X POST https://rpc.coredao.org -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"from":"0x000000000000000000000000000000000000dEaD","data":"0x5f5ff3"}]}'
# result: {"jsonrpc":"2.0","id":1,"result":"0xd257"} (53,847 gas, success)
As a control, init code containing an undefined opcode (0x0c) failed on the same RPC with invalid opcode: opcode 0xc not defined. So the node really does reject opcodes it doesn’t support, and PUSH0 simply isn’t one of them. We also used Foundry to compile a small storage contract with Solidity 0.8.38 at its default target (osaka). The bytecode contains 21 PUSH0 instructions, and cast estimate --create against Core mainnet succeeded at 118,082 gas. The same contract compiled for paris (no PUSH0) estimated at 120,759 gas.

If you see this error while targeting Core, check that your wallet or script is actually connected to chain 1116 or 1114 and not to a local node or a different network. Our “invalid sender” chain ID guide covers how to confirm which chain you’re signing for.
How to fix “invalid opcode: PUSH0”
The fix is the same in every toolchain: tell the compiler to target an EVM version the network supports. For a pre-Shanghai network, that’s paris. You don’t have to downgrade Solidity itself. The Solidity compiler docs list paris, shanghai, cancun, prague and osaka as valid targets.
Foundry
Set evm_version in foundry.toml (see the Foundry compiler config reference), then rebuild with --force so cached artifacts are regenerated:
[profile.default]
evm_version = "paris"
You can also do a one-off build with FOUNDRY_EVM_VERSION=paris forge build --force. If you’re deploying to Core, our Foundry deployment guide for Core walks through the full flow.
Hardhat
Add evmVersion under the compiler settings in your Hardhat config:
solidity: {
version: "0.8.24",
settings: {
evmVersion: "paris", // use "shanghai" for Core, per Core docs
optimizer: { enabled: true, runs: 200 }
}
}
See our Hardhat deployment guide for Core for a complete config.
Remix and solc
In Remix, open the Solidity Compiler tab, expand Advanced Configurations and change EVM Version from “default” to paris. Then recompile and redeploy. With the command-line compiler, use solc --evm-version paris Contract.sol.
Confirm the fix worked
Disassemble the creation bytecode and count PUSH0 instructions. It should be zero for a paris build:
cast disassemble $(jq -r .bytecode.object out/Box.sol/Box.json) | grep -c PUSH0
Don’t just search the hex for 5f. That byte can also appear inside push data or the metadata hash, so a disassembler is the reliable check. In our test, the paris build showed 0 PUSH0 instructions and the default build showed 21.
Reproducing the error locally
To see the failure yourself, start Anvil (Foundry 1.9.0 in our test) on an old fork with anvil --hardfork paris. Then try to deploy PUSH0 bytecode with cast send --create. Anvil doesn’t use Geth’s wording. It rejected the deployment at gas estimation with EVM error NotActivated, which is the same underlying problem. The paris-compiled build of the same contract deployed successfully (status 1). Different clients phrase it differently, so treat “NotActivated”, “invalid opcode: PUSH0” and “opcode 0x5f not defined” as the same issue.
Which EVM version to use
| Target | Emits PUSH0? | Use it when |
|---|---|---|
| paris | No | The network has not activated Shanghai |
| shanghai | Yes | Core mainnet/Testnet2 (Core’s documented setting) |
| cancun / prague / osaka | Yes | The network documents support for that fork |
One caveat for Core: newer targets can enable opcodes beyond PUSH0. In our test, Core mainnet rejected the Osaka-era CLZ opcode (0x1e) with invalid opcode: opcode 0x1e not defined. Our simple contract compiled for osaka didn’t contain CLZ and deployed fine. Code that uses clz in inline assembly would fail, though. Sticking with Core’s documented shanghai setting avoids surprises. It also matches what Core Scan expects when you verify your contract.
FAQ
Do I need to downgrade to Solidity 0.8.19?
No. Downgrading works, but you lose newer compiler fixes. Keep your current compiler and set evmVersion to paris instead.
Will compiling for paris make my contract more expensive?
Slightly. Without PUSH0 the compiler falls back to longer instructions. In our test, deployment gas was 120,759 for the paris build versus 118,082 for the PUSH0 build, about 2% more.
Does Core mainnet support PUSH0?
Yes. Shanghai has been active on Core since the Fusion upgrade (November 2024), and our live eth_estimateGas test with PUSH0 init code succeeded on 18 November 2026.
The error appears in a transaction, not a deployment. Why?
A contract that’s already deployed can only contain PUSH0 if the chain accepted it. If a call fails this way, you’re probably simulating against a node or fork running older rules, such as a local fork pinned to an old hardfork.
Disclaimer: This article is for educational purposes only and is not financial or investment advice. Always test deployments on a testnet first. Our Core testnet faucet guide explains how to get test tokens.
