Skip to content

mstrofnone/nmcLightningService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

nmcLightningService — publish-announce-bit.js

Publish a Nostr kind:1 note to the standard public relay set plus wss://relay.testls.bit/ — a Namecoin-gated relay that requires:

  1. A Namecoin-verified .bit NIP-05 (_@<name>.bit) on the author pubkey.
  2. A custom TLS handshake pinned against the tls array stored on-chain under d/<base>/map/<sub> (DANE-TA / SPKI / SHA-256).

The relay's TLS scheme is unusual: the TLSA pin matches the AIA Parent CA SPKI, which the cert chain staples as a JSON {"pubb64":"..."} blob inside the issuer's serialNumber RDN. The script unescapes that, base64-decodes it, hashes it, and compares to the on-chain TLSA. If the pin matches, the validated TLS socket is handed to the WebSocket client (no second handshake).

See prereqrelaytestlsbit.txt (or your local copy) for the full prerequisites.

Setup

npm install ws nostr-tools
cp config.example.js config.js
# edit config.js with your real Nostr key + Namecoin RPC creds

You also need:

  • A running local Namecoin Core node with RPC enabled (default 127.0.0.1:8336).
  • A lib.js module exposing publishToRelays(event, relays, timeoutMs) and printRelayResults(results, label) (the script's only non-stdlib runtime dependency besides ws / nostr-tools).
  • An announce.txt file in the parent directory containing the note body.
  • The id/<bitName> Namecoin record published with nostr.pubkey matching your hex pubkey, and d/<bitName> mirroring it.

Run

node publish-announce-bit.js

The script will:

  1. Resolve relay.testls.bit via Namecoin (name_show d/testlsmap.relay).
  2. Open a TCP/TLS socket to that IP with SNI=relay.testls.bit.
  3. Validate the TLSA pin against the chain's stapled AIA Parent CA SPKI.
  4. Publish kind:0 (profile w/ .bit NIP-05), kind:10002 (relay list incl. .bit), and the kind:1 announce, in that order, to public relays plus the pinned .bit relay.
  5. Print an njump.me URL for the resulting event.

Exit code: 0 if any relay accepted the announce, 2 otherwise.

Security

Nothing in this repo holds secrets. config.js is gitignored — keep it that way. The Nostr private key, Namecoin RPC password, and any wallet backups must never leave the machine.

License

MIT

About

Publish Nostr events to Namecoin-gated .bit relays (NIP-05 + on-chain TLSA pinning).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors