RFC: Integrate secp256k1lab v1.0.0 as subtree, use it for BIP-374 #1855

pull theStack wants to merge 4 commits into bitcoin:master from theStack:showcase-use_secp256k1lab_for_bip374 changing 16 files +431 −107
  1. theStack commented at 9:25 pm on May 20, 2025: contributor

    This PR integrates the recently released secp256k1lab prototyping library as a subtree [1] and uses it in the BIP-374 reference code as a drop-in replacement of the currently used secp256k1.py file (copied in from the Bitcoin Core functional test framework in 0c7e54d780d059ebbab345946d7c6adbc61fef15). This is intended to serve as a showcase in the hope of triggering a discussion with BIP maintainers and authors on how to best integrate current and future BIPs reference implementations that take use secp256k1 curve operations.

    I chose to demo this on BIP-374 since that’s the BIP reference implementation I’m most familiar with, and as one can see in the last commit, the interface is fully compatible, i.e. there were no actual changes in the code logic needed. In order to find the vendored copy of secp256k1lab, Python’s sys.path is extended [2]. Similar integrations have been done in the bip-frost-dkg (https://github.com/BlockstreamResearch/bip-frost-dkg/pull/83) and bip-frost-signing (https://github.com/siv2r/bip-frost-signing/pull/23, still WIP) repos.

    See also related mailing list threads:

    [1] added via the command $ git subtree add --prefix=python/secp256k1lab --squash https://github.com/secp256k1lab/secp256k1lab v1.0.0 [2] see e.g. https://github.com/BlockstreamResearch/bip-frost-dkg/pull/81 for an earlier uglier approach; extending sys.path also seems to be a bit hacky, but seems to be the typical way to achieve the goal

  2. Squashed 'python/secp256k1lab/' content from commit 44dc4bd
    git-subtree-dir: python/secp256k1lab
    git-subtree-split: 44dc4bd893b8f03e621585e3bf255253e0e0fbfb
    849750bd3b
  3. Merge commit '849750bd3b69ca1c4afe31c4c2fc46d6fb9b707d' as 'python/secp256k1lab' 18f0081bf4
  4. BIP-374: avoid using sys.path[0] to find current working directory
    This approach is incompatible with the sys.path extension approach
    in the next commit which is used to to find the vendored copy of
    secp256k1lab, so use __file__ instead which works as well.
    a49f422593
  5. BIP-374: replace secp256k1.py with vendored copy of secp256k1lab 50b0747453
  6. jonatack added the label Proposed BIP modification on May 21, 2025
  7. jonatack added the label Process on May 21, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-09 07:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me