BSV BLOCKCHAIN | Software Development Kit for Python
Project description
BSV SDK
Welcome to the BSV Blockchain Libraries Project, the comprehensive Python SDK designed to provide an updated and unified layer for developing scalable applications on the BSV Blockchain. This SDK addresses the limitations of previous tools by offering a fresh, peer-to-peer approach, adhering to SPV, and ensuring privacy and scalability.
Table of Contents
- Objective
- Getting Started
- Features & Deliverables
- Documentation
- Tutorial
- Contribution Guidelines
- Support & Contacts
Objective
The BSV Blockchain Libraries Project aims to structure and maintain a middleware layer of the BSV Blockchain technology stack. By facilitating the development and maintenance of core libraries, it serves as an essential toolkit for developers looking to build on the BSV Blockchain.
Getting Started
Requirements
Python 3.9 or higher pip package manager
Installation
pip install bsv-sdk
Basic Usage
import asyncio
from bsv import (
PrivateKey, P2PKH, Transaction, TransactionInput, TransactionOutput
)
# Replace with your private key (WIF format)
PRIVATE_KEY = 'KyEox4cjFbwR---------VdgvRNQpDv11nBW2Ufak'
# Replace with your source tx which contains UTXO that you want to spend (raw hex format)
SOURCE_TX_HEX = '01000000018128b0286d9c6c7b610239bfd8f6dcaed43726ca57c33aa43341b2f360430f23020000006b483045022100b6a60f7221bf898f48e4a49244e43c99109c7d60e1cd6b1f87da30dce6f8067f02203cac1fb58df3d4bf26ea2aa54e508842cb88cc3b3cec9b644fb34656ff3360b5412102cdc6711a310920d8fefbe8ee73b591142eaa7f8668e6be44b837359bfa3f2cb2ffffffff0201000000000000001976a914dd2898df82e086d729854fc0d35a449f30f3cdcc88acce070000000000001976a914dd2898df82e086d729854fc0d35a449f30f3cdcc88ac00000000'
async def create_and_broadcast_transaction():
priv_key = PrivateKey(PRIVATE_KEY)
source_tx = Transaction.from_hex(SOURCE_TX_HEX)
tx_input = TransactionInput(
source_transaction=source_tx,
source_txid=source_tx.txid(),
source_output_index=1,
unlocking_script_template=P2PKH().unlock(priv_key),
)
tx_output = TransactionOutput(
locking_script=P2PKH().lock(priv_key.address()),
change=True
)
tx = Transaction([tx_input], [tx_output], version=1)
tx.fee()
tx.sign()
await tx.broadcast()
print(f"Transaction ID: {tx.txid()}")
print(f"Raw hex: {tx.hex()}")
if __name__ == "__main__":
asyncio.run(create_and_broadcast_transaction())
For a more detailed tutorial and advanced examples, check our Documentation.
Features & Deliverables
Advanced Transaction Building:
- Support for P2PKH, P2PK, OP_RETURN, and BareMultisig scripts
- Automated fee calculation and change output management
- Custom script development
- Support for various SIGHASH types
HD Wallet Capabilities:
- Full BIP32/39/44 implementation for hierarchical deterministic wallets
- Multiple language support for mnemonic phrases (English, Chinese)
- Advanced key derivation and management
SPV & Validation:
- Built-in SPV verification with BEEF format support
- Merkle proof validation
- Efficient transaction broadcast with Arc
- Support for chain tracking and verification
Documentation
Detailed documentation of the SDK with code examples can be found at BSV Skills Center.
You can also refer to the User Test Report for insights and feedback provided by Yenpoint.
Beginner Tutorial
Step-by-Step BSV Tutorial: Sending BSV and NFTs
This beginner-friendly guide will walk you through sending BSV (Bitcoin SV) and creating NFTs using the BSV Python SDK. We'll take it step-by-step so you can learn at your own pace.
Contribution Guidelines
We're always looking for contributors to help us improve the project. Whether it's bug reports, feature requests, or pull requests - all contributions are welcome.
- Fork & Clone: Fork this repository and clone it to your local machine.
- Set Up: Run
pip install -r requirements.txtto install all dependencies. - Make Changes: Create a new branch and make your changes.
- Test: Ensure all tests pass by running
pytest --cov=bsv --cov-report=html. - Commit: Commit your changes and push to your fork.
- Pull Request: Open a pull request from your fork to this repository.
For more details, check the contribution guidelines.
Support & Contacts
Project Owners: Thomas Giacomo and Darren Kellenschwiler Development Team Lead: sCrypt Maintainer: Ken Sato @ Yenpoint inc. & Yosuke Sato @ Yenpoint inc. For questions, bug reports, or feature requests, please open an issue on GitHub or contact us directly.
License
The license for the code in this repository is the Open BSV License. Refer to LICENSE.txt for the license text.
Thank you for being a part of the BSV Blockchain ecosystem. Let's build the future of BSV Blockchain together!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bsv_sdk-1.0.11.tar.gz.
File metadata
- Download URL: bsv_sdk-1.0.11.tar.gz
- Upload date:
- Size: 111.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dff3e0ebbd4a90e3c84c275a66c3ca029139c2fc2be38e1b936542bdd8acc65f
|
|
| MD5 |
84a770fa08d2eef0af3778572113f972
|
|
| BLAKE2b-256 |
71ce6a70b42625e93b34a08f4613239964cc55395f0b513f8bb5fd8185d91328
|
File details
Details for the file bsv_sdk-1.0.11-py3-none-any.whl.
File metadata
- Download URL: bsv_sdk-1.0.11-py3-none-any.whl
- Upload date:
- Size: 81.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7400908e67f5af510366b5f96193380ff067f1d1085e5a73b2a7492590c2eca
|
|
| MD5 |
b7101d921b4ffa535331716e7f859e36
|
|
| BLAKE2b-256 |
97d1ca01c4532aa7af3e330c8c85c72db3fd90bc49c6742c2e66bb2fded565e9
|