0xchat: Namecoin .bit NIP-05 resolution for DM impersonation defense
0xchat: Namecoin .bit NIP-05 resolution for DM impersonation defense
Opened a PR against 0xchat-app/0xchat-app-main adding optional Namecoin .bit verification to the existing NIP-05 path.
PR: https://github.com/0xchat-app/0xchat-app-main/pull/65
What it does
- NIP-05 addresses ending in
.bit(e.g.alice@example.bit) are verified against the Namecoin name record over a public ElectrumX server instead of an HTTPS.well-known/nostr.jsonendpoint. - Contact / profile / user-center views render a distinct Namecoin badge for chain-verified handles, so DM users can tell DNS-backed identities from chain-backed ones at a glance.
Why this one matters
0xchat is a Nostr-first DM client. The threat model that gets actually exploited on Nostr DMs is impersonation: an attacker creates a fresh npub with the same display name and picture as someone you trust and DMs the people you talk to.
DNS NIP-05 helps with that — until the DNS record gets rotated, transferred, or hijacked silently. A .bit handle resolves to a record on the Namecoin blockchain; the mapping is authoritative, transferable only via signed on-chain transactions, and rotation-proof from the user’s perspective.
A distinct badge makes that distinction visible to the user without forcing them to read pubkeys.
Scope
| What | Where |
|---|---|
Resolver (ElectrumX WSS, scripthash, NAME_UPDATE/NAME_FIRSTUPDATE parse, JSON-value extractor, ifa-0001 import walk) |
packages/0xchat-core/lib/src/account/namecoin/ (new, 6 files) |
.bit-suffix branch in NIP-05 verify |
one early-return branch in Account.getDNSPubkey |
| Distinct “Namecoin” badge widget | ox_common/widgets/nip05_verified_badge.dart |
| Three NIP-05 indicator call sites swapped to the new widget | ox_chat contact options, ox_discovery contact info, ox_usercenter page UI |
| Unit tests | test/namecoin/ (3 files, 28 tests) |
Footprint: +1638 / −24 across 17 files. Falls back gracefully on resolver failure.
Wire format
Same wire format already implemented in:
- Kotlin/Android —
vitorpamplona/amethyst(merged across PRs #1734, #1771, #1785, #1786, #1806, #1815, #1937, #2199, #1914, #1915, #2595, #2956, #2957). - Swift/iOS —
nostur-com/Nostur(PR #60). - Dart/Flutter —
ethicnology/dart-nostr(PR #44, merged 2026-05-16). - Flutter app —
haorendashu/nostrmo(PR #33, in review). - JS/TS —
nbd-wtf/nostr-tools(#533),CodyTseng/jumble(#774),hzrd149/nostrudel(#352).
Specifically:
- ElectrumX v1.4.1
blockchain.scripthash.get_historyover the canonical name-index script. - Both
NAME_UPDATE(OP_3) andNAME_FIRSTUPDATE(OP_2) are decoded. - Three
nostrvalue shapes (simple,names/relaysmap, single-identitypubkey). - ifa-0001 §“import” walked with cycle detection, capped at depth 4.
- Anti-leak: if
names["alice"]is malformed, returnnullrather than silently falling back to the root operator’s pubkey.
Try it
mstrofnone.bit and id/mstrofnone resolve to npub1gvv9ahktvavf9qjtrgm62le7gplmmchd5usp5wpfhr85hf79kncqj8xchs on the Namecoin chain. Adding either as a NIP-05 in your 0xchat profile and re-verifying should surface the new badge.
Related artefacts
- N1 NIP draft (
.bitNIP-05) — mstrofnone/nips. - N1 upstream PR — nostr-protocol/nips#2349.
- dart-nostr precedent — ethicnology/dart-nostr#44, merged 2026-05-16.
This is the seventh shipping reference implementation of Namecoin NIP-05, across five language runtimes (Kotlin, Swift, JS, Dart, plus the wire-compatible Go nak port).
- Reference: https://github.com/0xchat-app/0xchat-app-main/pull/65
- Reference: https://github.com/mstrofnone/nips
- Reference: https://github.com/ethicnology/dart-nostr/pull/44
Write a comment