python-bitcoinlib
The Swiss Army Knife of the Bitcoin protocol.
What it is and what it does
python-bitcoinlib is a low-level Python library for working directly with Bitcoin protocol internals. It provides data structures and tools for manipulating transactions, scripts, keys, serialization, and blockchain parameters, with a design philosophy that mirrors the Bitcoin codebase closely. The library separates consensus-critical code from non-consensus modules like RPC support, wallet utilities, and network communication.
The package is designed for developers who need to build tools that interact with Bitcoin at the protocol level—parsing transactions, validating scripts, constructing custom transactions, or communicating with nodes via RPC. It handles low-level details like endianness conversions and immutable/mutable object distinctions. The library requires libssl-dev and works with v24.0 or later for RPC functionality.
Use it for:
- Build custom Bitcoin transaction builders or signers that need to manipulate transaction internals
- Parse and validate Bitcoin scripts or create custom script logic
- Interact with a node via RPC to query blockchain data or submit transactions
- Implement Bitcoin address generation, key management, or wallet-related functionality
- Analyze Bitcoin protocol data structures or implement consensus-critical validation logic
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides low-level Python tools to work with Bitcoin data structures, transactions, scripts, and the Bitcoin protocol, including RPC interface support for Bitcoin Core.
Yes, if you need low-level Bitcoin protocol manipulation in Python. The library has no runtime dependencies, low install friction, and an active if aging maintenance status. The copyleft license is straightforward for open-source use. However, the last release was 2023-06-03 and updates are infrequent—verify compatibility with your Python version and requirements before relying on it for production systems.
Install
python-bitcoinlib on PyPI
pip
pip install python-bitcoinlibuv
uv add python-bitcoinlibpoetry
poetry add python-bitcoinlibInstalling python-bitcoinlib
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 2023-06-03 and last commit 2025-03-14—so updates are infrequent but the repository remains active and not archived.
License in practice
Licensed under LGPLv3+, a copyleft license. Any derivative work or modification must be distributed under compatible terms; linking from proprietary code is permitted if the library remains separate.
Quickstart
pip install python-bitcoinlib
from python_bitcoinlib.core import x, lx, b2x
# Work with Bitcoin data structures and protocol
Requires libssl-dev system library. Bitcoin Core v24.0 or later for RPC interface compatibility.
Verify before relying
- Whether the package works with modern Python versions given no explicit requires_python constraint
- Current state of the 'in flux' modules and their production readiness
- Whether consensus-critical code has been audited for correctness against current Bitcoin Core
Package facts
| License | not declared (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 1,168 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 420,420/month — #6,791 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_bitcoinlib-0.12.2-py3-none-any.whl
Keywords: bitcoin
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
dictknifedictknife provides utility functions for…
permissive · top 15,000 on PyPI
python-bitcoinrpcProvides a JSON-RPC client library for…
copyleft · top 15,000 on PyPI
bitcoin-utilsA low-level Bitcoin library providing tools to…
permissive · top 15,000 on PyPI
opentimestampsA Python library for creating and verifying…
copyleft · top 15,000 on PyPI
bip32Implements BIP 32 hierarchical deterministic…
permissive · top 15,000 on PyPI
xrpl-pyA pure Python library for building applications…
permissive · top 15,000 on PyPI
slip10Implements SLIP-0010 hierarchical deterministic…
permissive · top 15,000 on PyPI
coincurvecoincurve provides Python bindings to…
permissive · top 5,000 on PyPI
forex-pythonFetches current and historical foreign exchange…
permissive · top 15,000 on PyPI
bitarray-hardbyteProvides an efficient C-backed array type for…
permissive · top 15,000 on PyPI