{"library":"py-ecc","title":"py-ecc","description":"py-ecc is a pure-Python library for elliptic curve cryptography, offering implementations for curves like secp256k1 (used in Bitcoin and Ethereum), alt_bn128, and bls12_381. Currently at version 8.0.0, the library is actively maintained with releases tied to evolving cryptographic standards, especially for BLS.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install py-ecc"],"cli":null},"imports":["from py_ecc.secp256k1 import privtopub, ecsign, ecrecover, N","from py_ecc.bls.basic_scheme import KeyGen, Sign, Verify","from py_ecc.bn128 import G1, G2, multiply, add, pairing"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom py_ecc.secp256k1 import privtopub, ecsign, ecrecover, N\n\n# 1. Generate a private key\n# In a real application, use a cryptographically secure random source (e.g., from a KDF or secure RNG)\nprivkey = int(os.urandom(32).hex(), 16) % N\nprint(f\"Private Key: {hex(privkey)}\")\n\n# 2. Derive the public key\npubkey = privtopub(privkey)\nprint(f\"Public Key (uncompressed, X, Y tuple): {pubkey}\")\n\n# 3. Create a message hash (must be 32 bytes)\nmsg_hash = int.from_bytes(os.urandom(32), 'big')\nprint(f\"Message Hash: {hex(msg_hash)}\")\n\n# 4. Sign the message\nv, r, s = ecsign(msg_hash, privkey)\nprint(f\"Signature: v={v}, r={hex(r)}, s={hex(s)}\")\n\n# 5. Recover the public key from the signature\nrecovered_pubkey = ecrecover(msg_hash, v, r, s)\nprint(f\"Recovered Public Key: {recovered_pubkey}\")\n\n# 6. Verify the signature\nassert recovered_pubkey == pubkey, \"Signature verification failed!\"\nprint(\"Signature verification successful!\")","lang":"python","description":"This quickstart demonstrates how to generate a secp256k1 private key, derive its public key, sign a message hash, and then verify the signature by recovering the public key.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"8.0.0","pypi_latest":"8.0.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":4,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"40.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.5,"import_time_s":null,"mem_mb":null,"disk_size":"42M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"43.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.8,"import_time_s":null,"mem_mb":null,"disk_size":"45M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"35.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":"37M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"35.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.3,"import_time_s":null,"mem_mb":null,"disk_size":"37M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"39.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"py-ecc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.2,"import_time_s":null,"mem_mb":null,"disk_size":"41M"}]}}