Merge pull request #2 from ygboucherk/patch-1

Improved stability
This commit is contained in:
Pherelo_HD 2021-03-17 21:47:14 +00:00 committed by GitHub
commit 154f38f2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 21 deletions

View File

@ -5,7 +5,7 @@ username = "user" # Edit this to your username, mind the quotes
pool_address = "51.15.127.80"
pool_port = 2811
print("Starting 3DS Miner, you probably won't get any output")
print("Starting 3DS Miner, you probably will get Output on an error.")
while True:
soc.connect((str(pool_address), int(pool_port))) # Connect to the server
@ -13,23 +13,33 @@ while True:
print("Server is on version", server_version)
# Mining section
while True:
soc.send(bytes("JOB," + str(username) + ",ESP32", encoding="utf8")) # Send job request
# Don't mind the "ESP32" for now since it is in an early state
job = soc.recv(87).decode() # Get work from pool
job = job.split(",") # Split received data to job (job and difficulty)
difficulty = job[2]
for result in range(
100 * int(difficulty) + 1
): # Calculate hash with difficulty
ducos1 = hashlib.sha1(
str(job[0] + str(result)).encode("utf-8")
).hexdigest() # Generate hash
if job[1] == ducos1: # If result is even with job
soc.send(
bytes(str(result) + "," + ",3DS Miner unstable)", encoding="utf8")
) # Send result of hashing algorithm to pool
feedback = soc.recv(1024).decode() # Get feedback about the result
print(feedback)
try:
soc.send(bytes("JOB," + str(username) + ",ESP32", encoding="utf8")) # Send job request
# Don't mind the "ESP32" for now since it is in an early state
job = soc.recv(87).decode() # Get work from pool
job = job.split(",") # Split received data to job (job and difficulty)
difficulty = job[2]
for result in range(
100 * int(difficulty) + 1
): # Calculate hash with difficulty
ducos1 = hashlib.sha1(
str(job[0] + str(result)).encode("utf-8")
).hexdigest() # Generate hash
if job[1] == ducos1: # If result is even with job
soc.send(
bytes(str(result) + "," + ",3DS Miner unstable)", encoding="utf8")
) # Send result of hashing algorithm to pool
feedback = soc.recv(1024).decode() # Get feedback about the result
print(feedback)
except:
while True:
try:
soc.close()
soc = socket.socket()
soc.connect((str(pool_address), int(pool_port))) # Connect to the server
except:
pass
else:
break