Created
May 13, 2013 21:58
-
-
Save pillows/5571873 to your computer and use it in GitHub Desktop.
Submitter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import multiprocessing | |
import string | |
import random | |
import json | |
import hashlib | |
import sys | |
from hashlib import sha512 | |
import time | |
addr = "bfab5a5935ba47cfabd180cd49e910116128da6a" | |
filename = "hashes.blc" | |
f = open(filename, 'r') | |
hashlist = f.read() | |
hashlist = hashlist.split('\n') | |
i = 0 | |
for h in hashlist: | |
h = h.split() | |
if h[1] is '': | |
break | |
string = h[1] | |
hash = hashlib.sha512(h[1]) | |
try: | |
s = socket.socket() | |
s.connect(("server.bloocoin.org", 3122)) | |
s.send(json.dumps({"cmd":"check", "winning_string":string, "winning_hash":hash, "addr":addr})) | |
data = s.recv(1024) | |
print data | |
data = json.loads(data) | |
if data['success']: | |
print "Mined a coin!" | |
else: | |
print "Coin is a fake!" | |
s.close() | |
except Exception, e: | |
print "Can't connect to server" | |
print e | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this: