Compare commits

..

No commits in common. "45dfadb8be1bd38b36a961e0894e001d1018e08d" and "941c194fbdae4dd6abe0ede246e9cab136983d8a" have entirely different histories.

5 changed files with 16 additions and 38 deletions

4
.gitmodules vendored
View File

@ -10,7 +10,3 @@
[submodule "externals/quarkcoin-hash"]
path = externals/quarkcoin-hash
url = https://github.com/Neisklar/quarkcoin-hash-python
[submodule "externals/medcoin_hybrid"]
path = externals/medcoin_hybrid
url = https://github.com/mrtexaznl/medcoin_hybrid

View File

@ -14,8 +14,7 @@ The goal is to make a reliable stratum mining server for scrypt based coins. Ove
* Solved Block Confirmation
* Job Based Vardiff support
* Solution Block Hash Support
* *NEW* SHA256, Scrypt, Scrypt-Jane, Quark Algo Support
* *NEW* Hybrid ScryptSha256 Algorithm Support
* *NEW* SHA256 and Scrypt Algo Support
* Log Rotation
* Initial low difficulty share confirmation
* Multiple *coind* wallets

View File

@ -19,7 +19,7 @@ COINDAEMON_TRUSTED_PASSWORD = 'somepassword'
# Coin Algorithm is the option used to determine the algortithm used by stratum
# This currently works with POW and POS coins
# The available options are:
# scrypt, sha256d, scrypt-jane, quark and ScryptHybrid
# scrypt, sha256d, scrypt-jane and quark
# If the option does not meet either of these criteria stratum defaults to scrypt
# For Coins which support TX Messages please enter yes in the TX selection
COINDAEMON_ALGO = 'scrypt'

View File

@ -26,11 +26,15 @@ if settings.COINDAEMON_ALGO == 'scrypt':
elif settings.COINDAEMON_ALGO == 'quark':
log.debug("########################################### Loading Quark Support #########################################################")
import quark_hash
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
import medcoin_hybrid
else:
log.debug("########################################### Loading SHA256 Support ######################################################")
#if settings.COINDAEMON_Reward == 'POS':
# log.debug("########################################### Loading POS Support #########################################################")
# pass
#else:
# log.debug("########################################### Loading POW Support ######################################################")
# pass
if settings.COINDAEMON_TX == 'yes':
log.debug("########################################### Loading SHA256 Transaction Message Support #########################################################")
@ -235,8 +239,6 @@ class CBlock(object):
self.scrypt = None
elif settings.COINDAEMON_ALGO == 'quark':
self.quark = None
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
self.scrypthybrid = None
else: pass
if settings.COINDAEMON_Reward == 'POS':
self.signature = b""
@ -291,18 +293,6 @@ class CBlock(object):
r.append(struct.pack("<I", self.nNonce))
self.quark = uint256_from_str(quark_hash.getPoWHash(''.join(r)))
return self.quark
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
def calc_hybridsch256(self):
if self.scrypthyrbid is None:
r = []
r.append(struct.pack("<i", self.nVersion))
r.append(ser_uint256(self.hashPrevBlock))
r.append(ser_uint256(self.hashMerkleRoot))
r.append(struct.pack("<I", self.nTime))
r.append(struct.pack("<I", self.nBits))
r.append(struct.pack("<I", self.nNonce))
self.scrypthybrid = uint256_from_str(medcoin_hybrid.getPoWHash(''.join(r)))
return self.scrypthybrid
else:
def calc_sha256(self):
if self.sha256 is None:
@ -322,8 +312,6 @@ class CBlock(object):
self.calc_scrypt()
elif settings.COINDAEMON_ALGO == 'quark':
self.calc_quark()
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
self.calc_scrypthybrid()
else:
self.calc_sha256()
target = uint256_from_compact(self.nBits)
@ -333,9 +321,6 @@ class CBlock(object):
elif settings.COINDAEMON_ALGO == 'quark':
if self.quark > target:
return false
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
if self.scrypthybrid > target:
return false
else:
if self.sha256 > target:
return False

View File

@ -9,8 +9,6 @@ elif settings.COINDAEMON_ALGO == 'scrypt-jane':
import yac_scrypt
elif settings.COINDAEMON_ALGO == 'quark':
import quark_hash
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
import medcoin_hybrid
else: pass
from twisted.internet import defer
from lib.exceptions import SubmitException
@ -150,7 +148,7 @@ class TemplateRegistry(object):
def diff_to_target(self, difficulty):
'''Converts difficulty to target'''
if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane' or settiongs.COINDAEMON_ALGO == 'scrypthybrid':
if settings.COINDAEMON_ALGO == 'scrypt' or 'scrypt-jane':
diff1 = 0x0000ffff00000000000000000000000000000000000000000000000000000000
elif settings.COINDAEMON_ALGO == 'quark':
diff1 = 0x000000ffff000000000000000000000000000000000000000000000000000000
@ -242,14 +240,11 @@ class TemplateRegistry(object):
hash_bin = yac_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]), int(ntime, 16))
elif settings.COINDAEMON_ALGO == 'quark':
hash_bin = quark_hash.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
elif settings.COINDAEMON_ALGO == 'scrypthybrid':
hash_bin = medcoin_hybrid.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
else:
hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
else: hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
hash_int = util.uint256_from_str(hash_bin)
scrypt_hash_hex = "%064x" % hash_int
header_hex = binascii.hexlify(header_bin)
if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane' or settings.COINDAEMON_ALGO == 'scrypthybrid':
if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'scrypt-jane':
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
elif settings.COINDAEMON_ALGO == 'quark':
header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
@ -272,10 +267,13 @@ class TemplateRegistry(object):
# Yay! It is block candidate!
log.info("We found a block candidate! %s" % scrypt_hash_hex)
# Find the potential block hash
# Reverse the header and get the potential block hash (for scrypt only)
#if settings.COINDAEMON_ALGO == 'scrypt' or settings.COINDAEMON_ALGO == 'sha256d':
# if settings.COINDAEMON_Reward == 'POW':
block_hash_bin = util.doublesha(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))
block_hash_hex = block_hash_bin[::-1].encode('hex_codec')
#else: block_hash_hex = hash_bin[::-1].encode('hex_codec')
#else: block_hash_hex = hash_bin[::-1].encode('hex_codec')
# 6. Finalize and serialize block object
job.finalize(merkle_root_int, extranonce1_bin, extranonce2_bin, int(ntime, 16), int(nonce, 16))