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:
- first mentioning of a secp256k1 prototyping library in the ChillDKG thread: https://groups.google.com/g/bitcoindev/c/HE3HSnGTpoQ/m/Y2VhaMCrCAAJ (back then it was called “secp256k1proto”)
- secp256k1lab announcement: https://groups.google.com/g/bitcoindev/c/f3MQRO-yxEw/m/cEi6Sd7LBwAJ
[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