<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>tx, branch HEAD</title>
<subtitle>Minimal transaction primitives (docs.ppad.tech/tx).
</subtitle>
<entry>
<id>6e22072caac8c1db991c2640fcb795afba8c294a</id>
<published>2026-04-18T12:35:59Z</published>
<updated>2026-04-18T12:35:59Z</updated>
<title type="text">lib: add NFData instances for all transaction types</title>
<link rel="alternate" type="text/html" href="commit/6e22072caac8c1db991c2640fcb795afba8c294a.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 6e22072caac8c1db991c2640fcb795afba8c294a
parent 7bb595ed894086fcc03e6d42c820fbecd436b3e4
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 20:35:59 +0800

lib: add NFData instances for all transaction types

Add deepseq dependency and NFData instances for TxId, OutPoint,
TxIn, TxOut, Witness, and Tx directly in the library. This
eliminates the need for orphan instances in downstream consumers
(bolt2, bolt3) and bench suites.

</content>
</entry>
<entry>
<id>7bb595ed894086fcc03e6d42c820fbecd436b3e4</id>
<published>2026-04-18T11:55:14Z</published>
<updated>2026-04-18T11:55:14Z</updated>
<title type="text">readme: add</title>
<link rel="alternate" type="text/html" href="commit/7bb595ed894086fcc03e6d42c820fbecd436b3e4.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 7bb595ed894086fcc03e6d42c820fbecd436b3e4
parent 808117ba0b35635af087f179b518eab852c29466
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 19:55:14 +0800

readme: add

</content>
</entry>
<entry>
<id>808117ba0b35635af087f179b518eab852c29466</id>
<published>2026-04-18T11:51:25Z</published>
<updated>2026-04-18T11:51:44Z</updated>
<title type="text">Add validation and legacy sighash tests</title>
<link rel="alternate" type="text/html" href="commit/808117ba0b35635af087f179b518eab852c29466.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 808117ba0b35635af087f179b518eab852c29466
parent e29dc705ffdec4da9c7501d1f076b14e31b9aef1
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sat, 18 Apr 2026 19:51:25 +0800

Add validation and legacy sighash tests

Cover gaps: mkTxId rejection (31/33/empty bytes), from_bytes
rejection (truncated/trailing/garbage), from_base16 rejection
(invalid hex), sighash_segwit out-of-range index, and a legacy
sighash known vector with hand-computed double-SHA256.

</content>
</entry>
<entry>
<id>e29dc705ffdec4da9c7501d1f076b14e31b9aef1</id>
<published>2026-01-25T14:36:57Z</published>
<updated>2026-01-25T14:36:57Z</updated>
<title type="text">Add property tests and BIP143 sighash vectors</title>
<link rel="alternate" type="text/html" href="commit/e29dc705ffdec4da9c7501d1f076b14e31b9aef1.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit e29dc705ffdec4da9c7501d1f076b14e31b9aef1
parent 9602ba756afa5764d3711525a05d436b23d90169
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:36:57 +0400

Add property tests and BIP143 sighash vectors

Property tests:
- Round-trip: from_bytes . to_bytes, from_base16 . to_base16
- Serialisation: legacy tx equality, segwit longer than legacy
- TxId: always 32 bytes, ignores witnesses
- Sighash: legacy/segwit always 32 bytes, SIGHASH_SINGLE bug

BIP143 test vectors:
- Native P2WPKH (SIGHASH_ALL)
- P2SH-P2WPKH (SIGHASH_ALL)

Adds Arbitrary instances for Tx, TxIn, TxOut, OutPoint, Witness,
TxId, and SighashType.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>9602ba756afa5764d3711525a05d436b23d90169</id>
<published>2026-01-25T14:32:12Z</published>
<updated>2026-01-25T14:32:12Z</updated>
<title type="text">Merge impl/type-safety: type-level safety improvements</title>
<link rel="alternate" type="text/html" href="commit/9602ba756afa5764d3711525a05d436b23d90169.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 9602ba756afa5764d3711525a05d436b23d90169
parent 500140d29936670be7064731f40961a0915aebce
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:32:12 +0400

Merge impl/type-safety: type-level safety improvements

Improves type safety across the library:

- tx_inputs/tx_outputs now use NonEmpty, enforcing Bitcoin&#39;s
  requirement of at least one input and output at compile time

- mkTxId smart constructor validates 32-byte length

- sighash_segwit returns Maybe instead of using error

These changes make illegal states unrepresentable and eliminate
partial functions from the public API.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>0fc4d9fe07087ea81873be87bab89cd5baa555cf</id>
<published>2026-01-25T14:31:42Z</published>
<updated>2026-01-25T14:31:42Z</updated>
<title type="text">Improve type safety: NonEmpty tx io, Maybe sighash, mkTxId</title>
<link rel="alternate" type="text/html" href="commit/0fc4d9fe07087ea81873be87bab89cd5baa555cf.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 0fc4d9fe07087ea81873be87bab89cd5baa555cf
parent 500140d29936670be7064731f40961a0915aebce
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:31:42 +0400

Improve type safety: NonEmpty tx io, Maybe sighash, mkTxId

- Change tx_inputs and tx_outputs from [TxIn]/[TxOut] to NonEmpty,
  enforcing Bitcoin&#39;s requirement of at least one input and output
  at the type level

- Add mkTxId smart constructor that validates 32-byte length,
  returning Maybe TxId instead of allowing invalid construction

- Change sighash_segwit to return Maybe BS.ByteString instead of
  using error on invalid input index, making it total

- Refactor serialize_legacy_sighash to work directly without
  constructing intermediate Tx (needed since SIGHASH_NONE can
  produce empty output lists, now invalid for Tx type)

- Update all tests and benchmarks for NonEmpty syntax

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>500140d29936670be7064731f40961a0915aebce</id>
<published>2026-01-25T14:16:25Z</published>
<updated>2026-01-25T14:16:25Z</updated>
<title type="text">Polish: add Haddock examples and fix line lengths</title>
<link rel="alternate" type="text/html" href="commit/500140d29936670be7064731f40961a0915aebce.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 500140d29936670be7064731f40961a0915aebce
parent 46b3d68a099ce6d0616218a11c20ceb670833544
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:16:25 +0400

Polish: add Haddock examples and fix line lengths

- Add documentation examples to Tx.hs public API:
  to_bytes, from_bytes, to_bytes_legacy, to_base16, from_base16, txid
- Improve sighash_legacy and sighash_segwit documentation
- Fix 4 lines exceeding 80 characters in Sighash.hs

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>46b3d68a099ce6d0616218a11c20ceb670833544</id>
<published>2026-01-25T14:07:46Z</published>
<updated>2026-01-25T14:07:46Z</updated>
<title type="text">Merge impl/bench: benchmark suites</title>
<link rel="alternate" type="text/html" href="commit/46b3d68a099ce6d0616218a11c20ceb670833544.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 46b3d68a099ce6d0616218a11c20ceb670833544
parent 6a6edea1d30b9e26b4c8567fd9655eda03b06c82
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:07:46 +0400

Merge impl/bench: benchmark suites

Criterion wall-time and Weigh allocation benchmarks for:
- to_bytes, from_bytes, to_bytes_legacy, txid
- Small (1 I/O), medium (5 I/O), large (20 I/O) transactions
- Both legacy and segwit variants

24 benchmarks in each suite (48 total).

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>6a6edea1d30b9e26b4c8567fd9655eda03b06c82</id>
<published>2026-01-25T14:07:41Z</published>
<updated>2026-01-25T14:07:41Z</updated>
<title type="text">Merge impl/tests: serialisation and txid tests</title>
<link rel="alternate" type="text/html" href="commit/6a6edea1d30b9e26b4c8567fd9655eda03b06c82.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 6a6edea1d30b9e26b4c8567fd9655eda03b06c82
parent 96516891b5d146433b90dcbb25c6f54964949bf5
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:07:41 +0400

Merge impl/tests: serialisation and txid tests

10 tests covering:
- Round-trip tests: simple legacy, segwit with witnesses, multiple I/O
- Known vectors: Satoshi-&gt;Hal tx (block 170), first segwit tx (block 481824)
- TxId computation verification
- Edge cases: empty scriptSig, max sequence, zero locktime, multiple witnesses

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>96516891b5d146433b90dcbb25c6f54964949bf5</id>
<published>2026-01-25T14:07:37Z</published>
<updated>2026-01-25T14:07:37Z</updated>
<title type="text">Merge impl/sighash: sighash computation</title>
<link rel="alternate" type="text/html" href="commit/96516891b5d146433b90dcbb25c6f54964949bf5.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 96516891b5d146433b90dcbb25c6f54964949bf5
parent 8db650328a223f6f008aa17f7d9af6526512c597
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:07:37 +0400

Merge impl/sighash: sighash computation

Implements legacy and BIP143 segwit sighash computation.

- Export internal encoding helpers from Bitcoin.Prim.Tx
- sighash_legacy: legacy sighash for P2PKH/P2SH inputs
  - Handles SIGHASH_ALL, SIGHASH_NONE, SIGHASH_SINGLE
  - ANYONECANPAY modifier support
  - SIGHASH_SINGLE edge case (index &gt;= outputs)
