optimism
Installation
SKILL.md
Optimism
Optimism is an EVM-equivalent Layer 2 using optimistic rollups. Transactions execute on L2 with data posted to Ethereum L1 for security. The OP Stack is the modular framework powering OP Mainnet, Base, Zora, Mode, and the broader Superchain. Smart contracts deploy identically to Ethereum — no custom compiler, no special opcodes.
What You Probably Got Wrong
- OP Mainnet IS EVM-equivalent, not just EVM-compatible — Your Solidity contracts deploy without modification. No
--legacyflag, no custom compiler.forge createandhardhat deploywork identically to Ethereum. If someone tells you to change your Solidity for "OP compatibility", they are wrong. - Gas has two components, not one — Every transaction pays L2 execution gas AND an L1 data fee for posting calldata/blobs to Ethereum. If you only estimate L2 gas via
eth_estimateGas, your cost estimate will be wrong. The L1 data fee often dominates total cost. Use theGasPriceOraclepredeploy at0x420000000000000000000000000000000000000F. - L2→L1 withdrawals take 7 days, not minutes — L1→L2 deposits finalize in ~1-3 minutes. L2→L1 withdrawals require a 7-day challenge period (the "fault proof window"). Users must prove the withdrawal, wait 7 days, then finalize. Three separate transactions on L1. If your UX assumes instant bridging both ways, it is broken.
block.numberreturns the L2 block number, not L1 — On OP Mainnet,block.numberis the L2 block number. To get the L1 block number, read theL1Blockpredeploy at0x4200000000000000000000000000000000000015. L2 blocks are produced every 2 seconds.msg.senderworks normally — there is notx.originaliasing on L2 — Cross-domain messages from L1 to L2 alias the sender address (add0x1111000000000000000000000000000000001111). But for normal L2 transactions,msg.senderbehaves exactly like Ethereum. Only worry about aliasing when receiving L1→L2 messages in your contract.- Predeploy contracts live at fixed addresses starting with
0x4200...— These are NOT deployed by you. They exist at genesis.L2CrossDomainMessenger,L2StandardBridge,GasPriceOracle,L1Block, and others all live at hardcoded addresses in the0x4200...range. Do not try to deploy them. - The sequencer is centralized but cannot steal funds — The sequencer orders transactions and proposes state roots. If it goes down, you cannot submit new transactions until it recovers (or until permissionless fault proofs allow forced inclusion). But the sequencer cannot forge invalid state — the fault proof system protects withdrawals.
- EIP-4844 blob data changed the gas model — After the Ecotone upgrade (March 2024), OP Mainnet posts data using EIP-4844 blobs instead of calldata. This reduced L1 data fees by ~10-100x. The
GasPriceOraclemethods changed. If you are reading pre-Ecotone documentation, the fee formulas are outdated. - SuperchainERC20 is not a standard ERC20 — It is a cross-chain token standard for OP Stack chains that enables native interop between Superchain members. Tokens must implement
ICrosschainERC20withcrosschainMintandcrosschainBurn. Do not assume a regular ERC20 works across chains.