a8e6a3cc34Port bitcoin-core/secp256k1#1628 to zkp public API (mllwchrry)694342fdb7Name public API structs (Ava Chow)0f73caf7c6test, ci: Lower default iteration count to 16 (Hennadii Stepanov)87384f5c0fcmake, test: Add `secp256k1_` prefix to test names (Hennadii Stepanov)980c08df80util: Remove unused (u)int64_t formatting macros (Tim Ruffing)096e3e23f6ci: Update macOS image (Hennadii Stepanov)57eda3ba30musig: ctimetests: fix _declassify range for generated nonce points (Sebastian Falbesoner)447334cb06include: Avoid visibility("default") on Windows (Tim Ruffing)8be3839fb2Remove unused scratch space from API (Jonas Nick)c232486d84Revert "cmake: Set `ENVIRONMENT` property for examples on Windows" (Hennadii Stepanov)26e4a7c214cmake: Set top-level target output locations (Hennadii Stepanov)5bab8f6d3cexamples: make key generation doc consistent (Jonas Nick)e8908221a4examples: do not retry generating seckey randomness in musig (Jonas Nick)70b6be1834extrakeys: improve doc of keypair_create (don't suggest retry) (Jonas Nick)cd4f84f3baImprove examples/documentation: remove key generation loops (cheapshot003)ef7ff03407f can never equal -m (Russell O'Connor) Pull request description: Merge bitcoin-core/secp256k1#1603: f can never equal -m Merge bitcoin-core/secp256k1#1599: #1570 improve examples: remove key generation loop Merge bitcoin-core/secp256k1#1616: examples: do not retry generating seckey randomness in musig Merge bitcoin-core/secp256k1#1553: cmake: Set top-level target output locations Merge bitcoin-core/secp256k1#1620: Remove unused scratch space from API Merge bitcoin-core/secp256k1#1595: build: 45839th attempt to fix symbol visibility on Windows Merge bitcoin-core/secp256k1#1619: musig: ctimetests: fix _declassify range for generated nonce points Merge bitcoin-core/secp256k1#1624: ci: Update macOS image Merge bitcoin-core/secp256k1#1625: util: Remove unused (u)int64_t formatting macros Merge bitcoin-core/secp256k1#1582: cmake, test: Add `secp256k1_` prefix to test names Merge bitcoin-core/secp256k1#1581: test, ci: Lower default iteration count to 16 Merge bitcoin-core/secp256k1#1628: Name public API structs This PR can be recreated with `./contrib/sync-upstream.sh -b master range a38d879a`. 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: ACKa8e6a3cc34Tree-SHA512: 662518c9f569066402d4b5890abe33d7dc9662bcc2006b42ad83cc08f0a2be6ff923a792681a797b191ed7dd7882155c1eadbc8387011e9c5a10d06183cefb56
01b58933 18f9b967 e59158b6 1fae76f5 f0868a9b 68b55209 9b7c59cb 1464f15c 9a8db52f 7d48f5ed a38d879a ' into temp-merge-1628
01b58933 18f9b967 e59158b6 1fae76f5 f0868a9b 68b55209 9b7c59cb 1464f15c 9a8db52f 7d48f5ed a38d879a ' into temp-merge-1628
3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386
01b58933 18f9b967 e59158b6 1fae76f5 f0868a9b 68b55209 9b7c59cb 1464f15c 9a8db52f 7d48f5ed a38d879a ' into temp-merge-1628
01b58933 18f9b967 e59158b6 1fae76f5 f0868a9b 68b55209 9b7c59cb 1464f15c 9a8db52f 7d48f5ed a38d879a ' into temp-merge-1628
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
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-rangeproof.
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 --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.
- ECDSA example
- Schnorr signatures example
- Deriving a shared secret (ECDH) example
- ElligatorSwift key exchange example
To compile the Schnorr signature and ECDH 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