Skip to content

A powerful command-line tool for securely generating, managing, and encrypting Solana private keys. Supports multiple output formats, key segmentation, and encrypted file storage.

License

Notifications You must be signed in to change notification settings

0xfnzero/sol-safekey

Repository files navigation

πŸ” Sol-SafeKey

Secure Solana key management library with AES-256 encryption

Military-grade wallet security with simple bot integration - secure password handling, encrypted keystores, and full Solana operations support.

Crates.io Documentation License GitHub stars GitHub forks

Rust Solana Security

δΈ­ζ–‡ | English | Website | Telegram | Discord


✨ Features

  • πŸ” AES-256 Encryption: Military-grade encryption with PBKDF2 key derivation
  • πŸ€– Bot Integration: Simple 3-line integration for Solana trading bots
  • πŸ’° Solana Operations: Built-in support for transfers, wrapping, token operations
  • πŸ”’ Secure by Default: Password via stdin pipe (memory only, never environment variables)
  • 🎯 Interactive CLI: Full-featured command-line interface with safekey command

πŸš€ Quick Start

For Bot Developers

# Build the bot
cargo build --example bot_example --features solana-ops --release

# Run interactive safekey commands
./build-cache/release/examples/bot_example safekey

As a Library

use sol_safekey::KeyManager;

// Generate keypair
let keypair = KeyManager::generate_keypair();

// Encrypt and save
let json = KeyManager::keypair_to_encrypted_json(&keypair, "password")?;
std::fs::write("keystore.json", json)?;

// Load and decrypt
let json = std::fs::read_to_string("keystore.json")?;
let keypair = KeyManager::keypair_from_encrypted_json(&json, "password")?;

πŸ“š Documentation

πŸ” Security

  • βœ… Password Security: stdin pipe only (never in environment variables or files)
  • βœ… Encryption: AES-256 with PBKDF2 key derivation
  • βœ… Memory Safety: Immediate password cleanup after use

πŸ“¦ Installation

Add to your Cargo.toml:

[dependencies]
sol-safekey = { path = "path/to/sol-safekey" }

[features]
solana-ops = ["sol-safekey/solana-ops"]

πŸ› οΈ Available Operations

Via safekey command:

  • Create encrypted wallet
  • Query SOL balance
  • Transfer SOL
  • Wrap/Unwrap SOL ↔ WSOL
  • Transfer SPL tokens
  • Create durable nonce accounts
  • πŸ”₯ PumpSwap Sell - Interactive token selling on PumpSwap DEX
    • One-click sell all tokens
    • Seed-optimized ATA support
    • Default 99% slippage for fast execution
    • Bilingual support (English/Chinese)

πŸ“– Examples

See examples/bot_example.rs for a complete bot integration example.

🀝 Contributing

Contributions welcome! Please ensure security best practices are followed.

πŸ“„ License

MIT License - See LICENSE file for details

About

A powerful command-line tool for securely generating, managing, and encrypting Solana private keys. Supports multiple output formats, key segmentation, and encrypted file storage.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •