How bitcoin-sv/go-sdk works
Main Components Structure
a) Core Primitives Layer (Bottom):
• Cryptographic components (ec, ecdsa, aescbc, aesgcm)
• Key management (keyshares)
• Hash functions (hash)
• DRBG (Deterministic Random Bit Generator)
b) Protocol Layer (Middle):
• Sections for:
• 'script/' (Script interpretation and execution)
• 'transaction/' (Transaction handling)
• 'spv/' (Simple Payment Verification)
• 'chainhash/' (Blockchain hashing utilities)
c) Compatibility Layer (Top):
• 'compat/' components:
• BIP32 (HD wallets)
• BIP39 (Mnemonic codes)
• Base58 encoding
• BSM (Bitcoin Signed Messages)
• ECIES encryption
External Interfaces
Interfaces for:
• Transaction broadcasting (transaction/broadcaster/)
• Chain tracking (transaction/chaintracker/)
• Network interaction points
Specific Design Elements
a) Transaction Processing Pipeline:
[Input Processing] → [Script Validation] → [Signature Verification] → [Output Creation]
b) Cryptographic Operations Flow:
[Key Generation] → [Signing] → [Verification] → [Encryption/Decryption]
Important Details
• SPV verification flow
• Script interpreter component
• Fee modeling system
• Transaction template system
• Where broadcasting interfaces connect
Architectural Patterns to Emphasize
• Layered architecture
• Separation of concerns between cryptographic primitives and higher-level operations
• Where extension points exist for custom implementations
Notes for Implementation
• Use rectangles for main components
• Use hexagons for cryptographic operations
• Use clouds for external services
• Version information and supported Bitcoin SV protocol version
Scale and Detail Level
• Keep the high-level architecture visible at a glance
• Provide zoom-in sections for complex components like the script interpreter
• Callouts for important features like Shamir key splitting
Remember to include a reference to the documentation and examples directory structure, as these are integral parts of the SDK's architecture.