merge-script 7e460db4ca Merge BlockstreamResearch/secp256k1-zkp#307: Upstream PRs 1484, 1483, 1486, 1496, 1489, 1490, 1507, 1512, 1515
f9cf003d9b scalar: Port bitcoin-core/secp256k1#1512 to zkp-specific code (mllwchrry)
a85e2233e7 ci: Note affected clangs in comment on ASLR quirk (Tim Ruffing)
f7f0184ba1 msan: notate more variable assignments from assembly code (Cory Fields)
a61339149f change inconsistent array param to pointer (Cory Fields)
a5e8ab2484 ci: Add sanitizer env variables to debug output (Tim Ruffing)
84a93de4d2 ci: Add workaround for ASLR bug in sanitizers (Tim Ruffing)
2028069df2 doc: clarify input requirements for secp256k1_fe_mul (Sebastian Falbesoner)
11420a7a28 tests: improve fe_sqr test (Sebastian Falbesoner)
e7bdddd9c9 refactor: rename `check_fe_equal` -> `fe_equal` (Sebastian Falbesoner)
00111c9c56 tests: add missing fe comparison checks for inverse field test cases (Sebastian Falbesoner)
31ba404944 msan: notate variable assignments from assembly code (Cory Fields)
e7ea32e30a msan: Add SECP256K1_CHECKMEM_MSAN_DEFINE which applies to memory sanitizer and not valgrind (Cory Fields)
94a14d5290 ci: Update cache action (Hennadii Stepanov)
3777e3f36a cmake: Recommend native CMake commands in README (Tim Ruffing)
51df2d9ab3 tests: Drop redundant _scalar_check_overflow calls (Tim Ruffing)

Pull request description:

  Merge bitcoin-core/secp256k1#1484: tests: Drop redundant _scalar_check_overflow calls
  Merge bitcoin-core/secp256k1#1483: cmake: Recommend native CMake commands in README
  Merge bitcoin-core/secp256k1#1486: ci: Update cache action
  Merge bitcoin-core/secp256k1#1496: msan: notate variable assignments from assembly code
  Merge bitcoin-core/secp256k1#1489: tests: add missing fe comparison checks for inverse field test cases
  Merge bitcoin-core/secp256k1#1490: tests: improve fe_sqr test (issue #1472)
  Merge bitcoin-core/secp256k1#1507: ci: Add workaround for ASLR bug in sanitizers
  Merge bitcoin-core/secp256k1#1512: msan: notate more variable assignments from assembly code
  Merge bitcoin-core/secp256k1#1515: ci: Note affected clangs in comment on ASLR quirk

  This PR can be recreated with `./contrib/sync-upstream.sh -b master range d831168`.
  Tip: Use `git show --remerge-diff` to show the changes manually added to the merge commit.

ACKs for top commit:
  real-or-random:
    ACK f9cf003d9b

Tree-SHA512: c1720b50abb452ebea28f48239411863ac5ab2a7dcc2f34b8ebf05eb11b2657d35ea63a261624d33a82b89eb93db41eea166d5565b3e5d080a0181370d3d9b72
2026-01-29 16:26:31 +01:00
2026-01-22 09:09:27 +00:00
2024-01-09 01:05:09 +01:00
2024-01-03 20:03:07 +08:00
2013-05-09 15:24:32 +02:00
2024-01-25 15:58:52 +01:00

libsecp256k1-zkp

Dependencies: None

A fork of libsecp256k1 with support for advanced and experimental features such as Confidential Assets and MuSig2

Added features:

  • Experimental module for ECDSA adaptor signatures.
  • Experimental module for ECDSA sign-to-contract.
  • Experimental module for MuSig2.
  • Experimental module for Confidential Assets (Pedersen commitments, range proofs, and surjection proofs).
  • Experimental module for Bulletproofs++ range proofs.
  • Experimental module for address whitelisting.

Experimental features are made available for testing and review by the community. The APIs of these features should not be considered stable.

Build steps

Building with Autotools

$ ./autogen.sh
$ ./configure
$ make
$ make check  # run the test suite
$ sudo make install  # optional

To compile optional modules (such as Schnorr signatures), you need to run ./configure with additional flags (such as --enable-module-schnorrsig). Run ./configure --help to see the full list of available flags. For experimental modules, you will also need --enable-experimental as well as a flag for each individual module, e.g. --enable-module-musig.

Building with CMake (experimental)

To maintain a pristine source tree, CMake encourages to perform an out-of-source build by using a separate dedicated build tree.

Building on POSIX systems

$ mkdir build && cd build
$ cmake ..
$ cmake --build .
$ ctest  # run the test suite
$ sudo cmake --build . --target install  # optional

To compile optional modules (such as Schnorr signatures), you need to run cmake with additional flags (such as -DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON). Run cmake .. -LH to see the full list of available flags.

Cross compiling

To alleviate issues with cross compiling, preconfigured toolchain files are available in the cmake directory. For example, to cross compile for Windows:

$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake

To cross compile for Android with NDK (using NDK's toolchain file, and assuming the ANDROID_NDK_ROOT environment variable has been set):

$ cmake .. -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28

Building on Windows

To build on Windows with Visual Studio, a proper generator must be specified for a new build tree.

The following example assumes using of Visual Studio 2022 and CMake v3.21+.

In "Developer Command Prompt for VS 2022":

>cmake -G "Visual Studio 17 2022" -A x64 -S . -B build
>cmake --build build --config RelWithDebInfo

Usage examples

Usage examples can be found in the examples directory. To compile them you need to configure with --enable-examples.

To compile the Schnorr signature, ECDH and MuSig examples, you need to enable the corresponding module by providing a flag to the configure script, for example --enable-module-schnorrsig.

Benchmark

If configured with --enable-benchmark (which is the default), binaries for benchmarking the libsecp256k1-zkp functions will be present in the root directory after the build.

To print the benchmark result to the command line:

$ ./bench_name

To create a CSV file for the benchmark result :

$ ./bench_name | sed '2d;s/ \{1,\}//g' > bench_name.csv

Reporting a vulnerability

See SECURITY.md

Contributing to libsecp256k1

See CONTRIBUTING.md

Description
Experimental fork of libsecp256k1 with support for pedersen commitments and range proofs.
Readme 15 MiB
Languages
C 94.5%
Python 2%
CMake 0.9%
Sage 0.8%
M4 0.7%
Other 1%