From 20a2bccda8d49900ccaa6043b031f6996269b725 Mon Sep 17 00:00:00 2001 From: benma's agent Date: Sun, 4 Oct 2026 10:31:20 +0200 Subject: [PATCH] docs: document the source of Bitcoin test vectors The Bitcoin transaction vectors are generated in bitbox02-firmware and must be copied byte-for-byte instead of edited in this repository. Document their Rust source, generation instructions, and copy command. Require reading README.md in AGENTS.md before making changes. --- AGENTS.md | 3 +++ README.md | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..002223a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,3 @@ +# Repository instructions + +Read [README.md](README.md) before making changes to this repository. diff --git a/README.md b/README.md index 3d2f5f3..6985338 100644 --- a/README.md +++ b/README.md @@ -356,3 +356,19 @@ npm run test:sim -- test/simulator-btc.test.ts For build, test, simulator, protobuf, and contribution workflow details, see [CONTRIBUTING.md](CONTRIBUTING.md). + +## Updating the Bitcoin transaction test vectors + +The vectors in [test/data/btc-transaction-test-vectors.json](test/data/btc-transaction-test-vectors.json) +are generated in the BitBox02 firmware repository. Do not modify this JSON file directly. + +The source of truth is the Rust constructors in +[`src/rust/bitbox-test-vectors/src/btc_transaction/cases/`](https://github.com/BitBoxSwiss/bitbox02-firmware/tree/master/src/rust/bitbox-test-vectors/src/btc_transaction/cases). +Make changes there and regenerate the canonical JSON following the +[test vector generation instructions](https://github.com/BitBoxSwiss/bitbox02-firmware/blob/master/src/rust/bitbox-test-vectors/README.md). +Then copy the generated file byte-for-byte into this repository: + +```sh +cp /path/to/bitbox02-firmware/src/rust/bitbox-test-vectors/testdata/btc-transaction-test-vectors.json \ + test/data/btc-transaction-test-vectors.json +```