@wraith-protocol/sdk/chains/solana.
Most developers should use the Agent Client instead. These primitives are for power users building custom stealth address integrations on Solana.
Installation
Import
Types
Relationship to Stellar Module
Solana uses the same ed25519 curve as Stellar. The cryptographic algorithms are identical — only the address encoding and transaction format differ.| Aspect | Stellar | Solana |
|---|---|---|
| Curve | ed25519 | ed25519 (same) |
| ECDH | X25519 | X25519 (same) |
| Hash to scalar | SHA-256 domain-separated | SHA-256 domain-separated (same) |
| View tag | SHA-256("wraith:tag:" || S)[0] | SHA-256("wraith:tag:" || S)[0] (same) |
| Address format | G... (StrKey) | Base58 (32-byte pubkey) |
| Meta-address prefix | st:xlm: | st:sol: |
| Account model | Must createAccount first | Send SOL directly, no deployment needed |
| Min balance | 1 XLM | ~0.00089 SOL (rent exemption) |
Constants
Functions
deriveStealthKeys(signature)
Derive spending and viewing key pairs from a 64-byte ed25519 signature.
spendingKey = SHA-256("wraith:spending:" || signature)— 32-byte seedviewingKey = SHA-256("wraith:viewing:" || signature)— 32-byte seed- Each seed is expanded via
seedToScalar()(SHA-512 + clamping) - Public keys derived via
ed25519.getPublicKey(seed)
seedToScalar(seed)
Convert a 32-byte ed25519 seed to its clamped scalar.
computeSharedSecret(privateKey, publicKey)
Compute an ECDH shared secret using X25519 (Montgomery form conversion).
computeViewTag(sharedSecret)
Compute the view tag from a shared secret.
hashToScalar(sharedSecret)
Hash a shared secret to a scalar value for stealth address derivation.
generateStealthAddress(spendingPubKey, viewingPubKey, ephemeralSeed?)
Generate a one-time stealth address for a Solana recipient.
- Generate random ephemeral ed25519 seed
- Compute shared secret via X25519 ECDH
viewTag = computeViewTag(sharedSecret)hScalar = hashToScalar(sharedSecret)stealthPoint = spendingPubKey + hScalar * G(ed25519 point addition)- Encode as base58 Solana address via
PublicKey
checkStealthAddress(ephemeralPubKey, viewingKey, spendingPubKey, viewTag)
Check if an announcement belongs to you.
scanAnnouncements(announcements, viewingKey, spendingPubKey, spendingScalar)
Scan announcements and return matches with their private scalars.
spendingScalar (bigint), same as the Stellar module.
deriveStealthPrivateScalar(spendingScalar, viewingKey, ephemeralPubKey)
Derive the private scalar for a specific stealth address.
signWithScalar(message, scalar, publicKey)
Sign a message using a raw scalar instead of a seed.
signSolanaTransaction(txMessageBytes, stealthScalar, stealthPubKey)
Sign a Solana transaction message with a stealth private scalar.
encodeStealthMetaAddress(spendingPubKey, viewingPubKey)
Encode two 32-byte public keys into a Solana stealth meta-address.
decodeStealthMetaAddress(metaAddress)
Decode a Solana meta-address back into its component keys.
pubKeyToSolanaAddress(publicKey)
Convert a 32-byte ed25519 public key to a base58 Solana address.
bytesToHex(bytes) / hexToBytes(hex)
Utility functions for converting between Uint8Array and hex strings.
End-to-End Flow
Solana-Specific Considerations
- No account deployment: Unlike Stellar, Solana doesn’t require
createAccount. An ed25519 public key is a valid address — send SOL directly to it. - Rent exemption: Accounts need ~0.00089 SOL to be rent-exempt. When withdrawing all, send
balance - txFee(5000 lamports). The account is garbage collected when balance drops below rent exemption. - SPL tokens: Token transfers use associated token accounts (ATAs), not direct transfers. The ATA must be created for the stealth address before transferring SPL tokens.
- Announcements: Fetched from program transaction logs via
fetchAnnouncements("solana"), not a subgraph. - Signing: Same
signWithScalar()as Stellar — stealth scalars are derived and can’t be used with standard SolanaKeypair.
Chain Deployments
The SDK ships with deployed program IDs and RPC URLs for supported Solana networks.getDeployment(chain)
Supported Networks
| Network | Status |
|---|---|
| Solana Devnet | Live |

