Skip to main content

BSV BLOCKCHAIN | Software Development Kit for Python

Project description

BSV SDK

build PyPI version Python versions

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

  1. Objective
  2. Getting Started
  3. Features & Deliverables
  4. Documentation
  5. Contribution Guidelines
  6. 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

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

  • Main Project Feature: Description of the feature

  • Main Project Feature 2: Description of the feature

  • Secondary Project Feature: Description of the feature

Documentation

Detailed documentation of the SDK with code examples can be found at BSV Skills Center.

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.

  1. Fork & Clone: Fork this repository and clone it to your local machine.
  2. Set Up: Run pip install -r requirements.txt to install all dependencies.
  3. Make Changes: Create a new branch and make your changes.
  4. Test: Ensure all tests pass by running pytest --cov=bsv --cov-report=html.
  5. Commit: Commit your changes and push to your fork.
  6. Pull Request: Open a pull request from your fork to this repository.

For more details, check the contribution guidelines.

For information on past releases, check out the changelog. For future plans, check the roadmap!

Support & Contacts

Project Owners: <names and email addresses>

Development Team Lead: <name and email>

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bsv_sdk-0.5.2.tar.gz (91.3 kB view details)

Uploaded Source

Built Distribution

bsv_sdk-0.5.2-py3-none-any.whl (68.6 kB view details)

Uploaded Python 3

File details

Details for the file bsv_sdk-0.5.2.tar.gz.

File metadata

  • Download URL: bsv_sdk-0.5.2.tar.gz
  • Upload date:
  • Size: 91.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for bsv_sdk-0.5.2.tar.gz
Algorithm Hash digest
SHA256 43c1cd3618ae907b3534d001ff940f21957e4539757b06a3db5d6813e3115d42
MD5 768720e53b7ef031a441d2cd5c2fc831
BLAKE2b-256 e6bfedc79417ab14c260632c37c16365ce26375abf388496fb1b6e07be19d5d7

See more details on using hashes here.

File details

Details for the file bsv_sdk-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: bsv_sdk-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 68.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for bsv_sdk-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28d6cad52edf2a96ec8a1d8d01777031344fd911de56e050e41961f29a60d4b9
MD5 40838bfae52a803300689ed48c573fdd
BLAKE2b-256 c3562e3e78aa5dc7b205736ce3f402fce6ac261bba1c9012ec0ba6e98a213cec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page