bitcoin-libraries-python-bitcoinlib

v2026.09.24

python-bitcoinlib by Peter Todd: low-level Bitcoin primitives in Python. Tx, Script, Address, key types, RPC client. USE WHEN: scripting Bitcoin operations in Python, low-level manipulation, Bitcoin Core RPC integration.

GitHub
安装命令
npx skhub add claude-dev-suite/bitcoin-libraries-python-bitcoinlib
Markdown
SKILL.md

python-bitcoinlib

Long-standing low-level Python Bitcoin library by Peter Todd.

Repo: github.com/petertodd/python-bitcoinlib.

Status (as of September 2026)

Effectively dormant. Check this before picking it for new work.

  • Latest release: 0.12.2, 3 June 2023 (PyPI). master still declares __version__ = '0.12.2', so the unreleased tip is not ahead by a version.
  • Last commit on master: 14 March 2025. The repo is not archived (38 open issues and 23 open pull requests as of September 2026) but has had no upstream activity for eighteen months.
  • No Taproot. bitcoin/wallet.py has no P2TR address class, bitcoin/bech32.py carries no bech32m constant, and bitcoin/core/script.py defines only SIGVERSION_BASE and SIGVERSION_WITNESS_V0 — no taproot sighash, no OP_CHECKSIGADD.
  • No PSBT. There is no BIP174 module in the package; PSBTv2 (BIP370) is likewise absent.
  • The README pins bitcoin.rpc support at "Bitcoin Core v24.0 or later" and has not revised that baseline since, so RPC shape changes in Core majors after v24 are untested upstream.

Still sound for legacy and segwit-v0 byte-level work and as a thin bitcoind JSON-RPC client. For Taproot, PSBT or descriptor wallets reach for bdkpython (3.1.0, 9 September 2026) instead. python-bitcointx (Simplexum) is the low-level fork that went further on taproot script handling, but it is dormant too — last release 1.1.5, 22 January 2024.

Install

pip install python-bitcoinlib

Quick examples

from bitcoin.core import CTransaction, COIN, lx, b2lx
from bitcoin.core.script import CScript, OP_CHECKSIG
from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret
from bitcoin import SelectParams

SelectParams("mainnet")

# Address from secret
sk = CBitcoinSecret.from_secret_bytes(b"\x01" * 32)
print(sk.pub.to_addr())

# Decode tx
import bitcoin
tx = CTransaction.deserialize(bytes.fromhex("0100..."))
print(b2lx(tx.GetTxid()))   # txid

# RPC client
from bitcoin.rpc import Proxy
rpc = Proxy()
print(rpc.getblockchaininfo())

Submodules

  • bitcoin.core — Tx, Block, Script.
  • bitcoin.wallet — Address, key encoding.
  • bitcoin.rpc — JSON-RPC client.
  • bitcoin.signmessage — BIP137 message signing.

Compared

Aspectpython-bitcoinlibbitcoinlibembit
StyleFunctional / OOOOEmbedded-friendly
First PyPI release0.1.1, May 20140.3.33a0, Feb 20180.1.0, Oct 2020
Latest release (Sept 2026)0.12.2, Jun 20230.7.9, Jun 20260.8.0, May 2024
CoverageLow-levelHigh-level walletEmbedded HW signing

Of the three, only bitcoinlib is still shipping releases as of September 2026 (0.7.9, 5 June 2026). embit carries git tags v0.8.1 and v0.8.2 that were never published, so pip install embit resolves to 0.8.0.

Use cases

  • Scripts manipulating raw txs.
  • Custom signing flows.
  • Integrating with bitcoind RPC from Python.

Common pitfalls

  • Network selection global; test isolation requires SelectParams.
  • Hex byte-order: most APIs use internal byte order; lx / b2lx convert to/from RPC display order.

See also

发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

Sep 24, 2026

分类

未分类

许可证

MIT

源路径

skills/bitcoin/libraries/python-bitcoinlib

默认分支

main

最新提交

9496306

Tree SHA

fe4e2f1