3.0.3 • Published 2 months ago
solana-bulk-transfer v3.0.3
Solana Batch Transfer Script Updates
Update Overview
This document provides a summary of two optimization updates made to the Solana batch transfer script.
Update
- Error Handling: Added more detailed error handling to provide more information when transactions fail.
- Logging: Implemented logging functionality to track the transaction process and outcomes.
- Configuration File: Introduced a configuration file to manage private keys and transfer targets, enhancing security and flexibility.
Transaction Confirmation: Added checks for transaction confirmation status to ensure successful submission to the blockchain.
Configuration Validation: Ensured all necessary information in the configuration file is complete and valid.
- Enhanced Security: Avoided direct use of private keys in the code, instead introducing them through environment variables or external secure storage.
- Transaction Building Optimization: Implemented logic to create multiple transactions in batches for a large number of transfers to avoid transactions being too large.
- Transaction Status Monitoring: Added monitoring of transaction status after sending until final confirmation.
Update
Balance Check Before Transactions
- Implemented a balance check to ensure the sender's account has sufficient funds to cover the total transfer amounts and transaction fees.
Real-Time Transaction Feedback
- Added real-time feedback on the status of transactions, providing updates until each transaction is confirmed or fails.
Retry Mechanism
- Introduced an automatic retry mechanism for transactions that fail due to network issues or other non-permanent errors.
Memory Usage Optimization
- Optimized memory usage for handling large numbers of transfers, particularly during transaction construction.
Dynamic Configuration File Loading
- Allowed users to specify the configuration file path via command-line arguments, rather than hardcoding it within the script.
Concurrent Batch Processing
- Utilized
Promise.all
to process multiple transfers in parallel, improving efficiency.
Summary Report
- Provided a summary report after all transfers are completed, detailing the number of successful and failed transfers.
Security Enhancements
- Encouraged the use of environment variables for sensitive information such as private keys, avoiding direct storage in the codebase.
Usage
To use the updated script:
- Install the necessary dependencies.
- Set up the
.env
file with thePRIVATE_KEY
variable. - Adjust the
config.json
file with the desired transfer targets. - Run the script with the optional command-line argument for the config file path.
Security Tips
- Do not store private keys directly in the code repository.
- Use environment variables or a secure key management system to handle private keys.
- Ensure the
.env
file is not committed to the version control system.
How to Use
- Install necessary dependencies, such as
@solana/web3.js
anddotenv
. - Create a
.env
file and set thePRIVATE_KEY
environment variable. - Adjust the transfer targets in the
config.json
file as needed. - Run the script to perform batch transfers.
Support
Thank you for using our Solana batch transfer script!