- sighash_segwit: BIP143 sighash for segwit inputs
  - hashPrevouts, hashSequence, hashOutputs preimages
  - Full BIP143 serialization format

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>60d073dba4ec4ea95f119d2b69773bbb77c19528</id>
<published>2026-01-25T14:06:41Z</published>
<updated>2026-01-25T14:06:41Z</updated>
<title type="text">Implement benchmark suites for tx primitives</title>
<link rel="alternate" type="text/html" href="commit/60d073dba4ec4ea95f119d2b69773bbb77c19528.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 60d073dba4ec4ea95f119d2b69773bbb77c19528
parent 8db650328a223f6f008aa17f7d9af6526512c597
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:06:41 +0400

Implement benchmark suites for tx primitives

Add criterion wall-time benchmarks (bench/Main.hs) and weigh allocation
benchmarks (bench/Weight.hs) for core transaction operations:

- to_bytes: serialise transaction to bytes
- from_bytes: parse transaction from bytes
- to_bytes_legacy: legacy serialisation (no witness data)
- txid: compute transaction ID

Benchmarks cover transactions of varying sizes:
- Small: 1 input, 1 output
- Medium: 5 inputs, 5 outputs
- Large: 20 inputs, 20 outputs

Both legacy and segwit variants are tested.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>a8c28fb1daec3b183d876cb48932bc21f8bc3a3b</id>
<published>2026-01-25T14:06:23Z</published>
<updated>2026-01-25T14:06:23Z</updated>
<title type="text">Implement serialisation and txid tests</title>
<link rel="alternate" type="text/html" href="commit/a8c28fb1daec3b183d876cb48932bc21f8bc3a3b.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit a8c28fb1daec3b183d876cb48932bc21f8bc3a3b
parent 8db650328a223f6f008aa17f7d9af6526512c597
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:06:23 +0400

Implement serialisation and txid tests

Add comprehensive test suite for transaction primitives:

Round-trip tests:
- Simple legacy tx (1 input, 1 output, no witnesses)
- Segwit tx with witnesses
- Multiple inputs/outputs

Known vector tests:
- Parse Satoshi-&gt;Hal tx (block 170, first BTC transaction)
- Parse first segwit tx on mainnet (block 481824)
- Verify txid computation against known txid

Edge case tests:
- Empty scriptSig (common in segwit)
- Maximum sequence number (0xffffffff)
- Zero locktime
- Multiple witness items per input

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>09af78077216ce2056b19580f1ff220931d60eb4</id>
<published>2026-01-25T14:06:15Z</published>
<updated>2026-01-25T14:06:15Z</updated>
<title type="text">Implement sighash computation for legacy and BIP143 segwit</title>
<link rel="alternate" type="text/html" href="commit/09af78077216ce2056b19580f1ff220931d60eb4.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 09af78077216ce2056b19580f1ff220931d60eb4
parent 8db650328a223f6f008aa17f7d9af6526512c597
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 18:06:15 +0400

Implement sighash computation for legacy and BIP143 segwit

Add two sighash functions:

- sighash_legacy: computes sighash for legacy P2PKH/P2SH inputs,
  handling SIGHASH_ALL, SIGHASH_NONE, SIGHASH_SINGLE, and the
  ANYONECANPAY modifier. Includes the SIGHASH_SINGLE edge case
  where index &gt;= number of outputs returns the &quot;bug&quot; hash.

- sighash_segwit: computes BIP143 sighash for segwit inputs,
  with proper hashPrevouts, hashSequence, and hashOutputs
  computation based on sighash flags.

Export internal encoding helpers from Bitcoin.Prim.Tx for use
by the Sighash module: put_word32_le, put_word64_le, put_compact,
put_outpoint, put_txout, to_strict.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>8db650328a223f6f008aa17f7d9af6526512c597</id>
<published>2026-01-25T13:59:32Z</published>
<updated>2026-01-25T13:59:32Z</updated>
<title type="text">Implement txid computation</title>
<link rel="alternate" type="text/html" href="commit/8db650328a223f6f008aa17f7d9af6526512c597.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 8db650328a223f6f008aa17f7d9af6526512c597
parent e401de2b86f7470eedfbf537a6cbcb57614e1b20
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:59:32 +0400

Implement txid computation

Add txid function using ppad-sha256: double SHA256 of the legacy
serialisation (no witness data).

Also add flake.lock generated during build.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>e401de2b86f7470eedfbf537a6cbcb57614e1b20</id>
<published>2026-01-25T13:53:40Z</published>
<updated>2026-01-25T13:54:00Z</updated>
<title type="text">Merge impl/decoding: transaction parsing</title>
<link rel="alternate" type="text/html" href="commit/e401de2b86f7470eedfbf537a6cbcb57614e1b20.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit e401de2b86f7470eedfbf537a6cbcb57614e1b20
parent 26bc887b09a314b71d6cb0d3831e9f9486ae4552
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:53:40 +0400

