Skip to content

feat(wallet): self-custodial LightChain browser wallet (MV3 EOA)#74

Merged
marinom2 merged 1 commit into
mainfrom
feat/lightchain-wallet
Jun 10, 2026
Merged

feat(wallet): self-custodial LightChain browser wallet (MV3 EOA)#74
marinom2 merged 1 commit into
mainfrom
feat/lightchain-wallet

Conversation

@marinom2

@marinom2 marinom2 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

A self-custodial browser wallet for LightChain - a pure client-side EOA key manager + signer like Phantom/MetaMask. No smart contract, no server, no custody. Keys are generated + encrypted on-device and never leave it. New package: wallet/.

Built to a verified 2026 architecture spec and hardened against a 15-point adversarial security review (both run as multi-agent workflows before coding).

Core (functional on testnet)

  • Keyring: BIP-39 (24-word) + BIP-44 m/44'/60'/0'/0/x via the audited @scure libs; vault sealed with WebCrypto AES-256-GCM under a scrypt-derived key (random salt + nonce per encrypt, recorded KDF params, auth-tag = password check).
  • MV3 background SW is the sole holder of plaintext keys (volatile memory + storage.session, with an honest threat model - no self-defeating "key stored beside ciphertext" scheme). Auto-lock via alarms; boots locked after restart.
  • EIP-1193 + EIP-6963 provider - coexists with MetaMask, never clobbers window.ethereum; content/inpage are key-free relays; origin taken from the message sender.
  • Approval window for connect / personal_sign / eth_sendTransaction: the tx signed is exactly the tx shown (approve==sign); non-text personal_sign payloads get a hard "unreadable data" warning; contract calls flagged.
  • React popup: create/import, unlock, balance, send LCAI, gas shown as "negligible".
  • Pinned LightChain chains only; never honors a dapp-supplied RPC url.

Security-review fixes applied

scryptAsync (non-blocking SW), chunked base64 (no btoa stack overflow), viem toHex not Node Buffer, approve==sign, RPC pinning, no wallet_addEthereumChain with foreign RPC.

Verification

wxt build produces a loadable chrome-mv3 extension; tsc clean; 14 keyring/vault unit tests (canonical BIP-44 vector to 0x9858...aeda94, vault round-trip + wrong-password rejection, base64 to 500 KB). Root repo unaffected: wallet/ is excluded from the Next app's tsconfig, so root tsc/next build/CI is untouched (491 root tests still green).

Next (mapped, not yet built)

The SDK-powered superpowers - one-click worker staking + monitoring, encrypted pay-per-call inference chat, in-wallet DAO intelligence, the Ethereum bridge - wire through lightnode-sdk (exact export map done). Production hardening from the review (dangerous-calldata decoding + simulation, full EIP-712, Ledger, OS-idle relock) and an external audit gate meaningful mainnet funds. None affect the self-custody guarantee.

Community-built; not an official LightChain product.

A self-custodial EOA browser wallet for LightChain - a pure client-side
key manager + signer (no smart contract, no server, no custody), built
to a verified architecture spec and a 15-point adversarial security review.

Core (functional on testnet):
- BIP-39 (24-word) keyring with BIP-44 m/44'/60'/0'/0/x derivation via the
  audited @Scure libs; vault sealed with WebCrypto AES-256-GCM under a
  scrypt-derived key (random salt + nonce, recorded KDF params).
- MV3 background service worker as the sole holder of plaintext keys (volatile
  memory + storage.session, honest threat model - no self-defeating "key next
  to ciphertext" scheme). Auto-lock via alarms; boots locked after restart.
- EIP-1193 provider + EIP-6963 discovery (coexists with MetaMask, never
  clobbers window.ethereum); content/inpage are key-free relays; origin taken
  from the message sender.
- Approval window for connect / personal_sign / eth_sendTransaction; the tx
  signed is exactly the tx displayed; non-text personal_sign payloads get a
  hard "unreadable data" warning; contract calls are flagged.
- React popup: create/import, unlock, balance, send LCAI, gas-as-negligible.
- Pinned LightChain chains only; never honors a dapp-supplied RPC url.

Security review fixes applied: scryptAsync (non-blocking), chunked base64
(no btoa stack overflow), viem toHex not Node Buffer, approve==sign, RPC
pinning. 14 keyring/vault unit tests (canonical BIP-44 vector, vault
round-trip + wrong-password, base64 to 500KB). wxt build + tsc green.

Excluded wallet/ from the root tsconfig so the Next app's typecheck/build
is unaffected. The SDK-powered superpowers (worker dashboard, encrypted
inference chat, DAO intelligence, bridge) are mapped and land next; an
external audit gates meaningful mainnet funds.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lightnode Ready Ready Preview, Comment Jun 10, 2026 1:58pm

Request Review

@gitguardian

gitguardian Bot commented Jun 10, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - Generic Password c6647f6 wallet/src/keyring/vault.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@marinom2 marinom2 merged commit 5e68f0a into main Jun 10, 2026
4 of 5 checks passed
@marinom2 marinom2 deleted the feat/lightchain-wallet branch June 10, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant