Translated Topic in Pidgin Language;
Antproxy -- Bitcoin mining proxy + log/monitoring script Original Topic: Antproxy -- Bitcoin mining proxy + log/monitoring scriptAuthor:
mikeywith
Fo people wey get interest to use di mining proxy wey dey work wit di plenty mining pools wey get di nice GUI and na very stable -- I go suggest
Antproxy, yes, no matter how much I take hate Bitmain, I see dere proxy to be di most stable free proxy fo out dere, and I don dey use am fo few years now and I no get issue wit am (e dey crash like once every few month fo reason wey i never confirm yet, but I write d script to "fix" am and I don include am for down)

na like dis GUI look.
Di
installation no be wahala
Log scriptimport requests
import subprocess
import time
import traceback
# Construct the path for the log file in the "Documents" folder
log_file_path = r'C:\Users\Public\Documents\log_file.txt'
def log(message):
try:
with open(log_file_path, 'a') as log_file:
log_file.write(message + '\n')
except PermissionError as e:
print(f"PermissionError: {e}")
traceback.print_exc()
except Exception as ex:
print(f"Exception during logging: {ex}")
traceback.print_exc()
def restart_windows():
try:
print("Restarting Windows in 15 seconds...")
time.sleep(15)
subprocess.run(['shutdown', '/r', '/t', '1'])
except Exception as e:
log(f"Exception during restart_windows: {e}")
traceback.print_exc()
def check_hashrate():
try:
# Get current date and time
current_datetime = time.strftime("%Y-%m-%d %H:%M:%S")
# Send an HTTP request
response = requests.get('http://127.0.0.1:4444/proxies.json')
# Parse the JSON data
data = response.json()
hashrate = data['Hashrate']
print(f"{current_datetime} - Hashrate: {hashrate}")
log(f"{current_datetime} - Hashrate: {hashrate}") # Log date/time and hashrate information
if hashrate <= 3:
log("Hashrate is below 2. Restarting Windows...")
restart_windows()
except Exception as ex:
# Log the exception message with stack trace
log(f"Exception during check_hashrate: {ex}")
traceback.print_exc()
def check_ping():
try:
# Get current date and time
current_datetime = time.strftime("%Y-%m-%d %H:%M:%S")
# Send a ping request
response = subprocess.run(['ping', '-n', '1', 'www.google.com'], capture_output=True, text=True)
# Extract average ping result from the response
ping_result = response.stdout.splitlines()[-1].split('=')[-1].strip()
print(f"{current_datetime} - Ping Result: {ping_result}")
log(f"{current_datetime} - Ping Result: {ping_result}") # Log date/time and average ping result
except Exception as ex:
# Log the exception message with stack trace
log(f"Exception during check_ping: {ex}")
traceback.print_exc()
try:
while True:
# Check hashrate every 60 seconds
check_hashrate()
# Check ping to www.google.com every 10 seconds
for _ in range(6):
check_ping()
time.sleep(10)
except KeyboardInterrupt:
print("\nScript stopped by user.")
except Exception as ex:
# Log any unexpected exception
log(f"Unexpected exception: {ex}")
traceback.print_exc()
# Pause before exiting
time.sleep(5)
After di years wey I use am, I con discover say e no get one major function and naem be "logs", if somethin happen you jus get noway to know wetin em be or when e happen, also as mention fo up in di rare event of di proxy freezing or throwing some error which usually na network wey no dey work, di script go reboot di PC bcos dat be like di most easy fix for di freezing issue since closing/reopning di proxy may not fix all di issues.
Di above script go do di following:
1-log di proxy info to C:\Users\Public\Documents\log_file.txt >> you fit change di txtfile or remove di whole function if you want.
2-Get di current hashrate report by di proxy fo every 60 seconds, display and log di results -- restart di PC if di hashrate na below x (x is 3PH in di code, you fit change am to whatever yur hashrate dey)
3-Ping google fo every 10 seconds, display and log di results
The log file my script make go be like dis

You no need to ping am fo every 10 second, but I like am dis way, I fit come back anytym and see if my internet have drop fo any moment or ping time increases.
You need to make di batch file (a txtfile change to .bat) hosted fo yur startup folder which dey run di script wit di command like
echo off
TIMEOUT /T 600
python C:\Users\M\Desktop\pyton\testscript.py
pause
You go also need to put di shortcut to di proxy executable fo di startup folder so dat e go run when your PC boots.
Di pool I test and remember to work:
Viabtc
Kano.is
Antpool
Binance
*if you get any question wey concern mining proxies in general or di technical issue running dis partiuclar one, feel free to ask am here.