← Back to Bitcoin Improvement Proposals
BIPinformational

BIP-374: vendor secp256k1lab and use it for reference implementation

Following up on the recent decision that [secp256k1lab](https://github.com/secp256k1lab/secp256k1lab) should be vendored per-BIP if needed/useful (see https://github.com/bitcoin/bips/pull/2004#issuecomment-3713521737 ff. and https://github.com/bitcoin/bips/pull/1855#issuecomment-3723682682 ff.), this PR exercises this for BIP-374. The changes add secp256k1lab version 1.0.0 as subtree [1] within the `bip-0374` folder and take use of it in the reference implementation. In particular, `secp256k1.py

No reviews
theStack·Updated Jan 28, 2026·0 reviews·0 attestations·View source
Collections:BIPs — Merged

Specification

Following up on the recent decision that [secp256k1lab](https://github.com/secp256k1lab/secp256k1lab) should be vendored per-BIP if needed/useful (see https://github.com/bitcoin/bips/pull/2004#issuecomment-3713521737 ff. and https://github.com/bitcoin/bips/pull/1855#issuecomment-3723682682 ff.), this PR exercises this for BIP-374. The changes add secp256k1lab version 1.0.0 as subtree [1] within the `bip-0374` folder and take use of it in the reference implementation. In particular, `secp256k1.py` is removed and the `TaggedHash` and `xor_bytes` routines are used from the secp256k1lab utils module, to simplify the code further. Usage of the library is mentioned in the BIP text to be license compliant (see https://github.com/bitcoin/bips/pull/2004#issuecomment-3723813845).

Can be tested via:

```

$ ./bip-0374/run_test_vectors.py

All test vectors passed.

$ ./bip-0374/gen_test_vectors.py

Generating /home/thestack/bips/bip-0374/test_vectors_generate_proof.csv...

Generating /home/thestack/bips/bip-0374/test_vectors_verify_proof.csv...

$ git diff

<shouldn't show any diffs, as generated .csv files should match the ones in the repository>

```

[1] added via the command `$ git subtree add --prefix=bip-0374/secp256k1lab --squash https://github.com/secp256k1lab/secp256k1lab v1.0.0`

Discussion (0 threads)

Loading discussions...