Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import time
- import os
- import psutil
- # Configuration
- WALLET_ADDRESS = "your_wallet_address_here"
- ASSET_ID = "e816ee18ce2337c4128449bc539fbbe2ecfdd2098c4e7cab4667e223c3bdc23d"
- POOL_URL = "pool.example.com"
- POOL_PORT = "3333"
- # Command for the mining software with optimizations
- MINER_COMMAND = [
- "path/to/miner_software", # Replace with actual miner software path
- "-o", f"{POOL_URL}:{POOL_PORT}",
- "-u", WALLET_ADDRESS,
- "-p", "x",
- "--asset", ASSET_ID,
- "--cuda-block-size", "512", # Example optimization flag
- "--gpu", "0,1" # Multi-GPU support, if available
- ]
- def set_high_priority():
- """ Sets high priority for the mining process """
- try:
- # Set process to high priority (adjust per OS)
- if os.name == 'nt':
- p = psutil.Process(os.getpid())
- p.nice(psutil.HIGH_PRIORITY_CLASS)
- else:
- os.nice(-20) # UNIX high priority
- except Exception as e:
- print(f"Could not set high priority: {e}")
- def start_mining():
- """ Start mining process and auto-restart on failure """
- set_high_priority()
- print(f"Starting high-priority mining for wallet {WALLET_ADDRESS} on asset {ASSET_ID}...")
- while True:
- try:
- # Start the miner process
- process = subprocess.Popen(MINER_COMMAND, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- # Read miner output in real-time
- for line in iter(process.stdout.readline, b''):
- print(line.decode().strip())
- process.stdout.close()
- process.wait() # Wait until mining process exits
- if process.returncode != 0:
- print("Miner interrupted. Restarting to maximize uptime.")
- except Exception as e:
- print(f"Error occurred: {e}")
- time.sleep(2) # Short delay before retrying
- # Start mining
- start_mining()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement