docs(onchain-zaps): record the hand-rolled Bitcoin consensus code decision

Decision: keep the hand-rolled psbt/ + taproot/ consensus layer rather than
adopting fr.acinq.bitcoin-kmp. Rationale: a deliberately small single-key-path
P2TR subset, pinned to authoritative BIP-341/350 test vectors at every layer
(sighash, tweak, witness signature bytes, addresses, tx serialization), and
consistent with the project's minimal-dependency stance.

Recorded in amethyst/plans/2026-05-14-onchain-zaps.md with the consequence
spelled out (we own correctness; revisit if scope expands past single-key-path
P2TR). The psbt/ and taproot/ packages now carry a pointer back to that
decision so a future reader doesn't reflexively swap in a library.

Doc-comment + plan-doc only; no logic change.
This commit is contained in:
Claude
2026-05-14 18:16:30 +00:00
parent 07724e410b
commit d77f2f7333
3 changed files with 44 additions and 1 deletions
@@ -97,6 +97,12 @@ class PsbtMap(
* finalize the single-key-path P2TR spends NIP-BC needs. Unknown records are
* preserved verbatim so the container round-trips even when fields aren't
* modeled.
*
* This `psbt/` package is intentionally hand-rolled rather than delegated to a
* Bitcoin library. That is a recorded architecture decision — see
* `amethyst/plans/2026-05-14-onchain-zaps.md` ("Architecture decision:
* hand-rolled Bitcoin consensus code"). It holds only while the scope stays at
* single-key-path P2TR; expanding past that should revisit the decision.
*/
class Psbt(
val global: PsbtMap,
@@ -37,6 +37,11 @@ import com.vitorpamplona.quartz.utils.sha256.sha256
*
* where `bytes(P)` is the 32-byte x-only Nostr pubkey and `hashTapTweak` is
* the BIP-340 tagged hash with tag `"TapTweak"`.
*
* This `taproot/` package is intentionally hand-rolled rather than delegated to
* a Bitcoin library — a recorded architecture decision, see
* `amethyst/plans/2026-05-14-onchain-zaps.md` ("Architecture decision:
* hand-rolled Bitcoin consensus code").
*/
object TaprootAddress {
private const val TAP_TWEAK_TAG = "TapTweak"