Skip to main content

buidl Bitcoin Library

Python

buidl is a python3 bitcoin library with 0 dependencies. It is easy-to-read, has extensive test coverage, simple to install on airgapped computers (just copy over this directory).

buidl has extensive feature support for the bitcoin blockchain:

  • Trust-minimized - easy-to-read cryptography implemented in straightforward/way with no third-party dependencies
  • Performant - optional secp256k1 library bindings offers a ~100x speedup, see performance section below
  • Wallet tools for various script types (p2pkh, p2sh, p2sh-wrapped-p2wsh, p2wsh and p2tr (coming soon) ), compressed/uncompressed pubkeys, address encodings, HD support (BIP32, BIP39, BIP44, seedpicker, etc), PSBT generation/decoding/validation, etc
  • Extensive multisig support/tooling for output descriptors, receive address validation, change address detection, fee verification, blinding xpubs, PSBTs, BCUR v0 (v1 coming soon), airgap signing, etc
  • SPV proofs and compact block filters (Neutrino) - build powerful trust-minimized apps without scanning the whole blockchain
  • P2P gossip network - connect directly to the bitcoin network
  • Footgun protection - from elegantly structured OOP classes to RFC6979 deterministic k-values, buidl is designed to be usable for non-cryptographers
  • 0 altcoins - for maximum readability/focus. The only other supported coins are bitcoin's testnet and signet, which intentionally have no value.

This repository comes with zero guarantees, use at your own risk.

Installation

Online

$ pip3 install buidl --upgrade

Offline

Download this repo and then run:

$ python3 setup.py install

(alternatively, because buidl has no dependencies you can just cd into this root directory and call buidl without installation)

Multiwallet

multiwallet is a stateless CLI multisig PSBT wallet. Since buidl has no dependencies, you can run multiwallet by just cding to the root directory of this project:

$ python3 multiwallet.py
Welcome to multiwallet...

If you have installed buidl, you can run multiwallet.py from any directory:

$ multiwallet.py
Welcome to multiwallet...

For more information on installing multiwallet, see multiwallet.md or check out this demo.

singlesweep.py works the same way for sweeping out of paper wallets, but is intentionally undocumented.

Tests

Run tests with pytest:

$ git clone https://github.com/buidl-bitcoin/buidl-python.git && cd buidl-python
$ pytest -v

(these will be 1-2 orders of magnitue faster with libsec bindings, see performance section below)

Run black:

$ black . --diff --check

Run flake8:

$ flake8 .

Performance

You can speed this library up ~100x by using C-bindings to bitcoin core's libsecp256k1 library.

libsecp256k1 Dependency Installation

Easy (MacOS only)

Use brew to install libsecp256k1:

$ brew tap buidl-bitcoin/homebrew-libsecp256k1
$ brew install pkg-config libffi libsecp256k1

Hard (Linux/Mac)

Compile libsecp256k1 from scratch with experimental modules enabled to make Schnorr signatures work:

$ git clone https://github.com/bitcoin-core/secp256k1
$ cd secp256k1
$ ./autogen.sh
$ ./configure --enable-module-extrakeys --enable-module-schnorrsig --enable-experimental
$ make
$ sudo make install

buidl Installation

$ git clone git@github.com:buidl-bitcoin/buidl-python.git && cd buidl-python && python3 -m pip install -r requirements-libsec.txt && python3 -m pip install --editable . && cd buidl && python3 libsec_build.py && cd .. && python3 -c "from buidl import *; print('success') if is_libsec_enabled() else print('LIBSEC INSTALL FAIL')"

Metadata

Release files for buidl 0.2.36

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for buidl 0.2.36
File Size Uploaded
buidl-0.2.36.tar.gz 239.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for buidl 0.2.36
File Interpreter ABI Platform
buidl-0.2.36-py3.9.egg Legacy Egg format - - Details
buidl-0.2.36-py3-none-any.whl Python 3 none any Details

Total release size: 1.0 MB

Release files / buidl-0.2.36.tar.gz

Download URL buidl-0.2.36.tar.gz
Size 239.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e3537a33574154e7bce0ca7fbe45b8e512b4473189b0be3ce28e1d3ddf5303f9
BLAKE2b-256 checksum
How to use checksums
3fa2b311f04cd1ae0b6bdba797f836fa6dd070315eb37a1ce1cb7b84d37b86ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

Release files / buidl-0.2.36-py3.9.egg

Download URL buidl-0.2.36-py3.9.egg
Size 542.9 kB
Tags Egg
SHA-256 checksum
How to use checksums
e55d6c16c35b1b136d3831f26336f902baf04fd48f1ddf1579a31428ff098af6
BLAKE2b-256 checksum
How to use checksums
66654457b355e17632308d41bc1b034b796d806514fe69931f3e37782ee56aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

Release files / buidl-0.2.36-py3-none-any.whl

Download URL buidl-0.2.36-py3-none-any.whl
Size 253.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89d00825bc286ae56da31ea3d12853d5cb1ad53c64ad6daa45d791af7df1186d
BLAKE2b-256 checksum
How to use checksums
b05bf1c02f13043a83903c405a33e75cb1ff6a2d0c59299a84b0b894f764d5e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.2.36 This release

3 release files

0.2.34

3 release files

0.2.31

3 release files

0.2.30

3 release files

0.2.29

3 release files

0.2.28

3 release files

0.2.27

3 release files

0.2.26

3 release files

0.2.25

3 release files

0.2.24

3 release files

0.2.23

3 release files

0.2.21

3 release files

0.2.20

3 release files

0.2.15

3 release files

0.2.14

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page