### Install desktop dependencies and start development environment Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Installs npm dependencies for the desktop app and starts the Tauri app, Next.js UI on 127.0.0.1:3840, and local API on 127.0.0.1:3841. Stop all local development processes with `make stop`. ```bash npm --prefix apps/desktop install make dev ``` -------------------------------- ### Build and run bot example Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Commands to build the bot example with Solana features and run it in interactive safekey mode or with a password piped via stdin. The password is passed through stdin to keep it in memory only. ```bash # Build the example cargo build --example bot_example --features solana-ops --release # Launch interactive safekey commands ./build-cache/release/examples/bot_example safekey # Run bot with password from stdin echo "your-password" | ./build-cache/release/examples/bot_example ``` -------------------------------- ### Start the CLI with full features Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Runs the fnzero-safe-core CLI with the `full` feature set and starts the application. ```bash cargo run -p fnzero-safe-core --features full -- start ``` -------------------------------- ### Secure Startup Script for Bot Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Builds the bot with solana-ops feature, prompts for password securely, starts the bot with password piped via stdin, clears the password from memory, and checks the exit code. ```bash #!/bin/bash # Build the bot echo "๐Ÿ”ง Building bot..." cargo build --features solana-ops --release # Get password securely (no echo) echo -n "๐Ÿ” Enter wallet password: " read -s WALLET_PASSWORD echo "" # Start bot with password piped through stdin echo "$WALLET_PASSWORD" | ./build-cache/release/your-bot > bot.log 2>&1 EXIT_CODE=$? # Immediately clear password from memory WALLET_PASSWORD="" unset WALLET_PASSWORD # Check execution result if [ $EXIT_CODE -eq 0 ]; then echo "โœ… Bot completed successfully" else echo "โŒ Bot failed with exit code: $EXIT_CODE" echo "๐Ÿ“ Check bot.log for details" fi ``` -------------------------------- ### Install fnzero-safe standalone from crates.io Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Install fnzero-safe with the full feature set, verify the installation, and start the interactive menu. Recommended for the latest version. ```bash # Install from crates.io (recommended for latest version) cargo install fnzero-safe --features="full" # Verify installation fnzero-safe --version # Start interactive menu fnzero-safe start ``` -------------------------------- ### Start the UI with make dev Source: https://github.com/0xfnzero/fnzsafe/blob/main/UI_USER_GUIDE.md Run from the repository root to start the desktop app, Next.js interface on port 3840, and local Rust API on port 3841. Stops stale local development processes first. ```bash make dev ``` -------------------------------- ### Get devnet SOL Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Airdrop SOL to a wallet address on the devnet. ```bash solana airdrop 2 YOUR_WALLET_ADDRESS --url devnet ``` -------------------------------- ### Example Output: Create Plaintext Key (Option 1) Source: https://github.com/0xfnzero/fnzsafe/blob/main/INTERACTIVE_TUTORIAL.md Shows the expected output when creating a plaintext key. The private key is saved unencrypted; only for development and testing. ```text ๐Ÿ”“ Create Plaintext Key Enter filename [keypair.json]: my_keypair.json Generating new Solana keypair... โœ… Key generation successful! Public Key: 7xKm...9xW3 ๐Ÿ“ Important Notes: โ€ข This file contains your private key in plaintext โ€ข Only use for development and testing โ€ข Do NOT share this file with anyone โ€ข For production, use encrypted options (Option 2) ``` -------------------------------- ### Run Safekey Command Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Launches the full interactive menu with all wallet operations after integration. ```bash ./your-bot safekey ``` -------------------------------- ### Create test wallet on devnet Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Interactive safekey command to create an encrypted keypair and save it to keystore.json. ```bash ./your-bot safekey # Select: Create encrypted keypair โ†’ Save to keystore.json ``` -------------------------------- ### Example Output: Create Encrypted Key (Option 2) Source: https://github.com/0xfnzero/fnzsafe/blob/main/INTERACTIVE_TUTORIAL.md Shows the expected output when creating an encrypted key. The keystore file contains an AES-256 encrypted private key; password is required for decryption. ```text ๐Ÿ” Create Encrypted Key Enter or paste your private key (base58): Please set a password (10-20 characters, must include at least 3 of: uppercase, lowercase, digit, special character): Enter password: ******** Confirm password: ******** Enter filename to save [keystore.json]: my_keystore.json Encrypting and saving... โœ… Keystore encrypted and saved to: my_keystore.json ๐Ÿ“ Important: โ€ข Password required for decryption - never lose it! โ€ข keystore.json contains AES-256 encrypted private key โ€ข Recommended to backup keystore.json to multiple secure locations ``` -------------------------------- ### Launch fnzero-safe interactive menu via standalone binary Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Run the bot_example binary from the build cache to access the interactive menu when using the standalone version. ```bash ./build-cache/release/examples/bot_example safekey ``` -------------------------------- ### Launch Interactive Menu with fnzero-safe start Source: https://github.com/0xfnzero/fnzsafe/blob/main/INTERACTIVE_TUTORIAL.md Starts the interactive menu. After running, select your preferred language: enter 2 for English or 1 for Chinese. ```bash fnzero-safe start ``` -------------------------------- ### Example Output: Decrypt Key (Option 3) Source: https://github.com/0xfnzero/fnzsafe/blob/main/INTERACTIVE_TUTORIAL.md Shows the expected output when decrypting a keystore file. The private key is displayed in plaintext; keep the screen secure. ```text ๐Ÿ”“ Decrypt Key Enter keystore filename [keystore.json]: my_keystore.json Enter password: ******** โœ… Decryption successful! Public Key: 7xKm...9xW3 Private Key: โš ๏ธ Security Warning: โ€ข Private key is now displayed in plaintext โ€ข Keep this screen away from prying eyes โ€ข Consider using decrypted key only when necessary ``` -------------------------------- ### Batch Sell Example Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shows the interactive CLI flow for selling multiple tokens in one batch. Accepts multiple mint addresses separated by commas or spaces, sells them in order with a 2-second delay between transactions, and uses a single confirmation. Individual token failures do not affect subsequent tokens. ```text ๐Ÿ”ฅ PumpSwap Sell Tokens Enter RPC URL: https://api.mainnet-beta.solana.com โ“ Enable Seed Optimization? (yes/no, default: yes): [Press Enter] โœ… Seed optimization enabled ๐Ÿ’ก You can enter multiple mint addresses separated by commas or spaces Tokens will be sold in the order entered Token Mint Address(es): Token1Address..., Token2Address..., Token3Address... ๐Ÿ“‹ Found 3 token(s) to sell: 1. Token1Address... 2. Token2Address... 3. Token3Address... ๐Ÿ“Š Slippage tolerance: 99% โš ๏ธ You are about to sell 3 tokens All tokens will be sold automatically without individual confirmation โ“ Confirm batch sell? (yes/no, default: yes): [Press Enter] โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿš€ Processing token 1/3 Mint: Token1Address... โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿ’ฐ Token Balance: 500,000 tokens โœ… Token 1/3 sold successfully โณ Waiting 2 seconds before next transaction... โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿš€ Processing token 2/3 Mint: Token2Address... โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿ’ฐ Token Balance: 1,000,000 tokens โœ… Token 2/3 sold successfully โณ Waiting 2 seconds before next transaction... โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿš€ Processing token 3/3 Mint: Token3Address... โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿ’ฐ Token Balance: 250,000 tokens โœ… Token 3/3 sold successfully โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐ŸŽ‰ All transactions completed! โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ``` -------------------------------- ### Example Output: Unlock Wallet (Option U) Source: https://github.com/0xfnzero/fnzsafe/blob/main/INTERACTIVE_TUTORIAL.md Shows the expected output when unlocking a wallet. After unlocking, the wallet status changes to 'Unlocked' and Solana operations (Options 7-18) become available. ```text ๐Ÿ”“ Unlock Wallet Enter keystore filename [keystore.json]: Enter password: ******** โœ… Wallet unlocked successfully! ๐Ÿ“ Current Wallet: 7xKm...9xW3 ๐Ÿ”’ Wallet Status: Unlocked You can now perform Solana operations (Options 7-18) ``` -------------------------------- ### Test operations on devnet Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Interactive safekey command to unlock a wallet, query balance, and transfer SOL. ```bash ./your-bot safekey # Select: Unlock wallet โ†’ Query balance โ†’ Transfer SOL ``` -------------------------------- ### Bootstrap and Generate Flutter Bridge Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/mobile/README.md Run these commands from apps/mobile after installing the Flutter SDK. They bootstrap the mobile tooling, install flutter_rust_bridge_codegen, and generate the bridge code. ```sh ./tool/bootstrap_mobile.sh cargo install flutter_rust_bridge_codegen ./tool/generate_bridge.sh ``` -------------------------------- ### Single Token Sell Example Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shows the interactive CLI flow for selling a single token on PumpSwap. Requires an unlocked wallet or keystore/password, an RPC URL, and a token mint address. Defaults to seed-optimized ATA and 99% slippage; confirms before sending. ```text ๐Ÿ”ฅ PumpSwap Sell Tokens [If not unlocked] Keystore path: keystore.json Password: ************ Enter RPC URL: https://api.mainnet-beta.solana.com โ“ Enable Seed Optimization? (yes/no, default: yes): [Press Enter] โœ… Seed optimization enabled Token Mint Address: TokenMintAddressHere... ๐Ÿ“‹ Found 1 token(s) to sell: 1. TokenMintAddressHere... ๐Ÿ“Š Slippage tolerance: 99% ๐Ÿ’ฐ Checking token balance... โœ… Token balance: 1,000,000 tokens (6 decimals) โ“ Confirm sell all? (yes/no, default: yes): [Press Enter] ๐Ÿ“Š Fetching PumpSwap pool parameters... โœ… Pool found! ๐Ÿš€ Sending transaction... โœ… Sell successful! Transaction signature: 5J7W8vN2BxC9K4... ``` -------------------------------- ### Get devnet SOL via airdrop Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Request devnet SOL for testing. Replace
with your wallet address. Use the --url devnet flag to target the devnet cluster. ```bash solana airdrop 2
--url devnet ``` -------------------------------- ### Insecure Password Handling (Never Do This) Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Shows an insecure approach using environment variables, which can be leaked. Avoid this pattern. ```bash # DON'T: Environment variables can be leaked export WALLET_PASSWORD="mysecret" ./your-bot ``` -------------------------------- ### Create and use multiple keystores Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Create separate keystores for trading and holding wallets, then unlock the specific wallet. Each safekey command creates an encrypted keystore file. ```bash # Trading wallet ./bot safekey # Create encrypted โ†’ keystore-trading.json # Holding wallet ./bot safekey # Create encrypted โ†’ keystore-holding.json # Use specific wallet ./bot safekey # Unlock โ†’ keystore-trading.json ``` -------------------------------- ### Build bot with solana-ops feature Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Compiles the bot in release mode with the solana-ops feature enabled, as required for Solana operations. ```bash cargo build --features solana-ops --release ``` -------------------------------- ### Add safekey interactive command to main() Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Checks for the 'safekey' CLI argument and launches the fnzero-safe interactive menu before bot logic. Exits with an error message if the menu fails. ```rust use anyhow::Result; fn main() -> Result<()> { // Check if running in safekey interactive mode let args: Vec = std::env::args().skip(1).collect(); if args.first().map(|s| s.as_str()) == Some("safekey") { // Launch fnzero-safe interactive menu if let Err(e) = fnzero_safe::interactive::show_main_menu() { eprintln!("โŒ {}", e); std::process::exit(1); } return Ok(()); } // Your bot logic starts here... println!("๐Ÿค– Starting bot..."); Ok(()) } ``` -------------------------------- ### Create New Wallet with KeyManager Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Generates a new keypair, prints its public key, and saves it as an encrypted JSON keystore file. The password is provided as a function argument. The keystore is written to `keystore.json`. ```rust use fnzero_safe::KeyManager; fn create_wallet(password: &str) -> Result<()> { // Generate new keypair let keypair = KeyManager::generate_keypair(); println!("๐Ÿ“ Wallet Address: {}", keypair.pubkey()); // Encrypt and save let json = KeyManager::keypair_to_encrypted_json(&keypair, password)?; std::fs::write("keystore.json", json)?; println!("โœ… Encrypted wallet saved to keystore.json"); Ok(()) } ``` -------------------------------- ### Robust Bot Logic with Error Handling in Rust Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Use this snippet to implement robust bot logic with error handling using anyhow's Context for wallet loading and client initialization. It loads a wallet from keystore.json, connects to Solana mainnet with retry logic, and handles balance retrieval errors gracefully. ```rust use anyhow::{Context, Result}; fn robust_bot_logic() -> Result<()> { // Load wallet with context let keypair = load_wallet() .context("Failed to load wallet from keystore.json")?; // Initialize client with retry logic let client = SolanaClient::new_with_retry("https://api.mainnet-beta.solana.com") .context("Failed to connect to Solana network")?; // Perform operations with error handling match client.get_sol_balance(&keypair.pubkey()) { Ok(balance) => println!("Balance: {}", balance), Err(e) => eprintln!("Failed to get balance: {}", e), } Ok(()) } ``` -------------------------------- ### Automate password input via stdin Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Pipe the password into the bot command to automate deployment. Only use in secure environments; never hardcode passwords. ```bash # Create startup script echo "your-password" | ./your-bot ``` -------------------------------- ### Load Encrypted Wallet with KeyManager Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Reads an encrypted keystore file and decrypts it using a password read from stdin. Requires the `fnzero_safe` crate and a `keystore.json` file. The password is trimmed of whitespace before decryption. ```rust use fnzero_safe::KeyManager; use std::io::{self, Read}; fn load_wallet() -> Result { let wallet_path = "keystore.json"; // Read encrypted keystore let json = std::fs::read_to_string(wallet_path)?; // Read password from stdin let mut password = String::new(); io::stdin().read_to_string(&mut password)?; let password = password.trim(); // Decrypt and load keypair let keypair = KeyManager::keypair_from_encrypted_json(&json, password)?; Ok(keypair) } ``` -------------------------------- ### Use Solana Operations in Bot Logic Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Initializes a Solana client on devnet, checks the SOL balance, transfers SOL if the balance exceeds 0.01, and wraps SOL to WSOL. Requires a funded keypair and a valid recipient address. The transfer amount is fixed at 0.01 SOL and the wrap amount at 0.1 SOL. ```rust use fnzero_safe::solana_ops::SolanaClient; fn bot_logic(keypair: &solana_sdk::signature::Keypair) -> Result<()> { // Initialize Solana client let client = SolanaClient::new("https://api.devnet.solana.com")?; // Check balance let balance = client.get_sol_balance(&keypair.pubkey())?; println!("๐Ÿ’ฐ Balance: {} SOL", balance); // Transfer SOL if balance > 0.01 { let recipient = "RECIPIENT_ADDRESS_HERE".parse()?; let signature = client.transfer_sol(keypair, &recipient, 0.01)?; println!("โœ… Transfer successful: {}", signature); } // Wrap SOL to WSOL let signature = client.wrap_sol(keypair, 0.1)?; println!("โœ… Wrapped 0.1 SOL: {}", signature); Ok(()) } ``` -------------------------------- ### Add fnzero-safe dependency in Cargo.toml Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Adds the fnzero-safe crate as a path dependency and enables the solana-ops feature by default. Required before integrating the safekey command. ```toml [dependencies] fnzero-safe = { path = "../fnzero-safe" } [features] default = ["solana-ops"] solana-ops = ["fnzero-safe/solana-ops"] ``` -------------------------------- ### Secure Password Handling via stdin Pipe Source: https://github.com/0xfnzero/fnzsafe/blob/main/BOT_INTEGRATION.md Passes the password through stdin pipe so it exists only in memory and is never stored in files or environment variables. ```bash # Password through stdin pipe - memory only echo "your-password" | ./your-bot ``` -------------------------------- ### Create Encrypted Keypair - Terminal Interaction Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shows generating an AES-256 encrypted keypair with PBKDF2 key derivation via main menu option 2. Requires a password of at least 10 characters and confirmation. Saves as a Keystore file and warns that the password cannot be recovered. ```text ๐Ÿ” Encrypted Keypair Options: 1. Generate new keypair and encrypt 2. Import existing private key and encrypt Select [1/2]: 1 ๐Ÿ”’ Set encryption password (min 10 characters): New password: ************ Confirm password: ************ โœ… Password accepted! Output format: 1. Save as Keystore file (recommended) 2. Display encrypted string Select [1/2]: 1 File path (default: wallet.json): keystore.json โœ… Keystore created successfully! ๐Ÿ“ Public Key: E7Rmd6piasPNs9jqRBUfS8nvNqDx6j5qPDE6Le7us5bp ๐Ÿ“ Location: keystore.json โš ๏ธ IMPORTANT: Remember your password! It cannot be recovered. ``` -------------------------------- ### Development commands for FnzSafe Chrome extension Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/extension/README.md Run these commands in the apps/extension directory to install dependencies, typecheck, test, and build the extension. After building, load apps/extension/dist as an unpacked extension from chrome://extensions. ```bash npm install npm run typecheck npm test npm run build ``` -------------------------------- ### Language selection menu output Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shown upon launching fnzero-safe; prompts the user to choose between English and Chinese before the main menu appears. ```text ================================================== Language / ่ฏญ่จ€้€‰ๆ‹ฉ ================================================== 1. English 2. ไธญๆ–‡ Select / ้€‰ๆ‹ฉ [1/2]: ``` -------------------------------- ### Default wallet database path Source: https://github.com/0xfnzero/fnzsafe/blob/main/UI_USER_GUIDE.md The default wallet database location for the desktop app. It contains encrypted wallet records and local metadata and is ignored by Git. Passwords are not persisted by the frontend. ```text apps/desktop/data/fnzero-safe.sqlite3 ``` -------------------------------- ### Create Plain Text Keypair - Terminal Interaction Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Walks through generating an unencrypted keypair via the main menu option 1. Not recommended for production because keys are stored in plain text. Shows selecting generation method, output format, and saving to a JSON file. ```text ๐Ÿ“ Plain Text Keypair Options: 1. Generate new keypair 2. Import existing private key Select [1/2]: 1 โœ… Keypair generated successfully! ๐Ÿ“ Public Key: E7Rmd6piasPNs9jqRBUfS8nvNqDx6j5qPDE6Le7us5bp Output format: 1. Save as JSON file 2. Display base58 private key Select [1/2]: 1 File path (default: wallet.json): test-wallet.json โœ… Saved to test-wallet.json ``` -------------------------------- ### Pump.fun Sell CLI command Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Sell all Pump.fun bonding-curve tokens for SOL in one transaction. Requires an unlocked wallet with the token in an ATA and sufficient SOL for fees. Only for tokens still on Pump.fun; use PumpSwap Sell for migrated tokens. ```bash ./your-bot safekey pumpfun-sell --mint ``` -------------------------------- ### Decrypt Encrypted Keypair - Terminal Interaction Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shows decrypting an encrypted keypair via main menu option 3. Supports loading from a Keystore file or pasting an encrypted string, then requires the decryption password. Output can be displayed only or saved as plain JSON. ```text ๐Ÿ”“ Decrypt Encrypted Keypair Source: 1. Keystore file 2. Encrypted string Select [1/2]: 1 Keystore file path: keystore.json ๐Ÿ”‘ Enter decryption password: ************ โœ… Decrypted successfully! ๐Ÿ“ Public Key: E7Rmd6piasPNs9jqRBUfS8nvNqDx6j5qPDE6Le7us5bp Output: 1. Display only 2. Save as plain JSON Select [1/2]: 1 Private Key (base58): 5JW8... ``` -------------------------------- ### Unlock Wallet Session - Terminal Interaction Source: https://github.com/0xfnzero/fnzsafe/blob/main/USER_GUIDE.md Shows unlocking an encrypted wallet for the current session via main menu option U or u. After unlocking, all Solana operations can be used without re-entering the password for the session. ```text ๐Ÿ”“ Unlock Wallet Keystore file path [keystore.json]: keystore.json ๐Ÿ”‘ Enter wallet password: ************ โœ… Wallet unlocked successfully! ๐Ÿ“ Address: E7Rmd6piasPNs9jqRBUfS8nvNqDx6j5qPDE6Le7us5bp You can now use all Solana operations without re-entering password. ``` -------------------------------- ### Verify commands Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Run formatting, tests, and linting for the workspace and desktop app. ```bash cargo fmt --all -- --check cargo test --workspace npm --prefix apps/desktop run test:unit npm --prefix apps/desktop run lint ``` -------------------------------- ### Package artifacts for all platforms Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Builds platform-specific packages and copies artifacts into `release//`. Use `make package` to build every platform supported by the current host. ```bash make package-macos make package-windows make package-ios make package-android ``` -------------------------------- ### Build and package FnzSafe desktop app with make build-macos, package-macos, package-windows Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/README.md Run these commands from the repository root. `make build-macos` is a local unsigned desktop build. `make package-macos` is a distribution build requiring a Developer ID Application identity in APPLE_SIGNING_IDENTITY plus complete Apple notarization credentials; it rejects output unless codesign, stapled notarization ticket, and Gatekeeper validate. Apple Development certificates are for development only and cannot be used for public download. ```bash make build-macos ``` ```bash make package-macos ``` ```bash make package-windows ``` -------------------------------- ### binance_x402_resource_payment_execute Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/ai-runtime/skills/binance-web3-wallet-trading/SKILL.md Executes a payment for a previously previewed resource. It signs once, waits for any required approval, and replays the exact bound request once; never retry it automatically. ```APIDOC ## binance_x402_resource_payment_execute ### Description Executes a payment for a previously previewed resource. It signs once, waits for any required approval, and replays the exact bound request once; never retry it automatically. ### Method Tool call ### Endpoint binance_x402_resource_payment_execute ### Parameters - **preview** (object) - Required - The preview object returned by `binance_x402_resource_payment_preview`. - **confirm** (string) - Required - The exact confirmation token matching the preview. ### Response #### Success Response - **orderId** (string) - The order identifier. - **strategyId** (string) - The strategy identifier. - **requestId** (string) - The request identifier. - **transactionId** (string) - The transaction identifier. #### Response Example { "orderId": "ord_123", "strategyId": "strat_456", "requestId": "req_789", "transactionId": "txn_abc" } ``` -------------------------------- ### binance_x402_resource_payment_preview Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/ai-runtime/skills/binance-web3-wallet-trading/SKILL.md Previews a payment for a user-named public HTTPS resource. It binds the original request, HTTP 402 challenge, selected option, and replay target into one preview, showing the selected chain, asset, amount, payee, approval requirement, and expiry. ```APIDOC ## binance_x402_resource_payment_preview ### Description Previews a payment for a user-named public HTTPS resource. It binds the original request, HTTP 402 challenge, selected option, and replay target into one preview, showing the selected chain, asset, amount, payee, approval requirement, and expiry. ### Method Tool call ### Endpoint binance_x402_resource_payment_preview ### Parameters - **resource** (string) - Required - The user-named public HTTPS resource. - **request** (object) - Required - The original request details. - **challenge** (object) - Required - The HTTP 402 challenge payload. - **option** (object) - Required - The selected payment option. - **replayTarget** (string) - Required - The replay target for the bound request. ### Response #### Success Response - **chain** (string) - The selected chain. - **asset** (string) - The selected asset. - **amount** (number) - The amount to pay. - **payee** (string) - The payee address. - **approvalRequired** (boolean) - Whether approval is required. - **expiry** (string) - The expiry timestamp. #### Response Example { "chain": "ethereum", "asset": "USDC", "amount": 10.5, "payee": "0x...", "approvalRequired": true, "expiry": "2025-01-01T00:00:00Z" } ``` -------------------------------- ### Run mobile app on iOS or Android Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Bootstraps the mobile environment, fetches Flutter dependencies, generates the bridge, and runs the app on an iOS simulator or Android device. Requires Flutter 3.24+ and Xcode or Android SDK/NDK/JDK 17. ```bash cd apps/mobile ./tool/bootstrap_mobile.sh flutter pub get ./tool/generate_bridge.sh flutter run -d ios # or an Android device ID ``` -------------------------------- ### Compute SHA-256 and byte length of approved .so artifact Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/PROGRAM_DEPLOYMENT.md Run these commands on the machine holding the approved program artifact to independently compute its SHA-256 digest and byte length. The resulting 64-character lowercase SHA-256 must exactly match the browser-computed digest and the release record. On Linux, sha256sum can replace shasum. Do not replace or rebuild the .so after approval; any byte change requires a new digest and release review. ```bash shasum -a 256 /absolute/path/to/program.so wc -c < /absolute/path/to/program.so ``` -------------------------------- ### Unlock private key from universal mnemonic wallet document Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Calls unlock_private_key_from_document from fnzero_safe_evm_services to derive a wallet and private key from a wallet.json file containing metadata.evm_keystore_json. Requires the file path and password; returns a Result with the wallet and secret key. ```rust use fnzero_safe_evm_services::unlock_private_key_from_document; let (wallet, sk) = unlock_private_key_from_document(&std::fs::read_to_string("wallet.json")?, "password")?; ``` -------------------------------- ### Add fnzero-safe Rust SDK crates to Cargo.toml Source: https://github.com/0xfnzero/fnzsafe/blob/main/README.md Declares the three fnzero-safe crates as dependencies: fnzero-safe-core 0.1.8, fnzero-safe-chain-core 0.1.0, and fnzero-safe-evm-services 0.1.1. Use this in your Cargo.toml to access the Solana keystore/CLI/bot helper, shared chain adapter traits, and EVM keystore unlock functionality. ```toml fnzero-safe-core = "0.1.8" fnzero-safe-chain-core = "0.1.0" fnzero-safe-evm-services = "0.1.1" ``` -------------------------------- ### FnzSafe desktop directory layout Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/README.md Shows the directory structure of the apps/desktop directory: Next.js application, local Axum API, Tauri shell, assets, and scripts. Wallet data is stored locally in apps/desktop/data/ by default and is ignored by Git. ```text apps/desktop/src/ Next.js application and translations crates/desktop-api/src/ Local Axum API and wallet persistence apps/desktop/src-tauri/ Tauri desktop shell and secure API bridge apps/desktop/public/ Token and application assets apps/desktop/scripts/ Development and security checks ``` -------------------------------- ### Unlock Solana wallet with bot_helper::unlock_wallet Source: https://github.com/0xfnzero/fnzsafe/blob/main/crates/core/README.md Imports and calls unlock_wallet from the bot_helper module, passing a path to a Solana keystore file. Returns a keypair or an error. ```rust use fnzero_safe::bot_helper::unlock_wallet; let keypair = unlock_wallet("/path/to/solana-keystore.json")?; ``` -------------------------------- ### Add fnzero-safe-core dependency (Cargo.toml) Source: https://github.com/0xfnzero/fnzsafe/blob/main/crates/core/README.md Declares the fnzero-safe-core crate version 0.1.8 as a dependency in Cargo.toml. ```toml fnzero-safe-core = "0.1.8" ``` -------------------------------- ### ้ชŒ่ฏ AI ่ฟ่กŒๆ—ถ๏ผˆprepareใ€self-testใ€live test๏ผ‰ Source: https://github.com/0xfnzero/fnzsafe/blob/main/docs/ai-plugin-architecture.md ็”จไบŽๅ•็‹ฌ้ชŒ่ฏ AI ่ฟ่กŒๆ—ถ๏ผšๅ…ˆๅฎ‰่ฃ…้”ๅฎš็š„ sidecar ไพ่ต–ๅนถๅคๅˆถ Node ๅฏๆ‰ง่กŒๆ–‡ไปถ๏ผŒๅ†ๆ‰ง่กŒ็ฆป็บฟ็ป“ๆž„ๆ ก้ชŒ `--self-test`๏ผŒๆœ€ๅŽ้€š่ฟ‡ๆ ‡ๅ‡† MCP ๅฎขๆˆท็ซฏ่”็ฝ‘่ฐƒ็”จๅ…จ้ƒจๅทฅๅ…ท่ทฏๅพ„ใ€‚ ```bash cd apps/desktop npm run prepare:ai-runtime node ai-runtime/run.mjs --self-test npm run test:ai-runtime-live ``` -------------------------------- ### Unlock a universal or EVM keystore with unlock_private_key_from_document Source: https://github.com/0xfnzero/fnzsafe/blob/main/crates/evm-services/README.md Reads a keystore JSON file and unlocks the private key using the provided password. Returns a wallet and a Zeroizing> private key; never log or persist the key. Universal FnzSafe exports embedding metadata.evm_keystore_json are accepted directly. ```rust use fnzero_safe_evm_services::unlock_private_key_from_document; let json = std::fs::read_to_string("MyWallet-mnemonic-keystore.json")?; let (wallet, sk) = unlock_private_key_from_document(&json, "password")?; println!("address={}", wallet.address); // `sk` is Zeroizing> โ€” never log or persist it. ``` -------------------------------- ### Stop all local FnzSafe development processes with make stop Source: https://github.com/0xfnzero/fnzsafe/blob/main/apps/desktop/README.md Run before packaging to stop all local FnzSafe development processes. The Chinese note says 'ๆ‰“ๅŒ…ๅ‰ๅœๆญขๅ…จ้ƒจๆœฌๅœฐๅผ€ๅ‘่ฟ›็จ‹' (stop all local development processes before packaging). ```bash make stop ``` -------------------------------- ### unlock_private_key_from_document Source: https://github.com/0xfnzero/fnzsafe/blob/main/crates/evm-services/README.md Unlocks a universal or EVM keystore from its JSON document and returns the wallet address and private key. The private key is returned as a Zeroizing> to prevent accidental exposure. ```APIDOC ## unlock_private_key_from_document ### Description Unlocks a universal or EVM keystore from its JSON document and returns the wallet address and private key. The private key is returned as a Zeroizing> to prevent accidental exposure. ### Method Function ### Signature ```rust pub fn unlock_private_key_from_document(json: &str, password: &str) -> Result<(Wallet, Zeroizing>), Error> ``` ### Parameters - **json** (string) - Required - The JSON document of the keystore. - **password** (string) - Required - The password to unlock the keystore. ### Returns - **wallet** (Wallet) - The wallet object containing the address. - **sk** (Zeroizing>) - The private key, zeroized on drop. ### Example ```rust use fnzero_safe_evm_services::unlock_private_key_from_document; let json = std::fs::read_to_string("MyWallet-mnemonic-keystore.json")?; let (wallet, sk) = unlock_private_key_from_document(&json, "password")?; println!("address={}", wallet.address); // `sk` is Zeroizing> โ€” never log or persist it. ``` ``` -------------------------------- ### Add fnzero-safe-evm-services dependency Source: https://github.com/0xfnzero/fnzsafe/blob/main/crates/evm-services/README.md Add the fnzero-safe-evm-services crate to your Cargo.toml. Version 0.1.1 provides EVM wallet services for FnzSafe. ```toml fnzero-safe-evm-services = "0.1.1" ```