# BSV SDK
[![build](https://github.com/bitcoin-sv/py-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/bitcoin-sv/py-sdk/actions/workflows/build.yml)
[![PyPI version](https://img.shields.io/pypi/v/bsv-sdk)](https://pypi.org/project/bsv-sdk)
[![Python versions](https://img.shields.io/pypi/pyversions/bsv-sdk)](https://pypi.org/project/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
1. [Objective](#objective)
2. [Getting Started](#getting-started)
3. [Features & Deliverables](#features--deliverables)
4. [Documentation](#documentation)
5. [Contribution Guidelines](#contribution-guidelines)
6. [Support & Contacts](#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
```bash
pip install bsv-sdk
```
### Basic Usage
```python
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](#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](https://docs.bsvblockchain.org/guides/sdks/py).
## 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](./CONTRIBUTING.md).
For information on past releases, check out the [changelog](./CHANGELOG.md). For future plans, check the [roadmap](./ROADMAP.md)!
## 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](./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!
Raw data
{
"_id": null,
"home_page": "https://github.com/bitcoin-sv/py-sdk",
"name": "bsv-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "bsv",
"author": "Aaron",
"author_email": "aaron@scrypt.io",
"download_url": "https://files.pythonhosted.org/packages/e6/bf/edc79417ab14c260632c37c16365ce26375abf388496fb1b6e07be19d5d7/bsv_sdk-0.5.2.tar.gz",
"platform": null,
"description": "# BSV SDK\n\n[![build](https://github.com/bitcoin-sv/py-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/bitcoin-sv/py-sdk/actions/workflows/build.yml)\n[![PyPI version](https://img.shields.io/pypi/v/bsv-sdk)](https://pypi.org/project/bsv-sdk)\n[![Python versions](https://img.shields.io/pypi/pyversions/bsv-sdk)](https://pypi.org/project/bsv-sdk)\n\nWelcome to the BSV Blockchain Libraries Project, the comprehensive Python SDK designed to provide an updated and unified layer for\ndeveloping scalable applications on the BSV Blockchain. This SDK addresses the limitations of previous tools by offering a fresh,\npeer-to-peer approach, adhering to SPV, and ensuring privacy and scalability.\n\n## Table of Contents\n\n1. [Objective](#objective)\n2. [Getting Started](#getting-started)\n3. [Features & Deliverables](#features--deliverables)\n4. [Documentation](#documentation)\n5. [Contribution Guidelines](#contribution-guidelines)\n6. [Support & Contacts](#support--contacts)\n\n## Objective\n\nThe BSV Blockchain Libraries Project aims to structure and maintain a middleware layer of the BSV Blockchain technology stack. By\nfacilitating the development and maintenance of core libraries, it serves as an essential toolkit for developers looking to build on the BSV\nBlockchain.\n\n## Getting Started\n\n### Installation\n\n```bash\npip install bsv-sdk\n```\n\n### Basic Usage\n\n```python\nimport asyncio\nfrom bsv import (\n PrivateKey, P2PKH, Transaction, TransactionInput, TransactionOutput\n)\n\n\n# Replace with your private key (WIF format)\nPRIVATE_KEY = 'KyEox4cjFbwR---------VdgvRNQpDv11nBW2Ufak'\n\n# Replace with your source tx which contains UTXO that you want to spend (raw hex format)\nSOURCE_TX_HEX = '01000000018128b0286d9c6c7b610239bfd8f6dcaed43726ca57c33aa43341b2f360430f23020000006b483045022100b6a60f7221bf898f48e4a49244e43c99109c7d60e1cd6b1f87da30dce6f8067f02203cac1fb58df3d4bf26ea2aa54e508842cb88cc3b3cec9b644fb34656ff3360b5412102cdc6711a310920d8fefbe8ee73b591142eaa7f8668e6be44b837359bfa3f2cb2ffffffff0201000000000000001976a914dd2898df82e086d729854fc0d35a449f30f3cdcc88acce070000000000001976a914dd2898df82e086d729854fc0d35a449f30f3cdcc88ac00000000'\n\nasync def create_and_broadcast_transaction():\n priv_key = PrivateKey(PRIVATE_KEY)\n source_tx = Transaction.from_hex(SOURCE_TX_HEX)\n\n tx_input = TransactionInput(\n source_transaction=source_tx,\n source_txid=source_tx.txid(),\n source_output_index=1,\n unlocking_script_template=P2PKH().unlock(priv_key),\n )\n\n tx_output = TransactionOutput(\n locking_script=P2PKH().lock(priv_key.address()),\n change=True\n )\n\n tx = Transaction([tx_input], [tx_output], version=1)\n\n tx.fee()\n tx.sign()\n\n await tx.broadcast()\n\n print(f\"Transaction ID: {tx.txid()}\")\n print(f\"Raw hex: {tx.hex()}\")\n\nif __name__ == \"__main__\":\n asyncio.run(create_and_broadcast_transaction())\n```\n\nFor a more detailed tutorial and advanced examples, check our [Documentation](#documentation).\n\n## Features & Deliverables\n\n- **Main Project Feature**: Description of the feature\n\n- **Main Project Feature 2**: Description of the feature\n\n- **Secondary Project Feature**: Description of the feature\n\n## Documentation\n\nDetailed documentation of the SDK with code examples can be found at [BSV Skills Center](https://docs.bsvblockchain.org/guides/sdks/py).\n\n## Contribution Guidelines\n\nWe're always looking for contributors to help us improve the project. Whether it's bug reports, feature requests, or pull requests - all\ncontributions are welcome.\n\n1. **Fork & Clone**: Fork this repository and clone it to your local machine.\n2. **Set Up**: Run `pip install -r requirements.txt` to install all dependencies.\n3. **Make Changes**: Create a new branch and make your changes.\n4. **Test**: Ensure all tests pass by running `pytest --cov=bsv --cov-report=html`.\n5. **Commit**: Commit your changes and push to your fork.\n6. **Pull Request**: Open a pull request from your fork to this repository.\n\nFor more details, check the [contribution guidelines](./CONTRIBUTING.md).\n\nFor information on past releases, check out the [changelog](./CHANGELOG.md). For future plans, check the [roadmap](./ROADMAP.md)!\n\n## Support & Contacts\n\nProject Owners: `<names and email addresses>`\n\nDevelopment Team Lead: `<name and email>`\n\nFor questions, bug reports, or feature requests, please open an issue on GitHub or contact us directly.\n\n## License\n\nThe license for the code in this repository is the Open BSV License. Refer to [LICENSE.txt](./LICENSE.txt) for the license text.\n\nThank you for being a part of the BSV Blockchain ecosystem. Let's build the future of BSV Blockchain together!\n",
"bugtrack_url": null,
"license": null,
"summary": "BSV BLOCKCHAIN | Software Development Kit for Python",
"version": "0.5.2",
"project_urls": {
"Bug Tracker": "https://github.com/bitcoin-sv/py-sdk/issues",
"Homepage": "https://github.com/bitcoin-sv/py-sdk"
},
"split_keywords": [
"bsv"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c3562e3e78aa5dc7b205736ce3f402fce6ac261bba1c9012ec0ba6e98a213cec",
"md5": "40838bfae52a803300689ed48c573fdd",
"sha256": "28d6cad52edf2a96ec8a1d8d01777031344fd911de56e050e41961f29a60d4b9"
},
"downloads": -1,
"filename": "bsv_sdk-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "40838bfae52a803300689ed48c573fdd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 68599,
"upload_time": "2024-09-02T12:00:57",
"upload_time_iso_8601": "2024-09-02T12:00:57.046881Z",
"url": "https://files.pythonhosted.org/packages/c3/56/2e3e78aa5dc7b205736ce3f402fce6ac261bba1c9012ec0ba6e98a213cec/bsv_sdk-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6bfedc79417ab14c260632c37c16365ce26375abf388496fb1b6e07be19d5d7",
"md5": "768720e53b7ef031a441d2cd5c2fc831",
"sha256": "43c1cd3618ae907b3534d001ff940f21957e4539757b06a3db5d6813e3115d42"
},
"downloads": -1,
"filename": "bsv_sdk-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "768720e53b7ef031a441d2cd5c2fc831",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 91325,
"upload_time": "2024-09-02T12:00:59",
"upload_time_iso_8601": "2024-09-02T12:00:59.429405Z",
"url": "https://files.pythonhosted.org/packages/e6/bf/edc79417ab14c260632c37c16365ce26375abf388496fb1b6e07be19d5d7/bsv_sdk-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-02 12:00:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bitcoin-sv",
"github_project": "py-sdk",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "bsv-sdk"
}