docs: add docs-as-code process and one ADR per feature

docs/docs-as-code.md defines the workflow; docs/adr holds 31 ADRs
(retroactive, reconstructed from code and changelog) with a template and
index. docs/check-docs.sh validates ADR structure, index, cited code
paths, relative links and CLAUDE.md/AGENTS.md sync.
This commit is contained in:
davide committed 2026-11-03 09:45:51 +01:00
1 parent ce8d777c63
commit b292590cdc
36 files changed
+987

No files matched your search

@@ -0,0 +1,24 @@
# 0005. Use NBitcoin for protocol primitives, hand-write only the rest
- **Status:** Accepted
- **Area:** Crypto
- **Recorded:** 2026-11-03 (retroactive: reconstructed from code, comments and changelog)
## Context
Reimplementing BIP32/39, address encoding, transaction serialization, signing or PSBT is a classic source of subtle, fund-losing bugs.
## Decision
Build on NBitcoin for the custom network definition, BIP32/39, addresses, transactions, PSBT, signing, encoding and hashing. Hand-written code is limited to what NBitcoin does not provide for this chain: the Electrum JSON-RPC client (0009), SPV sync with Merkle verification and checkpoint anchoring (0006, 0007), coin selection and fee policy (0017), SLIP-132 variants beyond xpub/xprv (0014) and the encrypted wallet container (0012).
## Consequences
- Smaller audited surface; cross-implementation golden vectors catch divergence.
- NBitcoin assumes Bitcoin retargeting, which is why PoW validation is skipped (0006).
- A dependency upgrade can change behaviour; golden-vector tests must pass before bumping.
## References
- `src/Core/Chain/PalladiumNetworks.cs`
- `src/Core/Crypto/Slip132.cs`