A command-line tool built with Rust for transferring SOL on the Solana blockchain.
SOLStream provides a straightforward way to send SOL, suitable for development, testing across networks, or direct peer-to-peer transfers.
It's designed for reliability and ease of use, serving as a solid base for more advanced Solana wallet and asset management functionalities.
[!IMPORTANT]
Handle Your Keys Responsibly: This script interacts with your Solana wallet and private keys.
Ensure your keypair file is kept secure and that you understand the implications of any transactions you authorize.
The developers are not responsible for any loss of funds if you modify, self-host, or misuse the script.
Direct SOL Transfers: Send SOL to any Solana address efficiently.Network Agnostic: Works with local testnets, devnet, and mainnet-beta.Secure Keypair Handling: Loads your standard Solana keypair file.Balance Verification: Checks sender's balance before attempting a transfer.Clear Confirmation: Provides transaction signature upon successful execution.Rust Powered: Offers performance and safety for blockchain interactions.
Configurable Transfers: Easily set the recipient address and SOL amount within the script.Automatic Keypair Detection: Locates~/.config/solana/id.jsonby default, or uses theSOLANA_KEYPAIRenvironment variable.Comprehensive Error Reporting: Clear feedback for any issues encountered during operation.Transaction Verification: Outputs the transaction signature for on-chain confirmation.
Important: This script requires a Solana keypair file with SOL and access to a Solana RPC node.
Rust(includingcargo)Solana CLI Tools(for keypair management if needed)- A
Solana wallet keypair file(e.g.,id.json) with SOL.
- Clone the repository or create the script file:
Ensure you have themain.rs(or your script file) locally. - Environment Variable (Optional):
For a custom keypair location, set theSOLANA_KEYPAIRenvironment variable:If not set, the script defaults toexport SOLANA_KEYPAIR=/path/to/your/id.json~/.config/solana/id.json. - Configure Script Parameters:
Modify these variables directly in themain.rsfile (or your script's main function):// Define the recipient address let recipient_address = "9VsY3Q9cPPiFf9984XJFXG7UEYdAUWpD1wuycvowprDm"; // Set recipient // Define the amount to transfer (in lamports) let transfer_amount = 1_000_000_000; // Example: 1 SOL - Set amount
Navigate to the script's directory and run:
cargo runEnsure your chosen Solana RPC endpoint is accessible. The script defaults to http://127.0.0.1:8899.
To connect to a specific Solana cluster (e.g., devnet, mainnet-beta), change the RpcClient initialization in your script:
// Example for Mainnet-Beta
let rpc_client = RpcClient::new("https://api.mainnet-beta.solana.com".to_string());
// Example for Devnet
// let rpc_client = RpcClient::new("https://api.devnet.solana.com".to_string());You can modify the script to read the transfer amount from an environment variable:
// In main():
// use std::env;
let transfer_amount_str = env::var("TRANSFER_AMOUNT")
.expect("TRANSFER_AMOUNT environment variable not set");
let transfer_amount: u64 = transfer_amount_str
.parse()
.expect("TRANSFER_AMOUNT must be a valid number");Then run with: TRANSFER_AMOUNT=500000000 cargo run
SOLStream aims to evolve with more features, potentially including:
- Interactive command-line options for easier use.
- Support for batch operations, such as transfers to multiple addresses.
- Wallet generation and management utilities.
- Keypair File Not Found: Verify the path to your
id.jsonfile. CheckSOLANA_KEYPAIRif used. - Insufficient Funds: Ensure the sender's wallet has enough SOL on the target network.
- Invalid Recipient Address: Double-check the recipient's Solana address.
- RPC Connection Issues: Confirm the RPC URL is correct and the node is accessible. Public nodes may have rate limits.
For general Solana questions, consult the Solana Documentation.
Contributions and feedback are welcome.
- Please open an issue on the GitHub repository.
- For contributions, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License.