Bitcoin Forum
April 30, 2024, 11:26:29 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Antproxy -- Bitcoin mining proxy + log/monitoring script  (Read 160 times)
mikeywith (OP)
Legendary
*
Offline Offline

Activity: 2212
Merit: 6366


be constructive or S.T.F.U


View Profile
February 14, 2024, 10:27:51 PM
Merited by paid2 (3), NotFuzzyWarm (2), ABCbits (2), BitMaxz (1)
 #1

For those who are interested in using a mining proxy that works with most mining pools has a nice GUI and is very stable -- I would recommend Antproxy, yes, despite how much I hate Bitmain, I find their proxy to be the most stable free proxy out there, and I have been using it for a few years now without an issue (it does crash like once every a few months for reasons which I have not confirmed yet, but I wrote a script to "fix" it and it's included below)



Here is how the GUI looks.

The installation is rather simple


Log script

Code:
import 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 years of using it, I found it's missing a major function which is "logs", if something happens you just have noway of knowing what was it or when did it happen, also as mentioned above in the rare events of the proxy freezing or throwing some error which is usually due to internet connection loss, the script will reboot the PC because that seems like the easiest fix for the freezing issue given that closing/reopning the proxy might not fix all issues.



The above script will do the following:

1-log the proxy info to C:\Users\Public\Documents\log_file.txt >> you can change the txtfile or remove the whole function if you want.
2-Get the current hashrate reported by the proxy every 60 seconds, display and log the results -- restart the PC if the hashrate is below x (x is 3PH in the code, you may change it to whatever your hashrate is)
3-Ping google every 10 seconds, display and log the results


The log file my scprit creates will be like this





You may not need to ping every 10 seconds, but I like it this way, I can come back anytime and see if my internet has dropped at any moment or ping time increases.

Obivosully you need to create a a batch file (a txtfile change to .bat) hosted in your startup folder which runs the script with a command like

Code:
echo off
TIMEOUT /T 600
python C:\Users\M\Desktop\pyton\testscript.py
pause

You would also need to put a shortcut to the proxy executable in the startup folder so that it runs when your PC boots.


Pools I have tested and remember to work:

Viabtc
Kano.is
Antpool
Binance


*if you have any questions regarding mining proxies in general or a technical issue running this partiuclar one, feel free to ask here.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Biffa
Legendary
*
Offline Offline

Activity: 3220
Merit: 1220



View Profile
February 16, 2024, 03:21:33 PM
 #2

Yes it is one of the better options out there, I've used it since about 2020

I'm not sure if they still do it, but If you contact support they will give you a nifty curl link to install the Linux version which ran pretty stable last time I tried it.


Mine @ pools that pay Tx fees & don't mine empty blocks :: kanopool :: ckpool ::
Should bitmain create LPM for all models?
:: Dalcore's Crypto Mining H/W Hosting Directory & Reputation ::
johnscl
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
March 21, 2024, 01:32:39 AM
 #3

I came across this a few weeks ago and have been implementing.  

Do you know what the Locker Mode is for LTC, or the BPS mode?

It runs BTC fine, but when I use LTC, it starts throwing errors.. (I am trying to just run Scrypt pool, and not actually LTC pool...)

Thanks,
J
NotFuzzyWarm
Legendary
*
Offline Offline

Activity: 3612
Merit: 2509


Evil beware: We have waffles!


View Profile
March 21, 2024, 02:31:04 AM
 #4

I came across this a few weeks ago and have been implementing.  

Do you know what the Locker Mode is for LTC, or the BPS mode?
It runs BTC fine, but when I use LTC, it starts throwing errors.. (I am trying to just run Scrypt pool, and not actually LTC pool...)
Thanks,
J
Considering this area is exclusively for Bitcoin, why would you think anyone here would know much less care what the proxy does when trying to use it with an altcoin?

Perhaps try asking in the altcoin areas where folks there DO know and care about it...

- For bitcoin to succeed the community must police itself -    My info useful? Donations welcome! 1FuzzyWc2J8TMqeUQZ8yjE43Rwr7K3cxs9
 -Sole remaining active developer of cgminer, Kano's repo is here
-Support Sidehacks miner development. Donations to:   1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr
mikeywith (OP)
Legendary
*
Offline Offline

Activity: 2212
Merit: 6366


be constructive or S.T.F.U


View Profile
March 22, 2024, 01:26:22 AM
 #5

I came across this a few weeks ago and have been implementing.  

Do you know what the Locker Mode is for LTC, or the BPS mode?

It runs BTC fine, but when I use LTC, it starts throwing errors.. (I am trying to just run Scrypt pool, and not actually LTC pool...)

I honestly never tried the proxy on any altcoin mining, in reality, I don't mine any altcoins using ASIC miners anymore, the last coins I mined were LTC and DASH, and that was like 5 years ago or so, I would help you if I had an altcoin miner but the way it's now, it will be impossible for me to offer any help, but what you need to know is that the proxy doesn't work fine with all pools, not all pools are good with handling mining proxies.

You might find some answers in the altcoin mining section referenced in the above comment.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!