{"record":{"id":"ffcbb9595886b3fd","repo":"nautechsystems/nautilus_trader","slug":"verified-chain-id-does-not-match-the-transaction-c","errorCode":null,"errorMessage":"Verified chain ID does not match the transaction chain","messagePattern":"Verified chain ID does not match the transaction chain","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":2295,"sourceCode":"    )]\n    async fn prepare_and_sign_with_anchors(\n        &self,\n        intent_id: i64,\n        created_block: u64,\n        to: Address,\n        value: U256,\n        input: Bytes,\n        swap_anchors: Option<&SwapQuoteAnchors>,\n        authorization: Option<&TransactionAuthorization>,\n        decision_header: Option<Verified<VerifiedBlockHeader>>,\n    ) -> anyhow::Result<PreparedTransaction> {\n        let expected_chain_id = u64::from(self.chain_id);\n        let chain_id_verification = required_verification(\n            self.verification.verify_chain_id().await,\n            \"pre-sign chain ID\",\n        )?;\n        let actual_chain_id = chain_id_verification.value;\n        anyhow::ensure!(\n            actual_chain_id == expected_chain_id,\n            \"Verified chain ID does not match the transaction chain\"\n        );\n        let decision_header_verification = if let Some(anchors) = swap_anchors {\n            required_verification(\n                self.verification.verify_block(anchors.state.number).await,\n                \"pre-sign swap decision header reread\",\n            )?\n        } else {\n            match decision_header {\n                Some(verified) => verified,\n                None => {\n                    let now_unix_secs = current_unix_secs()?;\n                    required_verification(\n                        self.verification\n                            .verify_decision_header(now_unix_secs)\n                            .await,\n                        \"pre-sign decision header\",","sourceCodeStart":2277,"sourceCodeEnd":2313,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L2277-L2313","documentation":"Before signing, the client re-verifies the chain ID via its verification provider and requires it to equal the transaction's expected chain ID. A mismatch means the node/wallet context the transaction targets differs from the verified chain, so signing is refused to prevent replay or cross-chain mistakes.","triggerScenarios":"During the pre-sign check, `verification.verify_chain_id()` returns a chain ID different from `self.chain_id` (u64) used for the transaction — e.g. the RPC endpoint serves a different network than configured.","commonSituations":"RPC URL points to mainnet while client configured for a testnet (or vice versa); provider failover switched to a node on another chain; chain_id config value stale after a fork or network rename.","solutions":["Align the client's configured chain_id with the network actually served by the configured RPC endpoint.","Check the RPC URL — switch to a node on the intended chain.","Verify no automatic provider failover silently switched chains; pin the endpoint.","Re-verify `self.chain_id` matches the signer/wallet network and reinitialize the client if config changed."],"exampleFix":"// before: client on testnet RPC but chain_id set to mainnet\n// chain_id: 1, rpc: https://sepolia.infura.io\nlet client = ExecutionClient::new(chain_id=1, rpc=SEPOLIA_URL)?;\n// after\nlet client = ExecutionClient::new(chain_id=11155111, rpc=SEPOLIA_URL)?;","handlingStrategy":"validation","validationCode":"let node_chain_id = provider.get_chain_id().await?;\nassert_eq!(node_chain_id, client.chain_id(), \"RPC chain mismatch with client config\");","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"Verified chain ID does not match\") => { fail_fast_and_reconfigure_rpc(e); } Ok(v) => v }","preventionTips":["Verify RPC endpoint chain ID at client startup","Avoid provider failover across different chains","Keep chain_id config and signer network in sync"],"tags":["blockchain","chain-id","security","config"],"backgroundTag":"invalid-config-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}