Skip to content

boxed-dev/solana-transfer-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana SOLStream

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.


Key Highlights

  • 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.

⚙️ Core Features

  • Configurable Transfers: Easily set the recipient address and SOL amount within the script.
  • Automatic Keypair Detection: Locates ~/.config/solana/id.json by default, or uses the SOLANA_KEYPAIR environment variable.
  • Comprehensive Error Reporting: Clear feedback for any issues encountered during operation.
  • Transaction Verification: Outputs the transaction signature for on-chain confirmation.

🚀 Setup and Usage

Important: This script requires a Solana keypair file with SOL and access to a Solana RPC node.

Prerequisites

  • Rust (including cargo)
  • Solana CLI Tools (for keypair management if needed)
  • A Solana wallet keypair file (e.g., id.json) with SOL.

Installation & Configuration

  1. Clone the repository or create the script file:
    Ensure you have the main.rs (or your script file) locally.
  2. Environment Variable (Optional):
    For a custom keypair location, set the SOLANA_KEYPAIR environment variable:
    export SOLANA_KEYPAIR=/path/to/your/id.json
    If not set, the script defaults to ~/.config/solana/id.json.
  3. Configure Script Parameters:
    Modify these variables directly in the main.rs file (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

Running the Script

Navigate to the script's directory and run:

cargo run

Ensure your chosen Solana RPC endpoint is accessible. The script defaults to http://127.0.0.1:8899.


🛠️ Advanced Configuration

Custom RPC URL

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());

Dynamic Transfer Amount (Example)

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


🏗️ Future Development

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.

🔍 Troubleshooting

  • Keypair File Not Found: Verify the path to your id.json file. Check SOLANA_KEYPAIR if 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.


💬 Feedback & Contributions

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.

License

This project is licensed under the MIT License.

About

A command-line tool in Rust for easy and secure SOL transfers across Solana networks (mainnet, devnet, local). Features configurable transfers, keypair management, and balance checks. Ideal for developers and direct peer-to-peer transactions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors