Skip to main content

BRC-100 compliant Bitcoin SV wallet implementation

Project description

BSV BLOCKCHAIN | Wallet Toolbox for Python

Build PyPI version Python versions Coverage

๐Ÿ”— Cross-SDK Interoperability (v2.0.0)

BRC-100 compliance with cross-SDK interoperability. Compatible with TypeScript SDK and Go SDK (v2.0.0+). Compatible with wallet-toolbox v2.0.0+.

Installation:

pip install bsv-wallet-toolbox --pre

The --pre flag is required because this package depends on bsv-sdk>=2.0.0b1 (beta).

BRC-100 conforming wallet implementation providing production-ready, persistent storage components. Built on top of the official Python SDK, this toolbox helps you assemble scalable wallet-backed applications and services.

Table of Contents

Objective

The BSV Wallet Toolbox builds on the BSV SDK for Python and provides:

  • Production-Ready Wallet: Full BRC-100 WalletInterface implementation with persistent storage
  • Database Persistence: SQLAlchemy-based storage compatible with SQLite, PostgreSQL, and MySQL
  • Cross-Language Compatibility: 100% compatible with TypeScript and Go implementations
  • Universal Test Vectors: Validated against official BRC-100 test data
  • SPV-Friendly Workflows: Privacy-preserving, scalable wallet operations

Current Status

Version: 2.0.0

Metric Status
Lint Critical Errors โœ… 0
Test Suite โœ… 846 tests
Manual Tests โœ… 29 tests
Reference Unification โœ… 851 locations (TS/Go compliant)

See CHANGELOG.md for detailed version history.

Getting Started

Prerequisites

  • Python 3.11 or higher
  • pip package manager
  • SQLite (included with Python) or PostgreSQL/MySQL (optional)

Installation

From PyPI

pip install bsv-wallet-toolbox

From Source

git clone https://github.com/bsv-blockchain/py-wallet-toolbox.git
cd py-wallet-toolbox

python -m venv .venv
source .venv/bin/activate  # Linux/Mac
# or .venv\Scripts\activate on Windows

pip install -e .[dev]

Quick Start

import asyncio
from bsv_wallet_toolbox import Wallet

async def main():
    wallet = Wallet(chain="main")  # or chain="test" for testnet
    
    result = await wallet.get_version({})
    print(f"Wallet version: {result['version']}")

if __name__ == "__main__":
    asyncio.run(main())

Error Handling

from bsv_wallet_toolbox import Wallet, InvalidParameterError

async def example():
    wallet = Wallet(chain="main")
    
    try:
        result = await wallet.get_version({}, originator="x" * 251)
    except InvalidParameterError as e:
        print(f"Error: {e}")

Features

Current Features

  • โœ… BRC-100 compliant WalletInterface
  • โœ… Full type hints with mypy strict mode
  • โœ… Async/await with asyncio
  • โœ… Cross-platform (Linux, macOS, Windows)
  • โœ… pytest-based testing framework

Planned Features

  • โณ 28 BRC-100 methods (full WalletInterface)
  • โณ SQLAlchemy-based storage (SQLite/PostgreSQL/MySQL)
  • โณ Pluggable service layer (ARC, ChainTracker, Overlay)
  • โณ Storage synchronization
  • โณ JSON-RPC server

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Application Layer                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                BRC-100 WalletInterface
                        โ”‚
                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Wallet Class                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  โ€ข getVersion()    โ€ข createAction()               โ”‚ โ”‚
โ”‚  โ”‚  โ€ข getNetwork()    โ€ข signAction()                 โ”‚ โ”‚
โ”‚  โ”‚  โ€ข ... 24 more methods                            โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                        โ”‚                                 โ”‚
โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”‚
โ”‚       โ–ผ                โ–ผ                โ–ผ               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
โ”‚  โ”‚ Storage โ”‚    โ”‚ Services โ”‚    โ”‚ Monitor  โ”‚           โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                โ”‚               โ”‚
         โ–ผ                โ–ผ               โ–ผ
      Database        Blockchain      Background
     (SQLAlchemy)      Services         Tasks

Design Principles

  1. Framework Neutral: No web framework dependencies
  2. Async First: All I/O uses async/await
  3. Type Safe: Complete type hints for IDE support
  4. Test Driven: Universal Test Vectors + comprehensive tests
  5. Cross-Language Compatible: 100% compatible with TypeScript and Go

Compatibility

This Python implementation is 100% compatible with:

Implementation Repository Status
TypeScript wallet-toolbox โœ… API compatible
Go go-wallet-toolbox โœ… API compatible

All three implementations share:

  • Same BRC-100 WalletInterface API (28 methods)
  • Identical behavior and error handling
  • Same database schema
  • Universal Test Vectors validation

Contribution Guidelines

We welcome contributions! See CONTRIBUTING.md for detailed guidelines.

Quick Start for Contributors

# Setup
pip install -e .[dev]

# Run tests
pytest tests/ -v

# Quality checks
black src/ tests/
ruff check src/ tests/
mypy src/

Important Notes

  • Reference the TypeScript implementation when porting features
  • All methods must pass official BRC-100 test vectors
  • All code must pass mypy strict mode
  • All docstrings and comments must be in English

Support & Contacts

Project Owners: Thomas Giacomo and Darren Kellenschwiler

For questions, bug reports, or feature requests:

Documentation

License

The license for the code in this repository is the Open BSV License version 4. See license.md for details.

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_wallet_toolbox-2.0.0.tar.gz (981.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bsv_wallet_toolbox-2.0.0-py3-none-any.whl (458.0 kB view details)

Uploaded Python 3

File details

Details for the file bsv_wallet_toolbox-2.0.0.tar.gz.

File metadata

  • Download URL: bsv_wallet_toolbox-2.0.0.tar.gz
  • Upload date:
  • Size: 981.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bsv_wallet_toolbox-2.0.0.tar.gz
Algorithm Hash digest
SHA256 94e16914789a120a1906d69297c794c14ce1e4e1a1a7d531a463a88b4f1a7e37
MD5 6f14aa398f0e678bdebeb1d89ca9dd58
BLAKE2b-256 75f6bfce9a69dd0525c27f4b6ba09f37bc8d3d673106e70326a69aed30ddd065

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsv_wallet_toolbox-2.0.0.tar.gz:

Publisher: workflow.yml on bsv-blockchain/py-wallet-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bsv_wallet_toolbox-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bsv_wallet_toolbox-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5938a2b275e640e36dfc8768d9321d2ea8e019fe5b2bf42ea1b9c1c7808ce5d
MD5 fe26324de7a019e2c41f6750b943415f
BLAKE2b-256 5e92ed33517867b97a69aae1dc6defb677aea7b7d3746a0934be7fedee8eaf1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsv_wallet_toolbox-2.0.0-py3-none-any.whl:

Publisher: workflow.yml on bsv-blockchain/py-wallet-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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