bolt3

Lightning transaction and script formats, per BOLT #3 (docs.ppad.tech/bolt3).
git clone git://git.ppad.tech/bolt3.git
Log | Files | Refs | README | LICENSE

CHANGELOG (3164B)


      1 # Changelog
      2 
      3 - 0.1.1 (2026-10-31)
      4   * Merely bumps the ppad-fixed and ppad-secp256k1 dependencies, to
      5     0.2.1 and 0.5.9.
      6 
      7 - 0.1.0 (2026-10-10)
      8   * A substantial rewrite, with breaking changes throughout:
      9 
     10     * Ports to ppad-bolt1 0.1.0 and ppad-tx 0.2.0. Amounts, points,
     11       hashes and per-commitment secrets are bolt1's types (amounts are
     12       bounded, with checked arithmetic); bolt3's Pubkey is merged into
     13       bolt1's Point, wrapped in role newtypes (RevocationPubkey, etc.).
     14 
     15     * The API is exported from Lightning.Protocol.BOLT3 alone, with
     16       snake_case names. Types with invariants (CommitmentNumber,
     17       SecretIndex, Seed, Seckey, SecretStore) are abstract, and every
     18       type has an NFData instance.
     19 
     20     * ChannelFeatures is replaced by CommitmentFormat (StaticRemotekey
     21       or Anchors).
     22 
     23     * CommitmentContext is owner-relative throughout: the payment
     24       basepoints are ordered for the obscured commitment number by
     25       cc_is_funder. build_commitment_tx fails rather than produce a
     26       transaction without outputs.
     27 
     28     * OutputType carries the HTLC an output pays. build_htlc_tx replaces
     29       build_htlc_timeout_tx and build_htlc_success_tx, choosing by HTLC
     30       direction, and fails if the fee exceeds the amount.
     31 
     32     * Closing transactions have separate builders with spec-shaped
     33       inputs: build_legacy_closing_tx applies the signer's dust limit to
     34       both outputs and can omit the signer's output; build_closing_tx
     35       (option_simple_close) charges the closer, takes an explicit choice
     36       of outputs, and gives OP_RETURN outputs amount zero.
     37 
     38     * to_remote_script is split into to_remote_witness_script and
     39       to_remote_script_pubkey. Witness functions append the witness
     40       script and take typed keys; funding_witness orders signatures by
     41       pubkey. Adds htlc_success_witness, htlc_timeout_witness and
     42       remote_htlc_sighash.
     43 
     44     * Per-commitment secrets use Seed, SecretIndex and bolt1's
     45       PerCommitmentSecret. SecretStore is abstract, with a redacted
     46       Show instance and secret_store/un_secret_store for persistence.
     47       Adds commitment_secret_index.
     48 
     49     * Adds derive_commitment_keys, derive_privkey and
     50       derive_revocationprivkey.
     51 
     52     * Renames encode_tx to encode_commitment_tx, and documents the
     53       encoders as producing unsigned, witness-free serializations.
     54 
     55     * Removes the Validate, Decode, Encode and Internal modules, the
     56       role-specific key derivation functions, encode_tx_for_signing,
     57       encode_witness, encode_funding_witness, has_anchors, sort_outputs,
     58       trimmed_htlcs, untrimmed_htlcs, derive_secret, the HTLC output
     59       script aliases, the weight constants and unused record fields.
     60 
     61   * Fixes insert_secret, which discarded the entries needed to derive
     62     older secrets and accepted invalid secret sequences.
     63 
     64   * Fixes closing transactions, which used each party's dust limit in
     65     legacy closes, and charged the funder and paid OP_RETURN outputs in
     66     option_simple_close.
     67 
     68   * Rejects key derivations yielding the point at infinity.
     69 
     70   * Tests cover every BOLT #3 Appendix B-F vector.
     71 
     72 - 0.0.1 (2026-04-18)
     73   * Initial release.