{"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":"EIP-1344 adds the CHAINID opcode, which returns the configured numeric chain ID to contract code. A contract must compare or bind that value in its own logic; the opcode is not a named-network attestation or automatic replay protection.","officialUrl":"https://eips.ethereum.org/EIPS/eip-1344","lastReviewed":"2026-09-18","lastUpdated":"2026-09-18","kind":"proposal","hasDetailedContent":true,"content":{"id":"EIP-1344","summary":"EIP-1344 adds the CHAINID opcode, which returns the configured numeric chain ID to contract code. A contract must compare or bind that value in its own logic; the opcode is not a named-network attestation or automatic replay protection.","applicability":{"whenToUse":["Contract logic needs the configured numeric CHAINID value for an explicit comparison or signature binding.","The application defines behavior for chain-ID changes and contentious forks.","The UI can distinguish numeric chain context from a named-network identity."],"whenToAvoid":["The contract does not compare CHAINID or bind it into the relevant signature or message.","The product needs a named-network identity or replay guarantee from the opcode alone.","The application has no policy for chain-ID changes or contentious forks."]},"designerTakeaways":["You can show the numeric chain value used by contract logic alongside the app's network name.","You can explain chain mismatch errors when contract logic compares CHAINID or binds it into a signature.","You can design fork and chain-ID-change handling as an application policy."],"problemsSolved":[{"problem":"Contract logic needs its configured chain ID","oldWay":"Applications supplied chain context through configuration or hardcoded values","newWay":"Contract code can read the EVM configured chain ID directly","impact":"critical"},{"problem":"Smart contract replay attacks","oldWay":"Contract logic could be tricked across chains","newWay":"Contract logic can compare CHAINID or bind it into a signature, but the opcode alone does not enforce replay protection","impact":"high"},{"problem":"Signed messages need explicit chain context","oldWay":"Applications maintained their own configured chain value for message verification","newWay":"Contract logic can compare the configured CHAINID value with chain context in the signed payload","impact":"high"},{"problem":"Hardcoded chain IDs were fragile","oldWay":"Contract deployed with hardcoded chain ID, breaks on forks","newWay":"Reading the configured value avoids a hardcoded read, while the application still defines chain-change and fork handling","impact":"medium"}],"uxPatterns":[{"name":"Chain-Aware Transaction Validation","description":"Contract logic compares the configured numeric chain ID and returns a chain-mismatch result","userFlow":["User submits an action with chain-bound data","Contract reads CHAINID and applies its configured comparison or signature validation","App reads the actual result or decoded rejection","UI explains a mismatch when established by the contract","User can review the intended network before retrying"]},{"name":"Multi-Chain Contract Status","description":"Show the numeric chain context used by a contract, without treating it as a named-network verification badge","userFlow":["User views the configured chain context","App shows the numeric ID and explains the comparison performed","App distinguishes this check from contract verification and overall safety","User reviews any mismatch and the configured network"]},{"name":"Permit Chain Context","description":"Show numeric chain context for a permit or signature only when the target contract binds and compares it.","userFlow":["User reviews a permit or typed action","UI shows the numeric chain ID in the domain or transaction context","Target contract applies its own comparison or signature-binding logic","User sees the returned validation result and the application's fork/change policy"]}],"uiComponents":[{"name":"ChainContextPanel","description":"Shows the numeric chain context and the result of a specific comparison. It is not a contract-safety badge.","states":["checking","matched","mismatched","unknown"],"props":["chainId","expectedChainId","comparisonResult"]},{"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":"Treating CHAINID as built-in replay protection","why":"CHAINID only supplies the configured numeric value; contract logic must compare or bind it and handle chain-ID changes.","instead":"Show the numeric chain context and the application's validation result, not a universal Chain-verified badge.","severity":"high"},{"pattern":"Not showing chain ID in signature requests","why":"User signs without knowing which chain it's for","instead":"Show relevant network context and expose the numeric chain ID where useful; do not turn it into a network-authentication badge.","severity":"medium"}],"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 domains can include chainId; the target contract decides whether it binds and compares that value."},{"id":"EIP-695","relationship":"eth_chainId for dApps, CHAINID opcode for contracts"},{"id":"ERC-2612","relationship":"ERC-2612 deployments may include chain context in the permit domain; verify the deployed implementation."}],"specConstraints":[{"id":"configured-chain-id","constraint":"CHAINID returns the configured chain ID that should match the EIP-155 identifier accepted by the client.","appliesTo":"account-implementation","normativity":"normative","specQuote":"The value of the current chain ID is obtained from the chain ID configuration, which should match the EIP-155 unique identifier a client will accept from incoming transactions.","specSection":"Specification","specUrl":"https://eips.ethereum.org/EIPS/eip-1344#specification","designImplication":"Show the numeric chain context only alongside the actual comparison or signature rule that uses it. Do not turn the opcode into a named-network or replay-protection badge by itself."},{"id":"chain-id-change-policy","constraint":"Applications that depend on CHAINID must handle a possible chain-ID update when continued use requires it.","appliesTo":"application","normativity":"rationale","specQuote":"users of the proposed `CHAINID` opcode **must** ensure that their application can handle a potential update to the value of chain ID during their usage of their application in case this does occur, if required for the continued use of the application.","specSection":"Rationale","specUrl":"https://eips.ethereum.org/EIPS/eip-1344#rationale","designImplication":"Define a visible mismatch or revalidation state for chain-ID changes, especially for long-lived signed messages or settlement flows. Explain when previously signed data must be rechecked."},{"id":"eip155-compatibility","constraint":"The opcode is backwards compatible with chains that implement EIP-155 chain-ID domain separation for transaction signing.","appliesTo":"infrastructure","normativity":"backwards-compatibility","specQuote":"This EIP is fully backwards compatible with all chains which implement EIP-155 chain ID domain separator for transaction signing.","specSection":"Backwards Compatibility","specUrl":"https://eips.ethereum.org/EIPS/eip-1344#backwards-compatibility","designImplication":"Keep the opcode's chain context compatible with the transaction-signing network model, while still showing users the application-specific comparison and fork policy."}],"lastUpdated":"2026-09-18","technicalNotes":"CHAINID returns the configured numeric chain ID. It does not identify a chain by name, enforce a comparison, or make every EIP-155 transaction chain-bound. Applications and contracts must bind the value where needed and define behavior when a contentious fork changes the configured ID.","sources":[{"label":"EIP-1344 official specification","url":"https://eips.ethereum.org/EIPS/eip-1344","type":"official-spec"}],"lastReviewed":"2026-09-18"},"sources":[{"label":"Official specification","url":"https://eips.ethereum.org/EIPS/eip-1344","type":"official-spec"},{"label":"Discussion search","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-09-18","lastUpdated":"2026-09-18"}}