Core architecture
All chain modules implement two core traits that define the parsing and conversion interface:- Transaction - Handles parsing raw transaction bytes into chain-specific structures
- VisualSignConverter - Transforms parsed transactions into the VisualSign JSON format
Key design principles
- Progressive Disclosure - Show the most important information first, with details available on demand through expandable sections
- Risk Highlighting - Prominently display warnings, first-time addresses, and large amounts
- Chain-Specific Context - Visualize chain-unique concepts appropriately (Ethereum gas fees, Solana instructions, Sui objects, Tron energy)
Implementation pattern
Each chain module follows this general pattern:- Decode - Parse raw transaction bytes into chain-specific structures
- Extract - Pull out key information (sender, recipient, amounts, etc.)
- Enrich - Add context (resolve names, check contracts, calculate fees)
- Transform - Convert to VisualSign field types
- Organize - Structure fields for optimal user understanding
Supported chains
- Ethereum - Account-based model with smart contracts
- Solana - High-performance chain with parallel processing
- Sui - Object-oriented blockchain with Move
- Tron - EVM-compatible with energy system
Field type mapping
Each chain’s native data types map to VisualSign field types:| Chain Data | VisualSign Field | Example |
|---|---|---|
| Token amounts | amount_v2 | ETH, SOL, USDC |
| Addresses | address_v2 | Recipients, contracts |
| Methods/Instructions | text_v2 or preview_layout | Function calls |
| Multiple operations | list_layout | Batch transactions |
| Gas/Fees | preview_layout | Expandable fee details |
Source code
The full implementation of all chain modules can be found in the visualsign-parser repository:Adding new chains
To add support for a new blockchain:- Study the transaction format - Understand how transactions are encoded
- Identify key information - What users need to see for this chain
- Implement the Transaction and VisualSignConverter traits - Follow the pattern of existing modules
- Map to field types - Use appropriate VisualSign fields for visualization
- Add tests - Ensure parsing works with real transaction data
Best practices
- Performance: Cache frequently accessed data, avoid blocking operations, use efficient decoding libraries
- Accuracy: Validate all decoded data, handle malformed transactions gracefully, provide clear error messages
- Maintainability: Follow existing patterns, document chain-specific quirks, keep modules isolated and testable
Next steps
- Review individual chain documentation for specific details
- Explore the Field Types reference
- Check visualization patterns for UI guidance
- View the source code for implementation details