Advertisement
Sweetening

HOA Miner

Oct 26th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. import subprocess
  2. import time
  3. import os
  4. import psutil
  5.  
  6. # Configuration
  7. WALLET_ADDRESS = "your_wallet_address_here"
  8. ASSET_ID = "e816ee18ce2337c4128449bc539fbbe2ecfdd2098c4e7cab4667e223c3bdc23d"
  9. POOL_URL = "pool.example.com"
  10. POOL_PORT = "3333"
  11.  
  12. # Command for the mining software with optimizations
  13. MINER_COMMAND = [
  14. "path/to/miner_software", # Replace with actual miner software path
  15. "-o", f"{POOL_URL}:{POOL_PORT}",
  16. "-u", WALLET_ADDRESS,
  17. "-p", "x",
  18. "--asset", ASSET_ID,
  19. "--cuda-block-size", "512", # Example optimization flag
  20. "--gpu", "0,1" # Multi-GPU support, if available
  21. ]
  22.  
  23. def set_high_priority():
  24. """ Sets high priority for the mining process """
  25. try:
  26. # Set process to high priority (adjust per OS)
  27. if os.name == 'nt':
  28. p = psutil.Process(os.getpid())
  29. p.nice(psutil.HIGH_PRIORITY_CLASS)
  30. else:
  31. os.nice(-20) # UNIX high priority
  32. except Exception as e:
  33. print(f"Could not set high priority: {e}")
  34.  
  35. def start_mining():
  36. """ Start mining process and auto-restart on failure """
  37. set_high_priority()
  38. print(f"Starting high-priority mining for wallet {WALLET_ADDRESS} on asset {ASSET_ID}...")
  39.  
  40. while True:
  41. try:
  42. # Start the miner process
  43. process = subprocess.Popen(MINER_COMMAND, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  44.  
  45. # Read miner output in real-time
  46. for line in iter(process.stdout.readline, b''):
  47. print(line.decode().strip())
  48.  
  49. process.stdout.close()
  50. process.wait() # Wait until mining process exits
  51.  
  52. if process.returncode != 0:
  53. print("Miner interrupted. Restarting to maximize uptime.")
  54.  
  55. except Exception as e:
  56. print(f"Error occurred: {e}")
  57. time.sleep(2) # Short delay before retrying
  58.  
  59. # Start mining
  60. start_mining()
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement