-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMining.py
52 lines (43 loc) · 1.78 KB
/
Mining.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Mining.py
Python Chatroom
You can edit this file to mine coins.
================================================================
HOW THIS WORKS
If you send a message to the server of this format:
/mine <string>,
The server will append the previous hash to <string> and hash
it with a sha512 hash. If this hash starts with at least
a given number of zeroes, you earn 5 coins. This <string>
must be 86 characters long.
This previous hash is stored in "client.prev_hash".
This variable changes as people mine and earn money.
The given number of zeroes is stored in "client.hash_zeros".
This variable may or may not change.
The protocol for sending hashes is
client.send("/mine " + <string>, False).
You should check your hashes with the following function:
hashlib.sha512(<string>).hexdigest()
to check if it contains an adequate amount of leading zeroes
before you send it off to the server. The server is not
meant to be a checking service. DO NOT SPAM THE SERVER.
The following function will be executed as a thread every time
you log on. Edit it for mining. You can use any libraries
you like or not use any libraries, but you are not allowed
to spam the server.
(Some coding experience is required.)
================================================================
As you can see, this is a bashy process. Testing hashes will
require lots of CPU power. You do not need to mine, but
earning coins can let you buy things, described in other
documents.
Have fun!
"""
import hashlib
def mine(client):
"""
mine(client)
Edit this function to mine coins.
Instructions are included with this file.
"""
pass