# Lotus V2 and multi-chain browser connect protocol (`lotus-connect/1`) Status: candidate browser and multi-chain wallet connection specification, provisional through pre-launch testnet. This is an application and wallet-bridge protocol, not a consensus change. It defines how web applications discover and communicate with a user's browser extension or companion wallet over a dedicated W3C `MessageChannel` (`MessagePort`), how intent-first native Lotus V2 transactions and contract calls integrate with [`@lotus/v2-payment-compiler/transaction-runtime`](../../tools/lotus-v2-compiler/TRANSACTION-RUNTIME.md) (`prepareTransactionCall` / `finalizeTransactionCall`, `lotus-v2/contract-artifact/2`, `lotus-v2/policy-artifact/1`) and [Lotus V2 PSBT profile 1 (`0x4c560001`)](psbt.md), how origin-bound personas and [application message signatures (`lotus-chain-bound-compact-ecdsa-v1`)](message-signing.md) prevent cross-site tracking, and how the same envelope dispatches across multi-chain CAIP-2 namespaces (`bip122:*`, `eip155:*`, `solana:*`). ## Why legacy Web3 attachment protocols fail Existing browser wallet injection standards (`window.ethereum` / EIP-1193, EIP-6963, Solana `@wallet-standard`, Bitcoin WBIP004 / `window.unisat`, and eCash Cashtab `window.postMessage` broadcasts) share four structural flaws: 1. **Ambient authority and passive fingerprinting**: Injecting provider objects onto `window` at `document_start` or replying to unprompted `eip6963:requestProvider` / `wallet-standard:app-ready` broadcasts allows every visited webpage to enumerate the user's installed wallet extensions in under 1 ms without a user gesture. A static `info.uuid` or combination of `window.*` flags acts as a cross-origin browser fingerprint bitmask that persists across IP rotations. 2. **Cross-site address correlation ("identity-first" supercookies)**: Legacy dApps call `eth_requestAccounts`, `solana.connect()`, or `unisat.requestAccounts()` immediately on page load before any transaction intent exists. When a wallet returns one global primary address across origins, third-party analytics scripts correlate the user's identity, net worth, and transaction history across unrelated websites. 3. **UTXO inventory leakage and Common-Input-Ownership Heuristic (CIOH)**: On UTXO chains (Lotus, Bitcoin, Bitcoin Cash, eCash, Dogecoin, Litecoin), legacy dApps query the user's wallet UTXO set to build unsigned transactions in page JavaScript. Exposing the wallet's UTXO inventory reveals the user's total balance to the webpage, and co-spending multiple wallet UTXOs in an application-constructed transaction permanently links those addresses on chain under CIOH. 4. **Cross-world DOM event cloning hazards and shared-bus eavesdropping**: In WebKit/Safari Web Extensions, dispatching a `CustomEvent` whose `detail` contains functions (such as an EIP-1193 or Wallet Standard provider) from an `ISOLATED` content script to the `MAIN` page world causes structured cloning to strip `event.detail` to `null`. Conversely, broadcasting RPC payloads over `window.postMessage(..., '*')` exposes every request and response to any third-party script running in the same document and requires hex/Base64 stringification of binary transaction templates, Merkle proofs, and signatures. `lotus-connect/1` replaces ambient globals and shared-bus broadcasts with a capability-scoped W3C `MessageChannel` (`MessagePort`), connectless transaction intent fulfillment (`wallet_fulfillIntent`), and per-origin cryptographic persona isolation (`account = 1'`). ## Transport layer: W3C `MessageChannel` (`MessagePort`) handshake ### Stealth discovery and explicit port transfer A compliant wallet MUST NOT mutate `window` or emit unsolicited provider announcements on arbitrary origins when configured in `stealth` or `connected-only` mode. Instead, a dedicated point-to-point `MessagePort` is established only when: 1. The user explicitly invokes a connection or payment gesture, or 2. The current `window.location.origin` already holds an active, non-expired session grant in the wallet enclave. To initiate a channel, the page creates a standard W3C `MessageChannel` and transfers `port2` to the extension's isolated content script via a one-time handshake message: ```ts const channel = new MessageChannel(); const clientPort: MessagePort = channel.port1; clientPort.start(); window.postMessage( { protocol: "lotus-connect/1", type: "handshake-init", requestedChains: [ "bip122:000000000abc0cde58ee7e919d3d4de1", // Lotus mainnet "eip155:143", // Monad mainnet "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", // Solana mainnet ], }, window.location.origin, [channel.port2], ); ``` ### Transport invariants 1. **Private point-to-point pipe**: Once `channel.port2` is transferred in the `MessageEvent.ports` array to the extension's `ISOLATED` content script, all subsequent requests, responses, and lifecycle events flow exclusively across `port1 <-> port2`. Third-party scripts injected into the page after the handshake cannot eavesdrop on or spoof messages on the port. 2. **Native W3C Structured Clone payloads**: Messages over `MessagePort` use the browser's native Structured Clone algorithm (`Uint8Array`, `bigint`, `Map`, `Set`, and nested typed records), eliminating hex/Base64 serialization overhead and `JSON.stringify` `BigInt` exceptions when transporting Lotus V2 transaction wire bytes, sparse-state `CoinProof`s, or `lotus-v2/contract-artifact/2` bundles. 3. **Unspoofable origin and frame binding**: The `ISOLATED` content script MUST ignore any origin claim inside the page's payload and attach the browser-verified `origin: window.location.origin`, `href: window.location.href`, and `isTopFrame: window.top === window` to every envelope forwarded to the wallet background enclave. Cross-origin `