{"id":"EIP-1344","name":"ChainID Opcode","status":"Final","chain":"both","category":{"id":"security","name":"Security & Trust","description":"Helping users verify, control, and protect their assets"},"journeyStages":[{"id":"status","name":"Status & Confirmation","description":"Waiting for and confirming outcomes"}],"uxImpact":"Smart contracts can verify which chain they're on, enabling chain-aware logic for bridges and L2s. Design implications: display chain context in multi-chain interfaces, show 'Supported Networks' clearly, indicate when contract behavior varies by chain. Design decisions: whether to expose chain-specific features or abstract them away — transparency vs simplicity tradeoff.","hasDetailedContent":true,"content":{"id":"EIP-1344","summary":"EIP-1344 added a CHAINID opcode so smart contracts can read the chain ID directly. Before this, contracts had to trust users or oracles to tell them which chain they were on. Now contracts can verify \"I'm on Ethereum mainnet\" themselves, enabling secure cross-chain aware logic and built-in replay protection.","applicability":{"whenToUse":["Your product addresses: contracts couldn't verify which chain they were on.","Your product addresses: smart contract replay attacks.","The flow should deliver: contract reads chain ID directly from the EVM.","You are designing a chain-aware transaction validation experience with visible states and recovery paths."],"whenToAvoid":["Parse error and explain \"This was signed for a different chain\".","Show \"Chain-verified\" badge for secure contracts.","Always display chain ID/name in signature UI.","Wrong-address or approval mistakes are not recoverable in your product context."]},"designerTakeaways":["You can design UI that delivers contract reads chain ID directly from the EVM.","You can design UI that delivers contracts verify chain ID before executing sensitive operations.","You can design UI that delivers contract checks if message is meant for this chain."],"problemsSolved":[{"problem":"Contracts couldn't verify which chain they were on","oldWay":"Pass chain ID as parameter, hope nobody lies","newWay":"Contract reads chain ID directly from the EVM","impact":"critical"},{"problem":"Smart contract replay attacks","oldWay":"Contract logic could be tricked across chains","newWay":"Contracts verify chain ID before executing sensitive operations","impact":"high"},{"problem":"Cross-chain message verification was complex","oldWay":"Needed trusted oracles or complex verification","newWay":"Contract checks if message is meant for this chain","impact":"high"},{"problem":"Hardcoded chain IDs were fragile","oldWay":"Contract deployed with hardcoded chain ID, breaks on forks","newWay":"Dynamic chain ID reading works after forks","impact":"medium"}],"uxPatterns":[{"name":"Chain-Aware Transaction Validation","description":"Contract rejects transactions meant for other chains","mockup":"concept/verify-safety","userFlow":["User tries to use cross-chain message","Contract checks chain ID via opcode","Mismatch detected, transaction reverts","Clear error explains the issue","User guided to correct network"]},{"name":"Multi-Chain Contract Status","description":"Show contract awareness of its chain","mockup":"concept/verify-safety","userFlow":["User views bridge or cross-chain contract","Contract chain awareness displayed","Security features explained","User confident in contract protection"]},{"name":"Permit Chain Verification","description":"Show that permit signatures include chain verification","mockup":"concept/permit-approval","userFlow":["User signing permit for token approval","Chain ID shown as part of permit data","Contract will verify chain before accepting","User understands signature is chain-locked"]}],"uiComponents":[{"name":"ChainVerificationBadge","description":"Shows contract uses chain ID verification","states":["verified","unverified","checking"],"props":["chainId","isVerified","contractType"]},{"name":"ChainMismatchError","description":"Error display for chain ID rejection","states":["error","suggestion"],"props":["expectedChain","actualChain","onSwitch"]},{"name":"SignatureChainContext","description":"Shows chain context for signatures","states":["current","different","unknown"],"props":["signatureChainId","currentChainId"]}],"antiPatterns":[{"pattern":"Not explaining chain mismatch errors","why":"User sees \"execution reverted\" with no context","instead":"Parse error and explain \"This was signed for a different chain\"","severity":"high"},{"pattern":"Hiding chain verification status","why":"Users don't know if contract is protected","instead":"Show \"Chain-verified\" badge for secure contracts","severity":"medium"},{"pattern":"Not showing chain ID in signature requests","why":"User signs without knowing which chain it's for","instead":"Always display chain ID/name in signature UI","severity":"medium"}],"onMonad":[{"aspect":"Monad Chain ID Verification","ethereum":"Contracts check for chain ID 1","monad":"Monad contracts check for Monad's chain ID","designImplication":"Ensure Monad-deployed contracts use correct chain ID checks"},{"aspect":"Cross-Chain Bridges","ethereum":"Bridge contracts verify source chain","monad":"Bridges to/from Monad use CHAINID opcode","designImplication":"Clear indication of source/destination chain in bridge UIs"},{"aspect":"Fast Verification","ethereum":"Chain ID check is cheap (2 gas for opcode)","monad":"Same minimal cost, no UX impact","designImplication":"No need to show \"verifying chain\" loading states"}],"relatedStandards":[{"id":"EIP-155","relationship":"EIP-155 puts chain ID in transaction signatures, EIP-1344 lets contracts read it"},{"id":"EIP-712","relationship":"EIP-712 typed data includes chain ID, contracts verify with CHAINID opcode"},{"id":"EIP-695","relationship":"eth_chainId for dApps, CHAINID opcode for contracts"},{"id":"ERC-2612","relationship":"Permit signatures include chain ID, verified by contract"}]},"sources":[{"label":"Official specification","url":"https://eips.ethereum.org/EIPS/eip-1344","type":"official-spec"},{"label":"Discussion","url":"https://ethereum-magicians.org/search?q=EIP-1344","type":"discussion"}],"urls":{"canonical":"https://www.eipsfordesigners.com/standards/EIP-1344","markdown":"https://www.eipsfordesigners.com/standards/EIP-1344/content.md","agent":"https://www.eipsfordesigners.com/standards/EIP-1344/agent.md","api":"https://www.eipsfordesigners.com/api/standards/EIP-1344","official":"https://eips.ethereum.org/EIPS/eip-1344","discussion":"https://ethereum-magicians.org/search?q=EIP-1344"},"freshness":{"lastReviewed":"2026-04-05","lastUpdated":"2026-04-05"}}