Welcome to the BSV Blockchain Wallet Toolbox for Python — 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.
- Objective
- Current Status
- Getting Started
- Building Blocks
- Features
- Architecture
- Roadmap
- Compatibility
- Contribution Guidelines
- Support & Contacts
- License
The BSV Wallet Toolbox builds on the BSV SDK for Python.
It aims to support building sophisticated applications and services on the BSV Blockchain technology stack by providing:
- 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
By providing interlocking, production-ready building blocks for persistent storage, protocol-based key derivation, and wallet orchestration, it serves as an essential toolbox for developers looking to build on the BSV Blockchain with Python.
Version: 0.6.0 (Alpha)
Implementation Progress: Phase 0 Complete, Phase 1 Ready to Start
Code Quality:
- ✅ Lint Critical Errors: 0 (F821, E501 fully resolved)
- ✅ Type Check: 625 errors (333 pending API implementation)
- ✅ Test Suite: 846 tests fully implemented, pytest operational
- ✅ Reference Unification: 851 locations corrected (TS/Go compliant)
- ✅ Manual Tests: 29 tests in
manual_tests/directory
This is an early-stage implementation. The wallet is being built incrementally with a focus on:
- List-based development approach
- Test-driven development
- Cross-implementation compatibility
See CHANGELOG.md for detailed version history.
- Python 3.11 or higher
- pip package manager
- SQLite (included with Python) or PostgreSQL/MySQL (optional)
# Clone the repository
git clone https://github.com/bsv-blockchain/wallet-toolbox.git
cd wallet-toolbox/toolbox/py-wallet-toolbox
# Create virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# or
.venv\Scripts\activate # Windows
# Install in development mode
pip install -e .[dev]pip install bsv-wallet-toolboximport asyncio
from bsv_wallet_toolbox import Wallet
async def main():
# Create a wallet instance (chain parameter is required)
wallet = Wallet(chain="main") # or chain="test" for testnet
# Get wallet version
result = await wallet.get_version({})
print(f"Wallet version: {result['version']}")
# With originator validation
result = await wallet.get_version({}, originator="example.com")
print(f"Version: {result['version']}")
if __name__ == "__main__":
asyncio.run(main())from bsv_wallet_toolbox import Wallet, InvalidParameterError
async def example_with_error_handling():
wallet = Wallet(chain="main")
try:
# This will raise InvalidParameterError
result = await wallet.get_version({}, originator="x" * 251)
except InvalidParameterError as e:
print(f"Error: {e}")
# Output: Error: Invalid parameter 'originator': must be under 250 bytesThe Python Wallet Toolbox consists of the following components:
-
Wallet (
src/bsv_wallet_toolbox/wallet.py): High-level wallet orchestration implementing BRC-100 WalletInterface- ✅ Basic wallet structure
- ⏳ 28 BRC-100 methods (in development)
-
Error Handling (
src/bsv_wallet_toolbox/errors/): Comprehensive error classes- ✅
InvalidParameterErrorfor parameter validation - ⏳ Additional error types for various failure modes
- ✅
-
Storage Layer: Durable records for actions, outputs, certificates, and related entities
- SQLAlchemy-based ORM
- Support for SQLite, PostgreSQL, MySQL
- 16 database tables matching TypeScript schema
-
Services Integration: Integrations for blockchain services
- Chain tracker (block height, headers)
- ARC (transaction broadcast)
- Overlay services (discovery, certificates)
-
Monitor: Background tasks for SPV-friendly workflows
- Transaction status monitoring
- Proof retrieval
- Storage synchronization
-
JSON-RPC Dispatcher: Framework-neutral JSON-RPC server
- Standard JSON-RPC 2.0 protocol
- HTTP transport layer
- Authentication middleware integration
- ✅ BRC-100 Compliant: Implements official WalletInterface specification
- ✅ Type Safe: Full type hints with mypy strict mode
- ✅ Async/Await: Modern asynchronous programming with asyncio
- ✅ Cross-Platform: Linux, macOS, Windows support
- ✅ Well Documented: Comprehensive English docstrings
- ✅ Test Infrastructure: pytest-based testing framework
- ⏳ 28 BRC-100 Methods: Full WalletInterface implementation
- ⏳ Database Persistence: SQLAlchemy-based storage (SQLite/PostgreSQL/MySQL)
- ⏳ Protocol-Aligned Wallet Flows: Complete BRC-100 method implementation
- ⏳ Pluggable Service Layer: ARC, ChainTracker, Overlay Services
- ⏳ Storage Synchronization: Multi-device wallet sync
- ⏳ JSON-RPC Server: HTTP-based wallet server
- ⏳ BRC-100 ABI: Binary communication protocol
- ⏳ SPV-Friendly Workflows: Privacy-preserving operations
- ⏳ Background Tasks: Automated monitoring and proof management
┌─────────────────────────────────────────────────────────┐
│ Application Layer │
│ (Your BSV Blockchain App) │
└───────────────────────┬─────────────────────────────────┘
│
BRC-100 WalletInterface
(28 async methods)
│
▼
┌─────────────────────────────────────────────────────────┐
│ Wallet Class │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • getVersion() │ │
│ │ • getNetwork() │ │
│ │ • createAction() │ │
│ │ • signAction() │ │
│ │ • ... 24 more methods │ │
│ └────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Storage │ │ Services │ │ Monitor │ │
│ │ Manager │ │ │ │ │ │
│ └─────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
Database Blockchain Background
(SQLAlchemy) Services Tasks
- Framework Neutral: Core library has no web framework dependencies
- Async First: All I/O operations use async/await
- Type Safe: Complete type hints for IDE support and static analysis
- Test Driven: Universal Test Vectors + comprehensive test suite
- Cross-Language Compatible: 100% compatible with TypeScript and Go
- Project structure and build system
- Testing framework setup
- Type definitions
- Development documentation
- WalletInterface basic methods (4 methods)
- Storage layer foundation (16 tables)
- Basic CRUD operations
- Validation utilities
- Network information methods
- List operations
- Transaction management
- Services integration
- Cryptographic operations
- Certificate management
- Discovery services
- Storage synchronization
- JSON-RPC dispatcher
- BRC-100 ABI
- Monitor (background tasks)
- Performance optimization
See IMPLEMENTATION_ROADMAP.md for detailed breakdown.
This Python implementation is designed to be 100% compatible with:
- Repository: ts-wallet-toolbox
- Status: ✅ API compatible
- Testing: Universal Test Vectors shared
- Version: Aligned with TypeScript v1.0.0
- Repository: go-wallet-toolbox
- Status: ✅ API compatible
- Testing: Universal Test Vectors shared
- Version: Aligned with Go v1.0.0
All three implementations (Python, TypeScript, Go) share:
- ✅ Same BRC-100 WalletInterface API (28 methods)
- ✅ Identical behavior and error handling
- ✅ Same database schema (for Storage Synchronization)
- ✅ Universal Test Vectors validation
- ✅ Cross-implementation testing capability
We're always looking for contributors to help us improve the Wallet Toolbox. 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 -e .[dev]to install all dependencies. - Make Changes: Create a new branch and make your changes.
- Test: Ensure all tests pass by running
pytest tests/ -v. - Quality Check: Run
black src/ tests/,ruff check src/ tests/, andmypy src/. - Commit: Commit your changes and push to your fork.
- Pull Request: Open a pull request from your fork to this repository.
For detailed guidelines, check CONTRIBUTING.md.
- TypeScript Reference: When porting features, always reference the TypeScript implementation
- Universal Test Vectors: All methods must pass official BRC-100 test vectors
- Database Schema: Never change database schema without coordination across all implementations
- Type Safety: All code must pass mypy strict mode
- English Documentation: All docstrings and comments must be in English
Project Owners: Thomas Giacomo and Darren Kellenschwiler
Development Team Lead: Ken Sato @ Yenpoint Inc. & Yosuke Sato @ Yenpoint Inc.
For questions, bug reports, or feature requests:
- Open an issue on GitHub
- Review TypeScript implementation for reference
- Check Go implementation for reference
- Python SDK: BSV SDK Documentation
- BRC-100 Specification: Wallet Interface Standard
- Universal Test Vectors: Official Test Data
The repository is richly documented with English docstrings that surface well in editors like VSCode.
The license for the code in this repository is the Open BSV License version 4. Refer to license.md for the license text.
Thank you for being a part of the BSV Blockchain Libraries Project. Let's build the future of BSV Blockchain together! 🚀