dc0bda5731bench: Port bitcoin-core/secp256k1#1796 to zkp-specific code (mllwchrry)fe48cc9fa5generator: Port bitcoin-core/secp256k1#1764 to zkp-specific code (mllwchrry)d111d31293generator: Port bitcoin-core/secp256k1#1779 to zkp-specific code (mllwchrry)d8e87e45f3unit_test: bump MAX_ARGS from 150 to 200 (mllwchrry)2542b43451modules: Port bitcoin-core/secp256k1#1774 to zkp-specific code (mllwchrry)ae7eb729c0release cleanup: bump version after 0.7.1 (Jonas Nick)20a209f11crelease: prepare for 0.7.1 (Jonas Nick)c4b6a81a60changelog: update in preparation for the v0.7.1 release (Jonas Nick)c09215f7afbench: fail early if user inputs invalid value for SECP256K1_BENCH_ITERS (kevkevinpal)29ac4d8491sage: verify Eisenstein integer connection for GLV constants (Justsomebuddy)bd5ced1fe1doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult (kevkevinpal)2f73e5281dgroup: Avoid using infinity field directly in other modules (Tim Ruffing)0406cfc4d1doc: include arg -DUSE_EXTERNAL_DEFAULT_CALLBACKS=1 for cmake (kevkevinpal)ae00c552dfAdd VERIFY_CHECKs that flags are 0 or 1 (John Moffett)3b5b03f301doc/bench: Added cmake build options to bench error messages (kevkevinpal)d822b29021test: split monolithic ellswift test into independent cases (furszy)3daab83a60refactor: remove ret from secp256k1_ec_pubkey_serialize (kevkevinpal)8bcda186d2test: Add non-NULL checks for "pointer of array" API functions (Sebastian Falbesoner)5a08c1bcdcAdd ARG_CHECKs to ensure "array of pointers" elements are non-NULL (Sebastian Falbesoner)f5e815f430remove secp256k1_eckey_pubkey_serialize function (Sebastian Falbesoner)0d3659c547use new `_eckey_pubkey_serialize{33,65}` functions in modules (ellswift,musig) (Sebastian Falbesoner)adb76f82eause new `_eckey_pubkey_serialize{33,65}` functions in public API (Sebastian Falbesoner)fc7458ca3eintroduce `secp256k1_eckey_pubkey_serialize{33,65}` functions (Sebastian Falbesoner)26166c4f5fecmult_multi: reduce strauss memory usage by 30% (Jonas Nick)f252da7e6eci: Use Python virtual environment in "x86_64-macos-native" job (Hennadii Stepanov)153eea20c2bench: Use `ALIGNMENT` macro instead of hardcoded value (Hennadii Stepanov) Pull request description: Merge bitcoin-core/secp256k1#1763: bench: Use `ALIGNMENT` macro instead of hardcoded value Merge bitcoin-core/secp256k1#1771: ci: Use Python virtual environment in "x86_64-macos-native" job Merge bitcoin-core/secp256k1#1761: ecmult_multi: reduce strauss memory usage by 30% Merge bitcoin-core/secp256k1#1774: refactor: split up internal pubkey serialization function into compressed/uncompressed variants Merge bitcoin-core/secp256k1#1779: Add ARG_CHECKs to ensure "array of pointers" elements are non-NULL Merge bitcoin-core/secp256k1#1784: refactor: remove ret from secp256k1_ec_pubkey_serialize Merge bitcoin-core/secp256k1#1788: test: split monolithic ellswift test into independent cases Merge bitcoin-core/secp256k1#1778: doc/bench: Added cmake build options to bench error messages Merge bitcoin-core/secp256k1#1783: Add VERIFY_CHECKs and documentation that flags must be 0 or 1 Merge bitcoin-core/secp256k1#1790: doc: include arg -DSECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS=ON for cmake Merge bitcoin-core/secp256k1#1764: group: Avoid using infinity field directly in other modules Merge bitcoin-core/secp256k1#1793: doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult Merge bitcoin-core/secp256k1#1800: sage: verify Eisenstein integer connection for GLV constants Merge bitcoin-core/secp256k1#1796: bench: fail early if user inputs invalid value for SECP256K1_BENCH_ITERS Merge bitcoin-core/secp256k1#1808: Prepare for 0.7.1 Merge bitcoin-core/secp256k1#1809: release cleanup: bump version after 0.7.1 This PR can be recreated with `./contrib/sync-upstream.sh -b master range c7a52400`. Tips: * Use `git show --remerge-diff <pr-branch>` to show the conflict resolution in the merge commit. * Use `git read-tree --reset -u <pr-branch>` to replay these resolutions during the conflict resolution stage when recreating the PR branch locally. Be aware that this may discard your index as well as the uncommitted changes and untracked files in your worktree. ACKs for top commit: real-or-random: ACKdc0bda5731Tree-SHA512: a816729a8d3ce199154a1b670172f4639b03812071fd78db8e23dfad9a88a2fef882f30c9f34e1151ad79b85201fbb7eba890a572d68bb45ca8fb05496bc34e8
c8206b1c b6c2a3cd e7f7083b be5e4f02 5c751833 540fec8a aa2a39c1 8d445730 f9a944ff 2d9137ce 4721e077 471e3a13 ebb35882 1a53f496 c7a52400 ' into temp-merge-1809
b4756543 10dab907 58178851 de6af6ae baa26542 2b7337f6 a44a3393 f44c1ebd d543c0d9 43e7b115 7a2fff85 ' into temp-merge-1758
0cdc758a ec329c25 8deef00b f79f46c7 00774d07 2e3bf136 c0d9480f ' into temp-merge-1654
c8206b1c b6c2a3cd e7f7083b be5e4f02 5c751833 540fec8a aa2a39c1 8d445730 f9a944ff 2d9137ce 4721e077 471e3a13 ebb35882 1a53f496 c7a52400 ' into temp-merge-1809
13906b71 4187a466 bb597b3d 9fab4252 92394476 201b2b8f f24b838b 95db29b1 2a9d3747 a28c2ffa 746e36b1 ' into temp-merge-1678
c8206b1c b6c2a3cd e7f7083b be5e4f02 5c751833 540fec8a aa2a39c1 8d445730 f9a944ff 2d9137ce 4721e077 471e3a13 ebb35882 1a53f496 c7a52400 ' into temp-merge-1809
c8206b1c b6c2a3cd e7f7083b be5e4f02 5c751833 540fec8a aa2a39c1 8d445730 f9a944ff 2d9137ce 4721e077 471e3a13 ebb35882 1a53f496 c7a52400 ' into temp-merge-1809
b4756543 10dab907 58178851 de6af6ae baa26542 2b7337f6 a44a3393 f44c1ebd d543c0d9 43e7b115 7a2fff85 ' into temp-merge-1758
b4756543 10dab907 58178851 de6af6ae baa26542 2b7337f6 a44a3393 f44c1ebd d543c0d9 43e7b115 7a2fff85 ' into temp-merge-1758
libsecp256k1-zkp
A fork of libsecp256k1 with support for advanced and experimental features
Added features:
- Experimental module for ECDSA adaptor signatures.
- Experimental module for ECDSA sign-to-contract.
- 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
Obtaining and verifying
The git tag for each release (e.g. v0.6.0) is GPG-signed by one of the maintainers.
For a fully verified build of this project, it is recommended to obtain this repository
via git, obtain the GPG keys of the signing maintainer(s), and then verify the release
tag's signature using git.
This can be done with the following steps:
- Obtain the GPG keys listed in SECURITY.md.
- If possible, cross-reference these key IDs with another source controlled by its owner (e.g. social media, personal website). This is to mitigate the unlikely case that incorrect content is being presented by this repository.
- Clone the repository:
git clone https://github.com/bitcoin-core/secp256k1 - Check out the latest release tag, e.g.
git checkout v0.6.0 - Use git to verify the GPG signature:
% git tag -v v0.6.0 | grep -C 3 'Good signature' gpg: Signature made Mon 04 Nov 2024 12:14:44 PM EST gpg: using RSA key 4BBB845A6F5A65A69DFAEC234861DBF262123605 gpg: Good signature from "Jonas Nick <jonas@n-ck.net>" [unknown] gpg: aka "Jonas Nick <jonasd.nick@gmail.com>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 36C7 1A37 C9D9 88BD E825 08D9 B1A7 0E4F 8DCD 0366 Subkey fingerprint: 4BBB 845A 6F5A 65A6 9DFA EC23 4861 DBF2 6212 3605
Building with Autotools
$ ./autogen.sh # Generate a ./configure script
$ ./configure # Generate a build system
$ make # Run the actual build process
$ make check # Run the test suite
$ sudo make install # Install the library into the system (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-rangeproof.
Building with CMake
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
$ cmake -B build # Generate a build system in subdirectory "build"
$ cmake --build build # Run the actual build process
$ ctest --test-dir build # Run the test suite
$ sudo cmake --install build # Install the library into the system (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 -B build -LH or ccmake -B build 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 -B build -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 -B build -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
Building on Windows
The following example assumes Visual Studio 2022. Using clang-cl is recommended.
In "Developer Command Prompt for VS 2022":
>cmake -B build -T ClangCL
>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.
- ECDSA example
- Schnorr signatures example
- Deriving a shared secret (ECDH) example
- ElligatorSwift key exchange example
- MuSig2 Schnorr multi-signatures example
To compile the examples, make sure the corresponding modules are enabled.
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