Lightning and Nostr keys for self-hosters: keep them separate

Wallet seed, channel backup, SSH keys and a Nostr nsec fail in different ways and must not share one undifferentiated file. Practical habits to avoid leaks, toxic state and a mixed restore. With a final checklist. No product link.

Self-hosters often end up holding several kinds of keys that look similar and must never be mixed: a Bitcoin or Lightning wallet seed, a Lightning node’s channel backup, SSH keys, and a Nostr private key (nsec). Treating them as “just another secret in the same folder” is how people leak a signing key into a git repo, or restore the wrong kind of backup after a disk failure. This guide is a practical separation of those objects, how to back them up, and a few habits that prevent the usual mistakes. It is educational, not financial, legal or operational advice for a production routing node, and it is not a recommendation of any particular wallet or client.

1. Four different objects, four different failures

A wallet seed (or the descriptors / export of a wallet you control) is money at rest. Anyone with the seed can spend, now or later. A backup of the seed must be offline or otherwise tightly controlled, and it must not sit next to a machine that is online all the time without a reason.

A Lightning channel backup (static channel backup, or the equivalent in your implementation) is not a seed. It is a way to close or recover channels after a node disk is lost, and it can become dangerous if you use an old channel database against a live channel (“toxic” state). The seed and the SCB are both necessary for a typical Lightning node, and they are not substitutes for each other. Host backups of a running channel.db are a separate, careful topic; an old copy can be worse than no copy if you start the node from it.

An SSH key opens a machine. It should be unique enough to revoke, passphrase-protected, and not reused as a “general secret.”

A Nostr nsec is a signing key for an identity. Anyone who has it can post as you, take over follow lists and client logins that use that key, and in some setups control zaps or other linked state. It is not a Bitcoin seed, but you should treat the compromise as similarly irreversible: once leaked, assume it is public, and move to a new key if you can. You cannot “change the password” on an nsec the way you change a website password.

Do not store these four in one undifferentiated “secrets” text file that also gets synced to a phone. Separate envelopes, even if the physical box is the same.

2. Nostr habits that avoid the usual leaks

Do not paste an nsec into a web page, a chat, or a ticket. Prefer a client or a remote signer that keeps the key off the everyday device when you can. If a client asks to “just paste the nsec to log in,” treat that as a serious request, not as a formality.

Do not put the nsec in a git repository, in a Compose file, in a public relay’s config “so the bot can post,” or in a screenshot. Environment variables on a VPS are still on that VPS; they need the same disk and backup policy as any other key, and they should not appear in logs.

A public npub is safe to publish. Mixing the two in documentation is a common typo; check twice before you paste.

If you run a bot, give it its own key, not the key you use as a person. Compromise of the bot then does not take the personal identity, and you can rotate the bot.

3. Lightning and host backups, without mixing them

Back up the seed (or wallet export) first, offline, with a restore check you have actually done on a throwaway wallet or a test amount. Back up the static channel backup automatically to a place that is not only the node, and test the procedure (where the file is, how it is decrypted, which command would use it) more often than you test a full disaster, if a full disaster is too expensive to run weekly.

Do not casually restore an old node data directory onto a machine if the channels may still be live; read the documentation of your implementation for the current, safe recovery path. Power, disk, and UPS on the host matter because a sudden death of a Lightning node is not only a file loss, it can be a channel-state problem.

Keep the Nostr key backup out of the Lightning backup script unless you have a very clear, encrypted, and tested reason to combine them. Different restore stories should not share a single tarball you cannot unpack selectively.

4. A short policy you can actually follow

Write four lines, off the servers:

  • where the wallet seed is, and when you last verified you could read it,
  • where the current channel backup lands, and what must never be restored from an old database,
  • which SSH keys exist and how to revoke one,
  • where the personal nsec and any bot nsec are stored, and which clients hold them.

Revoke or replace a key when a device is lost. Do not wait for a “security day.”

5. Final checklist

  • [ ] Wallet seed, channel backup, SSH keys and nsec are stored as separate objects
  • [ ] The seed is offline or equivalently protected; a read-or-restore check was done
  • [ ] Channel backup is automatic and off the node; you know the safe restore path and the toxic-state warning for your implementation
  • [ ] nsec was never pasted into a chat, a ticket, or a public repo; bots use their own key
  • [ ] npub and nsec are not mixed in notes or screenshots
  • [ ] A written, off-server note says where each secret lives and how to revoke it
  • [ ] Host hardening (SSH, disk, power) is treated as part of Lightning operations, not as an optional extra

The technical tools are good enough. The failures are almost always “it was in the same file” or “we restored the wrong kind of backup.” Separate the objects, write down the restore path, and treat an nsec as a key, not as a password.


Write a comment