docs: update python readme and examples

This commit is contained in:
thunderbiscuit 2023-11-17 15:47:09 -05:00
parent 0956999283
commit 1ef1c5cc6e
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 1 additions and 35 deletions

View File

@ -15,7 +15,7 @@ pip install --requirement requirements.txt
bash ./scripts/generate-linux.sh # here you should run the script appropriate for your platform
python setup.py bdist_wheel --verbose
pip install ./dist/bdkpython-<yourversion>.whl --force-reinstall
python -m unittest --verbose tests/test_bdk.py
python -m unittest --verbose
```
## Build the package

View File

@ -13,40 +13,6 @@ pip install bdkpython
## Simple example
```python
import bdkpython as bdk
descriptor = bdk.Descriptor("wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/0h/0h/0/*)", bdk.Network.TESTNET)
db_config = bdk.DatabaseConfig.MEMORY()
blockchain_config = bdk.BlockchainConfig.ELECTRUM(
bdk.ElectrumConfig(
"ssl://electrum.blockstream.info:60002",
None,
5,
None,
100,
True,
)
)
blockchain = bdk.Blockchain(blockchain_config)
wallet = bdk.Wallet(
descriptor=descriptor,
change_descriptor=None,
network=bdk.Network.TESTNET,
database_config=db_config,
)
# print new receive address
address_info = wallet.get_address(bdk.AddressIndex.LAST_UNUSED())
address = address_info.address
index = address_info.index
print(f"New BIP84 testnet address: {address} at index {index}")
# print wallet balance
wallet.sync(blockchain, None)
balance = wallet.get_balance()
print(f"Wallet balance is: {balance.total}")
"""
setup(