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.3.tar.gz
(2.8 MB
view hashes)
Built Distribution
Close
Hashes for bdkpython-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d714239d5b5745cd0ce3997372b92b6e79a31f695f84bd85d663a4bf1c729c7 |
|
MD5 | b24d50da984fb482580834c656bc6521 |
|
BLAKE2b-256 | ce6442f6a88bbe64b1803cfb44e624dca399541c17efe1de69529ee2eda1df5d |