Coincurve is a Python library providing fast and secure bindings for libsecp256k1, the highly optimized C library used by Bitcoin Core for elliptic curve cryptography operations. It offers a clean, easy-to-use API for tasks like key generation, signing, and verification. The current version is 21.0.0, and it maintains frequent updates to libsecp256k1.
pip install coincurveVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to generate a secp256k1 private key, derive its public key, sign a hashed message, and verify the signature using `coincurve`. Note that `private_key.sign()` produces a DER-encoded signature expected by `verify_signature`.
Upgrade Python to 3.9 or newer. Alternatively, pin `coincurve<21.0.0` if Python upgrade is not feasible.
Ensure CMake is installed and discoverable in your build environment. For standard `pip install`, no explicit action is usually required.
Upgrade to a 64-bit Windows environment or pin `coincurve<20.0.0`.
Use `PrivateKey.sign()` when verifying with `coincurve.verify_signature()`. If you need recoverable signatures, verify them using `PublicKey.verify()` if applicable, or recover the public key first and then verify (more complex).
Pin your `coincurve` dependency to `coincurve==20.0.0` or `coincurve!=21.0.0` until a patched version is released. Or, consider updating to a newer working version if available.
Pin `coincurve` to an older, stable version like `20.0.0` using `pip install coincurve==20.0.0` to avoid the buggy version.
Install the necessary system dependencies before running `pip install coincurve`. For Debian/Ubuntu, use `sudo apt-get install -y autoconf automake build-essential libffi-dev libtool pkg-config python3-dev`. For other operating systems, consult the `coincurve` documentation for equivalent packages.
Ensure `coincurve` is installed in your current Python environment by running `pip install coincurve`. If problems persist, verify you are using the correct Python interpreter or try reinstalling with `pip install --no-cache-dir coincurve` after ensuring all system build dependencies are met.
This is often a symptom of the 'Could not build wheels' error. Ensure all necessary system build dependencies (like `build-essential`, `libffi-dev`, `python3-dev`) are installed on your system, then try reinstalling `coincurve` using `pip install coincurve --no-cache-dir --force-reinstall`.
Use `coincurve`'s dedicated serialization or deserialization functions to convert byte strings into the appropriate CFFI `cdata` types. For example, to handle recoverable signatures, use `coincurve.ecdsa.deserialize_recoverable(signature_bytes)` before passing it to other functions.
No dependency data recorded yet.