The Python language bindings for the bitcoindevkit
Project description
bdkpython
The Python language bindings for the bitcoindevkit.
Install the package
pip install bdkpython
Simple examples
Generate a testnet address
import bdkpython as bdk
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/1h/0h/0/*)"
config = bdk.DatabaseConfig.MEMORY("")
wallet = bdk.OfflineWallet(descriptor, bdk.Network.TESTNET, config)
address = wallet.get_new_address()
print(f"New BIP84 testnet address: {address}")
Sync a wallet using Electrum
import bdkpython as bdk
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/1h/0h/0/*)"
config = bdk.DatabaseConfig.MEMORY("")
client = bdk.BlockchainConfig.ELECTRUM(
bdk.ElectrumConfig(
"ssl://electrum.blockstream.info:60002",
None,
5,
None,
100
)
)
wallet = bdk.OnlineWallet(
descriptor=descriptor,
change_descriptor=descriptor,
network=bdk.Network.TESTNET,
database_config=config,
blockchain_config=client
)
class LogProgress(bdk.BdkProgress):
def update(self, progress, update):
pass
wallet.sync(progress_update=LogProgress(), max_address_param=20)
balance = wallet.get_balance()
print(f"Wallet balance is: {balance}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bdkpython-0.0.4.tar.gz
(10.0 MB
view hashes)
Built Distribution
bdkpython-0.0.4-py3-none-any.whl
(10.1 MB
view hashes)
Close
Hashes for bdkpython-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a967e9847081ec9240d14468b7fe07c72063f7901556a65977b8d9ef9f8f3b9 |
|
MD5 | d056c72b0d56fe4d6460e840aad75a91 |
|
BLAKE2b-256 | b31c8abb23528d479d04ad038e3d35105a792d1cf223d014cb72aa5bf0c60e33 |