Skip to content

Commit

Permalink
Merge pull request #23 from youvnor/master
Browse files Browse the repository at this point in the history
Spaincoin support
  • Loading branch information
donSchoe committed Apr 3, 2014
2 parents 178fd60 + e9ebb75 commit 543347f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ P2Pool Server Node software for Scrypt-N coins. Currently supported:
* Vertcoin [VTC]
* GPUCoin [GPUC]
* Execoin [EXE]
* Spaincoin [SPA]
* Rotocoin [RT2]


Requirements:
Expand Down Expand Up @@ -104,6 +106,14 @@ Execoin:
* Run P2Pool with the "--net execoin" option.
* Run your miner program, connecting to 127.0.0.1 on port 9173.

Rotocoin:
* Run P2Pool with the "--net rotocoin" option.
* Run your miner program, connecting to 127.0.0.1 on port 7274.

Spaincoin:
* Run P2Pool with the "--net spaincoin" option.
* Run your miner program, connecting to 127.0.0.1 on port 26490.


Sponsors:
-------------------------
Expand Down
40 changes: 39 additions & 1 deletion p2pool/bitcoin/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ def get_tenfivesubsidy(bnHeight):

return int(nSubsidy * 1000000)

# SpainCoin subsidy function
SPASUBSIDY = [ 0, 940, 3492, 6069, 8673, 11304, 13963, 16650, 19366, 22112, 24887, 27694, 30532, 33402, 36305, 39241, 42213, 45219, 48262, 51342, 54459, 57616, 60812, 64050, 67329, 70652, 74018, 77430, 80889, 84396, 87952, 91559, 95218, 98930, 102698, 106523, 110407, 114351, 118358, 122429, 126566, 130773, 135051, 139402, 143830, 148336, 152924, 157597, 162358, 167210, 172157, 177203, 182351, 187607, 192974, 198457, 204062, 209794, 215659, 221663, 227813, 234116, 240581, 247215, 254027, 261028, 268229, 275641, 283276, 291149, 299275, 307671, 316355, 325347, 334672, 344353, 354420, 364904, 375841, 387273, 399246, 411814, 425039, 438994, 453765, 469451, 486176, 504084, 523359, 544224, 566966, 591957, 619690, 650844, 686380, 727739, 777208, 838764, 920291, 1041340, 1281967 ];
def spa_sub(n):
i, a, b = 0, 1, 100
if n == 1:
return 25000000
if n >= SPASUBSIDY[100]: return 0
while b >= a:
i = (a+b)>>1
if n < SPASUBSIDY[i] and n >= SPASUBSIDY[i-1]:
break
if SPASUBSIDY[i] <= n:
a = i+1
else:
b = i-1

return 101-i

def get_subsidy(nCap, nMaxSubsidy, bnTarget):
bnLowerBound = 0.01
bnUpperBound = bnSubsidyLimit = nMaxSubsidy
Expand Down Expand Up @@ -206,7 +224,27 @@ def check_genesis_block(bitcoind, genesis_block_hash):
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),

spaincoin=math.Object(
P2P_PREFIX='fb149200'.decode('hex'),
P2P_PORT=11492,
ADDRESS_VERSION=63,
RPC_PORT=11491,
RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'spaincoinaddress' in (yield bitcoind.rpc_help()) and
not (yield bitcoind.rpc_getinfo())['testnet']
)),
SUBSIDY_FUNC=lambda height: spa_sub(height),
POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('vtc_scrypt').getPoWHash(data)),
BLOCK_PERIOD=120, # s
SYMBOL='SPA',
CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Spaincoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Spaincoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.spaincoin'), 'spaincoin.conf'),
BLOCK_EXPLORER_URL_PREFIX='http://explorer.spaincoin.org/block/',
ADDRESS_EXPLORER_URL_PREFIX='http://explorer.spaincoin.org/address/',
TX_EXPLORER_URL_PREFIX='http://explorer.spaincoin.org/tx/',
SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=0.03e8,
),
)
for net_name, net in nets.iteritems():
net.NAME = net_name
25 changes: 22 additions & 3 deletions p2pool/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=9171,
BOOTSTRAP_ADDRS='q30.qhor.net seed.p2pool.etyd.org vtc.royalminingco.com'.split(' '),
BOOTSTRAP_ADDRS='q30.qhor.net seed.p2pool.etyd.org vtc.royalminingco.com p2pool.letsmine.it'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-vtc',
VERSION_CHECK=lambda v: True,
),
Expand Down Expand Up @@ -119,7 +119,7 @@
MAX_TARGET=2**256//2**20 - 1,
PERSIST=True,
WORKER_PORT=9404,
BOOTSTRAP_ADDRS='gpu.qemulab.com 96.51.143.9 aforis.mooo.com 96.126.121.117 gpu.crabdance.com'.split(' '),
BOOTSTRAP_ADDRS='gpu.qemulab.com 96.51.143.9 aforis.mooo.com 96.126.121.117 gpu.crabdance.com p2pool.letsmine.it'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-gpuc',
VERSION_CHECK=lambda v: True,
),
Expand All @@ -138,7 +138,7 @@
MAX_TARGET=2**256//2**20 - 1,
PERSIST=True,
WORKER_PORT=9173,
BOOTSTRAP_ADDRS='exe.p2pool.info freebtc.eu'.split(' '),
BOOTSTRAP_ADDRS='exe.p2pool.info freebtc.eu p2pool.letsmine.it'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-exe',
VERSION_CHECK=lambda v: True,
),
Expand All @@ -160,6 +160,25 @@
BOOTSTRAP_ADDRS='lovok.no-ip.com rt2.hashcrop.info'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-roto',
VERSION_CHECK=lambda v: True,
),
spaincoin=math.Object(
PARENT=networks.nets['spaincoin'],
SHARE_PERIOD=15, # seconds
CHAIN_LENGTH=24*60*60//10, # shares
REAL_CHAIN_LENGTH=24*60*60//10, # shares
TARGET_LOOKBEHIND=200, # shares
SPREAD=12, # blocks
IDENTIFIER='e238d5b8c6931492'.decode('hex'),
PREFIX='7409c1a53ef71492'.decode('hex'),
P2P_PORT=26491,
MIN_TARGET=0,
MAX_TARGET=2**256//2**20 - 1,
PERSIST=True,
WORKER_PORT=26490,
BOOTSTRAP_ADDRS='p2pool2.crunchpool.com p2pool.crunchpool.com spa.boulderbtc.com p2pooleu.cloudapp.net 31.31.72.59 p2pool.letsmine.it'.split(' '),
ANNOUNCE_CHANNEL='#p2pool-spa',
VERSION_CHECK=lambda v: True,
VERSION_WARNING=lambda v: 'Upgrade Spaincoin to >=0.8.8.0!' if v < 80800 else None,
),

)
Expand Down

0 comments on commit 543347f

Please sign in to comment.