The Hive Engine Token Distribution Script is a Python script designed to retrieve a token's richlist, calculate payouts based on token holdings, and distribute tokens to the respective holders. This script is particularly useful for token creators and managers who want to automate the distribution of tokens to their community.
- 🔒 Secure environment-based configuration
- 📊 Rich table-based output of token distributions
- 🧪 Dry run mode for testing
- 📝 Detailed logging
- ⚡ Rate-limited transactions to prevent API throttling
- 🛡️ Blacklist support for excluded accounts
- 🔄 Automatic floor calculation for token balances
- Python version: >= 3.12
- Required Python packages:
beem
hiveengine
python-dotenv
prettytable
The script is highly configurable through environment variables. You can set these in a .env
file or your system environment:
ACTIVE_WIF
: The active key for token transfersPOSTING_WIF
: The posting key for blockchain interactions
PAYOUT_RATE
: The rate at which tokens are distributed (default:0.250
)TOKEN_QUERY
: The token symbol to query (default:ARCHONM
)TOKEN_NAME
: The name of the token (default:ARCHON
)BLACKLISTED_ACCOUNTS
: Comma-separated list of excluded accounts (default:ufm.pay,upfundme
)NODE_URL
: Hive node URL (default:https://api.hive.blog
)HIVE_ENGINE_API_URL
: Hive Engine API URL (default:https://api.hive-engine.com/rpc/
)DRY_RUN
: Enable dry run mode without broadcasting transactions (set totrue
,1
, oryes
)
-
Set up your environment variables by copying and modifying the example file:
cp .env.example .env # Edit .env with your preferred text editor and add your keys nano .env
-
The script is self-contained and can be executed directly using
uv
for package management:pipx install uv curl -L https://raw.githubusercontent.com/TheCrazyGM/mining-arc/refs/heads/main/src/mining_arc/__init__.py -o mining_arc.py chmod +x mining_arc.py ./mining_arc.py
-
Clone the repository:
git clone https://github.com/TheCrazyGM/mining-arc.git cd mining-arc
-
Install dependencies:
# Using pip pip install -r requirements.txt # Or using uv uv sync
-
Run the script:
python3 mining_arc.py
To test the script without broadcasting transactions:
DRY_RUN=true python3 mining_arc.py
The script uses a modern, class-based architecture for better organization and maintainability:
TokenConfig
: Manages all configuration settings with environment variable supportTokenHolder
: Represents a token holder with their balance and payment calculationsTokenDistributor
: Main class handling all distribution operations
TokenDistributor.get_richlist()
: Retrieves and filters the token holder richlistTokenDistributor.send_transaction()
: Handles individual token transfersTokenDistributor.process_payments()
: Orchestrates the payment distribution processTokenDistributor.display_richlist()
: Generates a formatted table of distributions
The script provides detailed logging with different levels:
- INFO: General operation information
- WARNING: Non-critical issues (e.g., transaction failures)
- ERROR: Critical issues that prevent operation
- DEBUG: Detailed transaction information (when needed)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.