You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 06ff2d3
Browse filesBrowse the repository at this point in the historyBrowse files
ms32 create took seed, share, identifier and index randomness from
Python secrets, which is os.urandom unchanged. Bitcoin Core's
GetStrongRandBytes also mixes in RDRAND/RDSEED where available,
timestamps and accumulated state, so it survives a weak OS generator.
generation.py now draws every byte by calling a caller-supplied
entropy(length); CreationCeremony requires it. The CLI passes
CoreEntropy: a blank temporary wallet in RAM (/dev/shm on Linux, an
hdiutil RAM disk on macOS, else the temp folder with a warning),
encrypted from birth with a 256-bit passphrase sent only on stdin.
Each draw unlocks it, adds one addhdkey key per 32 bytes, takes the
SHA-256 of the xprv, and relocks. Hashing keeps the xpub, stored
unencrypted, from checking guesses of a share. Creation unloads and
deletes the wallet on every exit, including SIGHUP and SIGTERM. Draws
stay sequential, each after the previous card is confirmed. There is
no fallback: if Core cannot supply randomness, create stops.
Security: changes share generation; needs review. The passphrase
comes from secrets. Where no RAM folder exists the encrypted wallet
is briefly on disk.
Validation: ruff, mypy, 914 tests with and without -O, and
tools/bitcoin_core_regtest.py on Bitcoin Core 32.0rc3.
Claude-Session: https://claude.ai/code/session_01T233rKgZqE5wzDm3EVTHL1
Copy file name to clipboardExpand all lines: docs/security/model.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ fingerprints, and wallet history cannot spend funds but remain privacy-sensitive
26
26
| Package API | Recovery, derivation, sharing, and wallet operations accept validated artifacts, not unchecked text. |
27
27
| Python process | Secret objects remain in process memory; normal output must not reveal them unintentionally. |
28
28
| Operator and paper | The operator controls transcription, physical recovery cards, wallet records, and acceptance of correction suggestions. |
29
-
| Entropy and root keys |The operating-system cryptographically secure random-number generator (OS-CSPRNG) and Python stdlib HMAC/SHA-512 primitives are trusted. codex32 performs only BIP32 root validation and root xprv/tprv serialization in process. |
29
+
| Entropy and root keys |Bitcoin Core's random generator, which mixes in the operating-system cryptographically secure random-number generator (OS-CSPRNG), supplies every random byte of `ms32 create`. Python stdlib HMAC/SHA-512 primitives are trusted. codex32 performs only BIP32 root validation and root xprv/tprv serialization in process. |
30
30
| Bitcoin Core | The selected `bitcoin-cli`, its configuration, the selected local Core instance, and the destination computer are trusted for fingerprints, hardened/public-key derivation, and wallet initialization. |
31
31
32
32
## Operator assumptions
@@ -64,8 +64,11 @@ The operator must:
64
64
implementation. Elliptic-curve public-key derivation used for fingerprints,
65
65
xpubs, and public descriptors is delegated to the separately running Bitcoin
66
66
Core process.
67
-
- Separate OS-CSPRNG calls provide opportunities to mix fresh noise but cannot
67
+
- Separate Core draws provide opportunities to mix fresh noise but cannot
68
68
guarantee new physical entropy between calls.
69
+
- The temporary randomness wallet's passphrase comes from the OS-CSPRNG. Where
70
+
no RAM folder exists, as on Windows, the encrypted wallet briefly sits on
71
+
disk. Swap, RAM disks and tmpfs can page memory, including secrets, to disk.
69
72
- A checksum, generation-padding hint, fingerprint, or correction candidate
70
73
does not authenticate a backup or prove the operator's intent.
71
74
- Creation feedback identifies correct groups but does not prove the recovery card was corrected.
Fresh shared creation generates *k* random initial shares. Each uses a separate
119
-
full-payload OS-CSPRNG request. The current share string must be re-entered
122
+
full-payload request to Bitcoin Core. The current share string must be re-entered
120
123
exactly, ignoring case and whitespace, before the next request. Confirmation
121
124
text is never reparsed as the source secret and contributes no entropy. Existing
122
125
complete Bitcoin master seeds are confirmed unchanged and initialize the wallet
@@ -132,8 +135,8 @@ Progressive group-level correctness feedback is explicitly accepted and does not
132
135
133
136
Confirmation shows that the operator can produce the correct recovery string during setup. It cannot prove that the physical backup was corrected rather than reconstructed using confirmation feedback.
134
137
135
-
The API accepts neither caller-provided entropy nor padding values, partial
136
-
bases, or resumable ceremony state. Fresh creation rejects final-share
138
+
The API draws randomness only from its caller's `entropy` source and accepts no
| Preflight | Before entropy or recovery input, explicit chain arguments probe the five standard local networks for Bitcoin Core 32 or newer. One response is selected automatically; multiple responses require operator selection. |
236
239
| Recovery identity |`ms32 wallet` and `ms32 create --existing` authenticate a recovered seed before any wallet is listed. Core derives the recovered fingerprint statelessly, and a mismatch raises `FingerprintMismatch` before any wallet RPC. The restore prompt does not show the recovered value, so the operator compares by typing the fingerprint from the wallet record. Without a record, the operator is shown the recovered fingerprint, whether the backup identifier was derived from the seed (the codex32 fingerprint rule, Bails' RIPEMD-160 rule, or its mid-2023 alpha's SHA-256 rule), and a warning, and then chooses. Fresh `ms32 create` has no pre-existing wallet to authenticate: it shows the newly created seed's fingerprint and requires the operator to acknowledge recording it. These checks catch mistakes such as wrong or mixed cards; anyone able to replace a threshold of cards could already read them. |
237
-
| Process boundary | codex32 invokes the reviewed `bitcoin-cli` from `PATH` as a child without a shell, direct RPC socket, wallet database, or wallet-creation operation. Every call uses loopback and the selected chain. |
240
+
| Process boundary | codex32 invokes the reviewed `bitcoin-cli` from `PATH` as a child without a shell, direct RPC socket, or wallet database; its only walletcreation is the temporary randomness wallet. Every call uses loopback and the selected chain. |
238
241
| Destination | Only an empty descriptor wallet with private keys enabled, no external signer, transactions, descriptors, keypool entries, or active scan is eligible. One eligible wallet is offered directly; multiple wallets are selected by number. New wallets are detected by polling, and rejection returns to every eligible wallet. The escaped name is confirmed exactly. |
239
242
| Seed source | The original ceremony result or validated recovered master seed supplies a root xprv for Core's reported chain. Core v32 creates BIP44, BIP49, BIP84, and BIP86 account-0 descriptors from that key. |
240
-
| Secret channel | The master xprv is sent only through the child's standard input. A timestamped rescan obtains one private descriptor from Core's captured stdout and returns it through stdin; neither value is printed or passed in arguments or diagnostics. codex32 has no passphrase channel and suppresses raw Core errors. |
243
+
| Secret channel | The master xprv is sent only through the child's standard input. A timestamped rescan obtains one private descriptor from Core's captured stdout and returns it through stdin; neither value is printed or passed in arguments or diagnostics. codex32 never handles the operator's wallet passphrase and suppresses raw Core errors. |
241
244
| Revalidation | Every destination property is checked again immediately before adding the key. `addhdkey` must accept it and `createwalletdescriptor` must return two public descriptors for each requested address type. Numeric recovery timestamps trigger Core's time-based rescan (genesis for `0`), with no guessed block height. Core is trusted to derive and store the wallet policy. |
242
245
| Relocking | Once Core reports an encrypted private-key wallet unlocked, a `finally`-protected obligation requests `walletlock` and verifies the locked state after success, failure, state change, or interruption. |
0 commit comments