feat: Namecoin NIP-05 identity resolution#1
Open
mstrofnone wants to merge 2 commits intoirislib:masterfrom
Open
feat: Namecoin NIP-05 identity resolution#1mstrofnone wants to merge 2 commits intoirislib:masterfrom
mstrofnone wants to merge 2 commits intoirislib:masterfrom
Conversation
added 2 commits
April 12, 2026 15:14
Add decentralised NIP-05-style identity verification using Namecoin blockchain names. Supports d/ (domain) and id/ (identity) namespaces with .bit domain syntax (alice@example.bit) and direct namespace syntax (d/example, id/alice). Architecture: browser → HTTP proxy → ElectrumX → Namecoin blockchain New files: - namecoin.ts: identifier detection, parsing, value extraction, resolver - namecoin.test.ts: 21 unit tests for parsing and value extraction - namecoin-proxy/electrumx-client.mjs: server-side ElectrumX TCP client - namecoin-proxy/electrumx-proxy.mjs: standalone HTTP proxy server - namecoin-proxy/vite-plugin-namecoin.mjs: Vite dev middleware Modified: - nip05.ts: route Namecoin identifiers to decentralised resolver
Replaces the HTTP proxy approach with direct WebSocket connections from the browser to ElectrumX servers. No backend or middleware required — works as a fully static web app. Based on the approach from hzrd149/nostrudel#352
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Namecoin NIP-05 Identity Resolution
This PR adds decentralised NIP-05-style identity verification using Namecoin blockchain names, enabling Nostr identity lookups without relying on centralised HTTP servers.
What is Namecoin?
Namecoin is the first fork of Bitcoin (2011) — a decentralised naming blockchain. Names in the
d/(domain) andid/(identity) namespaces can store arbitrary JSON values, including Nostr public keys. This enables trustless, censorship-resistant identity verification.Architecture
Browsers cannot open raw TCP/TLS connections to ElectrumX servers, so an HTTP proxy bridges the gap. Three proxy options are included:
vite-plugin-namecoin.mjs) — zero-config dev middleware at/__namecoinelectrumx-proxy.mjs) — production HTTP serverelectrumx-client.mjs) — reusable Node.js TCP clientThe ElectrumX protocol flow:
OP_NAME_UPDATE+ name)blockchain.scripthash.get_history→ get latest transactionblockchain.transaction.get→ parseNAME_UPDATEscript for JSON valueSupported Identifier Formats
alice@example.bitd/example→ names.alice_@example.bit/example.bitd/example→ root identityd/exampleid/aliceNamecoin Value Formats
Domain namespace (
d/) — NIP-05-compatible:{ "nostr": { "names": { "alice": "<hex-pubkey>" }, "relays": { "<hex-pubkey>": ["wss://..."] } } }Identity namespace (
id/):{ "nostr": { "pubkey": "<hex-pubkey>", "relays": ["wss://..."] } }Both also support the simple form:
{ "nostr": "<hex-pubkey>" }Integration
The resolver hooks into the existing
getNip05For()function innip05.ts. When an identifier is detected as Namecoin (.bitsuffix,d/, orid/prefix), it routes to the decentralised resolver instead of the standard HTTPS fetch path. The return type is the sameProfilePointer, so all downstream code works unchanged.Includes an LRU cache (500 entries, 1hr TTL) to minimise ElectrumX round-trips.
Tests
21 unit tests covering identifier detection, parsing, and value extraction for all supported formats.
Related Work