spiffynode 1.1.0
spiffynode: ^1.1.0 copied to clipboard
A Dart library for connecting to the BitcoinSV P2P network
Changelog #
All notable changes to the SpiffyNode project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.0 - 2026-03-22 #
Added #
- Custom Handler Support: Added per-peer handler support to
PeerManager.addPeerByAddress()method- New optional
handlerparameter allows overriding the default handler for individual peers - Handler priority: per-peer handler > default PeerManager handler > chain tip tracking only
- Enables SPV wallets to capture
MsgHeadersresponses for block header validation - Updated
addPeersByAddresses()extension method to support handler parameter - All custom handlers are automatically wrapped with chain tip tracking for SPV support
- New optional
- Documentation: Added comprehensive handler usage examples in API-DOCS.md
- Three handler patterns: default handler, per-peer override, and LibSpiffy SPV pattern
- New example file:
example/custom_handler_example.dartdemonstrating all handler patterns - Updated SPV wallet examples to show handler integration
Changed #
PeerManager.addPeerByAddress()now accepts optionalhandlerparameter for per-peer customization- Updated internal
_createCompositeHandler()method to support handler priority system
1.0.0 - 2025-01-27 #
๐ Initial Release - Full BitcoinSV P2P Client #
SpiffyNode 1.0.0 represents a complete, production-ready BitcoinSV P2P networking library for Dart.
Core Features Implemented
P2P Protocol Foundation:
- Complete Bitcoin P2P protocol handshake (
version/verack) - Network magic number support (Mainnet, Testnet, RegTest, SimNet)
- Priority-based message queue with overflow protection
- Robust connection management with health monitoring
- Peer discovery and management system
Message Types:
MsgVersion- Protocol handshake with configurablestartHeightfor SPV syncMsgVerAck- Handshake acknowledgmentMsgPing/MsgPong- Connection keepalive and latency measurementMsgHeaders- Block header synchronization (supports large 162KB+ payloads)MsgGetHeaders- Request block headers with locator supportMsgSendHeaders- BIP 130 direct header delivery preferenceMsgInv- Inventory announcements for blocks and transactionsMsgGetData- Request specific data itemsMsgAddr- Peer address sharingMsgTx- Transaction messagesMsgBlock- Full block dataMsgMemPool- Memory pool requestsMsgReject- Error reporting
Block Header Client:
- Complete block header synchronization from genesis or specific height
- In-memory block header storage and management
- Real-time block announcements via
sendheadersprotocol - Automatic pagination for large header sets (2000+ headers)
- RegTest network compatibility for development
Network Layer:
- TCP connection management with timeout handling
- Message serialization/deserialization with checksum verification
- Large message support (tested with 162KB+ payloads)
- Graceful handling of unsupported protocol extensions
- Background send/receive loops with error recovery
๐ง Critical Bug Fixes
Message Processing Pipeline:
- Fixed critical deserialization bug in
MessageProcessorwhere immutable messages (likeMsgHeaders) were being parsed as empty despite receiving large payloads - Corrected checksum calculation to use raw byte arrays instead of integers (endianness fix)
- Resolved "Future already completed" error in message queue processing
- Fixed priority queue ordering and completion handling
Protocol Compliance:
- Corrected network magic number mappings for BitcoinSV networks
- Implemented proper
sendheaderstiming per BIP 130 specification - Fixed
getheadersmessage format to include locator hashes for genesis sync - Added proper handling of protocol extensions (
protoconf,sendcmpct,feefilter)
๐ Documentation & Examples
API Documentation:
- Comprehensive
API-DOCS.mdwith usage examples - Updated
README.mdwith project overview and quick start guide - Inline code documentation for all public APIs
Example Applications:
simple_peer_example.dart- Basic P2P connection demoblock_header_client_example.dart- Full SPV block header sync client
๐งช Testing & Quality
Test Coverage:
- Unit tests for all message types and serialization
- Integration tests for peer connections and handshakes
- Message queue and priority handling tests
- Block header parsing and validation tests
Development Tools:
- Proper error handling and logging throughout
- Debug output for protocol troubleshooting
- Performance monitoring and statistics
๐ฆ Project Metadata
- License: MIT License (Copyright 2025 Stephan M. February)
- Dart SDK: Compatible with Dart 3.0.0+
- Dependencies: Minimal (crypto, logging, meta)
- Homepage: https://github.com/twostack/spiffynode
Current Status: โ PRODUCTION READY #
SpiffyNode 1.0.0 is a complete, tested, and production-ready BitcoinSV P2P networking library.
What Works:
- โ Full P2P handshake and connection management
- โ Block header synchronization (tested with 2100+ RegTest blocks)
- โ All major Bitcoin protocol messages
- โ Large message handling (162KB+ payloads)
- โ Priority message queuing and flow control
- โ Real-time block announcements
- โ SPV client capabilities with configurable sync points
Use Cases:
- SPV (Simplified Payment Verification) clients
- Blockchain explorers and analytics tools
- BitcoinSV network monitoring applications
- Custom wallet implementations
- Research and educational projects
Ready for integration into production BitcoinSV applications!