Merge impl/decoding: transaction parsing

</content>
</entry>
<entry>
<id>26bc887b09a314b71d6cb0d3831e9f9486ae4552</id>
<published>2026-01-25T13:52:37Z</published>
<updated>2026-01-25T13:52:37Z</updated>
<title type="text">Merge impl/encoding: transaction serialisation</title>
<link rel="alternate" type="text/html" href="commit/26bc887b09a314b71d6cb0d3831e9f9486ae4552.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 26bc887b09a314b71d6cb0d3831e9f9486ae4552
parent baa2031ec129e3fbb3038195cdc241d190585b09
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:52:37 +0400

Merge impl/encoding: transaction serialisation

</content>
</entry>
<entry>
<id>d26828b5c441c3db23a323f18e665a4f6bae02cb</id>
<published>2026-01-25T13:52:25Z</published>
<updated>2026-01-25T13:52:25Z</updated>
<title type="text">Implement transaction parsing (decoding)</title>
<link rel="alternate" type="text/html" href="commit/d26828b5c441c3db23a323f18e665a4f6bae02cb.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit d26828b5c441c3db23a323f18e665a4f6bae02cb
parent baa2031ec129e3fbb3038195cdc241d190585b09
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:52:25 +0400

Implement transaction parsing (decoding)

Add decoding functions for Bitcoin transactions:
- get_compact: compactSize decoding with minimal encoding enforcement
- get_word32_le, get_word64_le, get_word16_le: little-endian word decoding
- get_outpoint, get_txin, get_txout, get_witness: component decoders
- from_bytes: full tx parsing with segwit/legacy format detection

Segwit detection via marker byte 0x00 followed by flag 0x01 after version.
Uses explicit offset tracking without external parser libraries.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>186efe865008fe37957484cf2d1cc45cc3804318</id>
<published>2026-01-25T13:52:23Z</published>
<updated>2026-01-25T13:52:23Z</updated>
<title type="text">Implement transaction serialisation (encoding)</title>
<link rel="alternate" type="text/html" href="commit/186efe865008fe37957484cf2d1cc45cc3804318.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit 186efe865008fe37957484cf2d1cc45cc3804318
parent baa2031ec129e3fbb3038195cdc241d190585b09
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:52:23 +0400

Implement transaction serialisation (encoding)

Add encoding functions for Bitcoin transactions:
- put_compact: compactSize (varint) encoding
- put_word32_le, put_word64_le: little-endian word encoding
- put_outpoint, put_txin, put_txout, put_witness: component encoders
- to_bytes: full tx serialisation (segwit format if witnesses present)
- to_bytes_legacy: legacy format (no witness data, for txid computation)

Uses Data.ByteString.Builder for efficient construction.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
<entry>
<id>baa2031ec129e3fbb3038195cdc241d190585b09</id>
<published>2026-01-25T13:44:02Z</published>
<updated>2026-01-25T13:44:02Z</updated>
<title type="text">plans: add</title>
<link rel="alternate" type="text/html" href="commit/baa2031ec129e3fbb3038195cdc241d190585b09.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit baa2031ec129e3fbb3038195cdc241d190585b09
parent a468ba5a0daee4cf6719cba659ea5272806f694b
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:44:02 +0400

plans: add

</content>
</entry>
<entry>
<id>a468ba5a0daee4cf6719cba659ea5272806f694b</id>
<published>2026-01-25T13:43:35Z</published>
<updated>2026-01-25T13:43:35Z</updated>
<title type="text">Initial project skeleton for ppad-tx</title>
<link rel="alternate" type="text/html" href="commit/a468ba5a0daee4cf6719cba659ea5272806f694b.html" />
<author>
<name>Jared Tobin</name>
<email>jared@jtobin.io</email>
</author>
<content type="text">commit a468ba5a0daee4cf6719cba659ea5272806f694b
Author: Jared Tobin &lt;jared@jtobin.io&gt;
Date:   Sun, 25 Jan 2026 17:43:35 +0400

Initial project skeleton for ppad-tx

Minimal Bitcoin transaction primitives library, following ppad
conventions (Bitcoin.Prim.* namespace, nix flake, LLVM support).

Modules:
- Bitcoin.Prim.Tx: core types (Tx, TxIn, TxOut, OutPoint, Witness, TxId)
  and serialisation stubs
- Bitcoin.Prim.Tx.Sighash: sighash types and computation stubs

Dependencies: ppad-sha256, ppad-base16.

Co-Authored-By: Claude Opus 4.5 &lt;noreply@anthropic.com&gt;

</content>
</entry>
</feed>
