Skip to content

gitignore: cover the key files the node actually writes - #43

Merged
Bitflash-sh merged 1 commit into
Bitflash-sh:mainfrom
ericscalibur:chore/gitignore-keys
Jul 30, 2026
Merged

gitignore: cover the key files the node actually writes#43
Bitflash-sh merged 1 commit into
Bitflash-sh:mainfrom
ericscalibur:chore/gitignore-keys

Conversation

@ericscalibur

Copy link
Copy Markdown
Contributor

.gitignore ignores *.dat and wallet.dat, but the node also writes three files in its data directory that are not .dat and are just as sensitive:

btf_enc.key this node's .btf service key -- its network identity
nostr.key the Nostr key its descriptors are signed with
walletrpc.token bearer token authorising spends over the wallet API

A node run with its data directory inside a working tree -- which is the obvious thing to do while developing -- leaves all three untracked but committable, and git add -A takes them. Losing btf_enc.key means losing your address; publishing walletrpc.token hands over the wallet to anyone who can reach the port.

Also ignore key backup archives and stray .patch/.rej/.orig files.

.gitignore ignores *.dat and wallet.dat, but the node also writes three files
in its data directory that are not .dat and are just as sensitive:

  btf_enc.key      this node's .btf service key -- its network identity
  nostr.key        the Nostr key its descriptors are signed with
  walletrpc.token  bearer token authorising spends over the wallet API

A node run with its data directory inside a working tree -- which is the
obvious thing to do while developing -- leaves all three untracked but
committable, and `git add -A` takes them. Losing btf_enc.key means losing your
address; publishing walletrpc.token hands over the wallet to anyone who can
reach the port.

Also ignore key backup archives and stray .patch/.rej/.orig files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ericscalibur
ericscalibur force-pushed the chore/gitignore-keys branch from d99928f to c3b7842 Compare July 30, 2026 05:01
Vic-Nas added a commit to Vic-Nas/bitflash-mod that referenced this pull request Jul 30, 2026
…RM64 build (port of Bitflash-sh#41); gitignore: cover key files (port of Bitflash-sh#43)

## Bootstrap seeds (Bitflash-sh#36)

A node with an empty cache has only the Nostr relays for discovery --
if those are down, blocked, or just slow, a first run has no way into
the network at all, which is exactly the moment a user has the least
patience. Seeds are the floor under that: a compiled-in list of
long-lived peers, tried automatically only when the peer cache is
empty.

A seed entry is deliberately just an address and an encryption key,
no meeting node -- the rendezvous relay pairs on the service's public
key, and a .btf address is that key, so a seed is findable by walking
the known relays. Recording which relay a seed was on would rot the
moment it failed over, which is the exact "advertising a rendezvous
nobody is registered at" failure this project has chased before.
Seeds carry no special authority: they hand out the same signed,
self-certifying descriptors any peer does, so a hostile seed can
stall a bootstrap but can't forge a peer or feed a false chain.

The compiled list here is empty, deliberately -- upstream shipped
their own dedicated bootstrap node's address in their version of this
commit, but that's their infrastructure, not something this fork has
any relationship to or authority to point users at. /btfseed=
ADDRESS:ENCHEX (repeatable, CLI-only) covers testing and private
networks without needing a compiled entry.

Adapted the hex-decode call to our own BtfPeerCacheHexToBytes rather
than a generic HexToBytes upstream doesn't have under that name.

## ARM64 build failure (Bitflash-sh#41)

ByteReverse(word32) in sha.h used the x86 bswap instruction via
inline asm, guarded only by #if defined(__GNUC__) -- true on every
architecture GCC/Clang target, so on aarch64 the assembler rejected
the instruction outright. The 64-bit ByteReverse right below it
already had the correct guard (&& defined(__x86_64__)); the 32-bit
one just never got it. Fails the build on Apple Silicon, ARM servers,
or a Raspberry Pi -- all plausible headless-node hosts.

## .gitignore gaps (Bitflash-sh#43)

*.dat/wallet.dat were covered, but btf_enc.key (this node's .btf
identity) and nostr.key (its Nostr signing key) are not .dat files
and are exactly as sensitive -- already listed explicitly in our
.gitignore from an earlier session, but walletrpc.token (bearer
authority to spend from the wallet over the wallet API) was missing
entirely, along with a general *.key catch-all and patterns for key
backup archives, mempool dumps, and stray .patch/.rej/.orig files. A
node run with its data directory inside a working tree -- the obvious
thing to do while developing -- would otherwise leave all of this
untracked but committable.
@Bitflash-sh

Copy link
Copy Markdown
Owner

Right on the substance — those three files are the node's actual secrets and none of them end in .dat, so the existing rules never covered them. walletrpc.token is the one that would hurt most: it is bearer authority to spend, with no second factor behind it.

Checked that nothing currently tracked would start being ignored:

$ git ls-files | grep -Ei '\.key$|\.patch$|\.rej$|\.orig$|\.tgz$|\.tar\.gz$|^bitflash-keys-|mempool\.txt$|walletrpc\.token$'
(empty)

Clean, so this is purely additive.

One thing worth knowing rather than changing: *.key is broad enough to also swallow a public key file, should the project ever want one committed — an update-verification pubkey shipped in-tree, say. That is not the case today (the update pubkey lives as a repo variable, not a file), and git add -f covers the exception, so I would rather have the broad rule protecting private keys than a narrow one that misses the next filename we invent. Noting it only so it is not a surprise later.

The explicit entries alongside the glob are the right belt-and-braces: they document which files matter, which the glob alone does not.

Reviewed clean.

@Bitflash-sh
Bitflash-sh merged commit 40f51f2 into Bitflash-sh:main Jul 30, 2026
@Bitflash-sh Bitflash-sh mentioned this pull request Jul 30, 2026
Bitflash-sh added a commit that referenced this pull request Jul 30, 2026
Headless mining fix (#42), ARM64 build (#41), format-string
checking (#44), gitignore for key material (#43).

#42 is the reason this release exists: -gen has mined nothing on
headless nodes since v1.2.0.
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.

2 participants