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
andp2tr
(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
andsignet
, which intentionally have no value.
This repository comes with zero guarantees, use at your own risk.
$ pip3 install buidl --upgrade
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
is a stateless CLI multisig PSBT wallet.
Since buidl
has no dependencies, you can run multiwallet by just cd
ing 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.
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 .
You can speed this library up ~100x by using C-bindings to bitcoin core's libsecp256k1
library.
Use brew to install libsecp256k1
:
$ brew tap buidl-bitcoin/homebrew-libsecp256k1
$ brew install pkg-config libffi libsecp256k1
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
$ 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')"