{"id":20668665,"url":"https://github.com/btclib-org/btclib","last_synced_at":"2025-05-16T04:04:10.517Z","repository":{"id":44310876,"uuid":"133639679","full_name":"btclib-org/btclib","owner":"btclib-org","description":"btclib: a python3 library for 'bitcoin cryptography'","archived":false,"fork":false,"pushed_at":"2025-05-05T20:18:49.000Z","size":17427,"stargazers_count":114,"open_issues_count":5,"forks_count":44,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-05T21:28:26.032Z","etag":null,"topics":["base58","bech32","bip32","bip340","bip39","bitcoin","cryptography","ecdsa","electrum","elliptic-curves","message-signing","psbt","rfc-6979","schnorr","segwit","taproot"],"latest_commit_sha":null,"homepage":"https://btclib.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btclib-org.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-16T09:08:50.000Z","updated_at":"2025-04-25T19:06:08.000Z","dependencies_parsed_at":"2023-10-03T18:44:08.027Z","dependency_job_id":"c21853c5-fcd9-4f55-bb37-204a780c2dda","html_url":"https://github.com/btclib-org/btclib","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btclib-org%2Fbtclib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btclib-org%2Fbtclib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btclib-org%2Fbtclib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btclib-org%2Fbtclib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btclib-org","download_url":"https://codeload.github.com/btclib-org/btclib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464891,"owners_count":22075570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base58","bech32","bip32","bip340","bip39","bitcoin","cryptography","ecdsa","electrum","elliptic-curves","message-signing","psbt","rfc-6979","schnorr","segwit","taproot"],"created_at":"2024-11-16T20:10:39.078Z","updated_at":"2025-05-16T04:04:10.497Z","avatar_url":"https://github.com/btclib-org.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Python library for 'bitcoin cryptography'\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n| | |\n| --- | --- |\n| Project | [![status](https://img.shields.io/pypi/status/btclib.svg)](https://pypi.python.org/pypi/btclib/) [![license](https://img.shields.io/github/license/btclib-org/btclib.svg)](https://github.com/btclib-org/btclib/blob/master/LICENSE) |\n| Package | [![calver: yyy.m.d](https://img.shields.io/badge/cal_ver-yyyy.m.d-1674b1.svg?logo=calver)](https://calver.org/) [![pypi](https://img.shields.io/pypi/v/btclib.svg?logo=pypi)](https://pypi.python.org/pypi/btclib/) [![downloads](https://static.pepy.tech/badge/btclib)](https://pepy.tech/project/btclib) |\n| Supported platforms | [![python](https://img.shields.io/pypi/pyversions/btclib.svg?logo=python)](https://pypi.python.org/pypi/btclib/) |\n| Formatting standards | [![lint: isort](https://img.shields.io/badge/lint-isort-yellowgreen.svg?logo=isort)](https://github.com/PyCQA/isort) [![lint: black](https://img.shields.io/badge/lint-black-yellowgreen.svg?logo=black)](https://github.com/psf/black) [![lint: flake8](https://img.shields.io/badge/lint-flake8-yellowgreen.svg?logo=flake8)](\u003chttps://github.com/PyCQA/flake8\u003e) [![lint: yesqa](https://img.shields.io/badge/lint-yesqa-yellowgreen.svg?logo=yesqa)](\u003chttps://github.com/asottile/yesqa\u003e) [![lint: markdownlint-cli2](https://img.shields.io/badge/lint-markdownlint--cli2-yellowgreen.svg?logo=sourcery)](https://github.com/DavidAnson/markdownlint-cli2) |\n| Coding standards | [![lint: pylint](https://img.shields.io/badge/lint-pylint-yellowgreen.svg?logo=pylint)](https://github.com/PyCQA/pylint) [![lint: autoflake](https://img.shields.io/badge/lint-autoflake-yellowgreen.svg?logo=autoflake)](https://github.com/PyCQA/autoflake) [![lint: pyupgrade](https://img.shields.io/badge/lint-pyupgrade-yellowgreen.svg?logo=pyupgrade)](https://github.com/asottile/pyupgrade)  [![lint: sourcery](https://img.shields.io/badge/lint-sourcery-yellowgreen.svg?logo=sourcery)](https://sourcery.ai) [![security: bandit](https://img.shields.io/badge/security-bandit-yellowgreen.svg?logo=bandit)](https://github.com/PyCQA/bandit) |\n| Type checking | [![type check: mypy](https://img.shields.io/badge/type_check-mypy-yellowgreen.svg?logo=mypy)](http://mypy-lang.org/) [![type check: pyright](https://img.shields.io/badge/type_check-pyright-yellowgreen.svg)](https://github.com/microsoft/pyright)  |\n| Documentation | [![docs](https://readthedocs.org/projects/btclib/badge/?version=latest)](https://btclib.readthedocs.io) [![lint: docformatter](https://img.shields.io/badge/lint-docformatter-yellowgreen.svg?logo=docformatter)](https://github.com/PyCQA/docformatter) [![lint: pydocstringformatter](https://img.shields.io/badge/lint-pydocstringformatter-yellowgreen.svg?logo=pydocstringformatter)](https://github.com/DanielNoord/pydocstringformatter) [![lint: pydocstyle](https://img.shields.io/badge/lint-pydocstyle-yellowgreen.svg?logo=pydocstyle)](https://github.com/PyCQA/pydocstyle)|\n| CI/CD | [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/btclib-org/btclib/master.svg)](https://results.pre-commit.ci/latest/github/btclib-org/btclib/master) [![lint](https://github.com/btclib-org/btclib/actions/workflows/lint.yml/badge.svg)](https://github.com/btclib-org/btclib/actions/workflows/lint.yml) [![test](https://github.com/btclib-org/btclib/actions/workflows/test.yml/badge.svg)](https://github.com/btclib-org/btclib/actions/workflows/test.yml) [![test-py312](https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml/badge.svg)](https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml) [![coverage](https://coveralls.io/repos/github/btclib-org/btclib/badge.svg?logo=coveralls)](https://coveralls.io/github/btclib-org/btclib) |\n| Conversations | [![slack](https://img.shields.io/badge/slack-btclib_dev-white.svg?logo=slack)](https://bbt-training.slack.com/messages/C01CCJ85AES) [![Follow on Twitter](https://img.shields.io/twitter/follow/btclib?style=social\u0026logo=twitter)](https://twitter.com/intent/follow?screen_name=btclib)|\n\n[Browse GitHub Code Repository](https://github.com/btclib-org/btclib/)\n\n---\n\u003c!-- markdownlint-enable MD013 --\u003e\n\n[btclib](https://btclib.org) is a\nPython3 [type annotated](https://docs.python.org/3/library/typing.html)\nlibrary intended for teaching, learning, and using bitcoin;\nthe focus is on elliptic curve cryptography and bitcoin's blockchain.\n\nIt is rigorously and extensively tested: the test suite\n[covers 100%](https://coveralls.io/github/btclib-org/btclib)\nof the code base and reproduces results from both informal\nand major reference sources.\n\nOriginally developed for the\n_[Bitcoin and Blockchain Technology](https://www.ametrano.net/bbt/)_\ncourse at the University of Milano-Bicocca,\nbtclib is not intended for production environments:\nit is often refactored for improved clarity,\nwithout care for backward compatibility; moreover,\nsome of its algorithms could be broken using side-channel attacks.\n\nThe library is not limited to the bitcon elliptic curve secp256k1;\nanyway, FFI bindings to\n[libsecp256k1](https://github.com/bitcoin-core/secp256k1)\n(the optimized C library used by Bitcoin Core)\nare available for this curve and used by default.\n\nIncluded features are:\n\n- modulo algebra functions (gcd, inverse, legendre symbol, square root)\n- octets / integer / point / var_int / var_bytes helper functions\n- elliptic curve class\n    - fast algebra implemented using Jacobian coordinates\n    - double scalar multiplication (Straus's algorithm, also known as\n      Shamir's trick)\n    - multi scalar multiplication (Bos-coster's algorithm)\n    - point simmetry solution: odd/even, low/high, and quadratic residue\n    - elliptic curves: SEC 1 v1 and v2, NIST, Brainpool, and\n      low cardinality test curves\n- ECDSA signature with (transaction) DER encoding\n- ECDSA signature with (message) compact encoding: standard p2pkh and\n  [BIP137](https://github.com/bitcoin/bips/blob/master/bip-0137.mediawiki)/[Electrum](https://electrum.org/#home)\n  extensions to p2wpkh and p2wpkh-p2sh\n- [RFC 6979](https://tools.ietf.org/html/rfc6979) for deterministic signature\n  schemes\n- EC Schnorr signature (according to\n  [BIP340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)\n  bitcoin standardization)\n    - batch validation\n    - threshold signature (see test-suite)\n    - MuSig multi-signature (see test-suite)\n- Borromean ring signature\n- Sign-to-contract commitment\n- Diffie-Hellman\n- Pedersen committment\n- Base58 encoding/decoding\n- p2pkh/p2sh addresses and WIFs\n- Bech32 encoding/decoding\n- p2wpkh/p2wsh native SegWit addresses and their legacy p2sh-wrapped versions\n- [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)\n  hierarchical deterministic key chains\n- [SLIP132](https://github.com/satoshilabs/slips/blob/master/slip-0132.md)\n  key versions (xprv, yprv, zprv, Yprv, Zprv, tprv, uprv, vprv, and Uprv)\n  with corresponding mapping to\n  p2pkh/p2sh, p2wpkh-p2sh, p2wpkh, p2wsh-p2sh, p2wsh and p2tr addresses\n- [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)\n  wordlists and mnemonic for generating deterministic keys\n- [Electrum](https://electrum.org/#home) standard for mnemonic\n- Script encoding/decoding\n- nulldata, p2pk, p2ms, p2pkh, p2sh, p2wpkh, p2wsh and p2tr ScriptPubKeys\n- BlockHeader and Block data classes\n- OutPoint, TxIn, TxOut, and TX data classes\n- legacy, segwit_v0 and taproot transaction hash signatures\n- [BIP174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki)\n  partially signed bitcoin transactions (PSBT):\n  PsbtIn, PbstOut, and Psbt data classes\n\n---\n\nTo install (and/or upgrade) btclib:\n\n```shell\npython -m pip install --upgrade btclib\n```\n\nYou might want to install btclib into a\npython virtual environment; e.g. from the root folder:\n\nShell:\n\n```shell\npython -m venv venv_btclib\nsource ./venv_btclib/bin/activate\npython -m pip install --upgrade btclib\n```\n\nWindows CMD or PowerShell:\n\n```powershell\npython -m venv venv_btclib\n.\\venv_btclib\\Scripts\\activate\npython -m pip install --upgrade btclib\n```\n\nWindows Git bash shell:\n\n```bash\npython -m venv venv_btclib\ncd ./venv_btclib/Scripts\n. activate\ncd ../..\npython -m pip install --upgrade btclib\n```\n\nSee [CONTRIBUTING](./CONTRIBUTING.md) if you are interested\nin btclib develoment.\n\nSee [SECURITY](./SECURITY.md) if you have found a security vulnerability.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtclib-org%2Fbtclib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtclib-org%2Fbtclib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtclib-org%2Fbtclib/lists"}