feat: add Solana support (GetAddress, SignTx, SignMessage)#386
Draft
BitHighlander wants to merge 5 commits intodevelopfrom
Draft
feat: add Solana support (GetAddress, SignTx, SignMessage)#386BitHighlander wants to merge 5 commits intodevelopfrom
BitHighlander wants to merge 5 commits intodevelopfrom
Conversation
- Point device-protocol and python-keepkey submodules to upstream master (includes BIP-85, Solana, Tron, TON wire IDs and proto definitions) - Add nanopb .options files for Solana, Tron, TON (field size constraints) - Add Bip85Mnemonic.mnemonic max_size:241 to messages.options - Update lib/transport/CMakeLists.txt with new proto sources, options, headers, and protoc compilation commands - Fix CI: use pre-installed clang-format instead of apt-get install (eliminates 3-minute timeout on GitHub runners) - Update Zcash transparent branch ID from Sapling to NU6
3447a61 to
39c3bba
Compare
Add Ed25519-based Solana chain support using existing trezor-crypto primitives (ed25519, base58). - SolanaGetAddress: derive Ed25519 key, Base58-encode pubkey - SolanaSignTx: parse transaction, confirm on device, Ed25519 sign - SolanaSignMessage: off-chain message signing with device confirm - Transaction parser: System Transfer, SPL Token, Stake instructions
…,M6) - Fix compact-u16 decode: use correct LE varint (bit 7 continuation), not big-endian ranges - Remove duplicate compact-u16 in solana.c, share via read_compact_u16() in solana_tx.h - Change solana_signTx from void to bool, propagate errors to FSM handler - Default show_display to true when field not set (hardware wallet must confirm) - Fix token transfer: check TransferChecked (len>=10) with instruction type, parse amount for both - Reduce stack: account_keys 64→16, instructions 32→8 (saves ~3KB) - Zero public_key after use in solana.c and solana_msg.c - Remove dead read_u64_le function - Fix formatLamports buffer guard: 20→30 bytes - Guard MIN macro with #ifndef - Add const to SolanaSignTx and SolanaSignMessage FSM params
- Fix NULL pointer dereference: remove fsm_getCoin("Solana") call (not in coin table),
use bip32_path_to_string() directly for address display
- Add BIP44 path validation (m/44'/501'/...) to all 3 handlers
- Zero public_key stack variables on all exit paths
39c3bba to
fc262d6
Compare
88cbdfb to
108e1f2
Compare
Collaborator
Author
|
Closing — superseded by more complete Solana implementation in BitHighlander/keepkey-firmware (merged to develop, includes native tx parser). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Solana is the #5 cryptocurrency by market cap with a large KeepKey user overlap. Users currently cannot manage SOL on their KeepKey device, forcing them to use software wallets or competing hardware wallets. Adding Solana support addresses the most-requested chain addition.
Changes
Address derivation (
solana.c):m/44'/501'/account'/change'44'/501'prefixTransaction signing (
solana_tx.c,solana_msg.c):Message signing:
Wire protocol:
SolanaGetAddress(750) →SolanaAddress(751)SolanaSignTx(752) →SolanaSignedTx(753)SolanaSignMessage(754) →SolanaMessageSignature(755)Code review fixes applied:
Risk assessment
Isolated from existing chains — new source files, new message handlers, no modifications to Bitcoin/Ethereum signing paths. Uses the existing Ed25519 implementation from trezor-crypto (same curve as Nano, already battle-tested on-device).
The raw transaction signing model means the host is responsible for transaction construction. The device validates and displays what it can parse but ultimately signs the host-provided bytes. This matches the Trezor Model T approach for Solana.
Testing