From 8694fae4634339adf4f5dcc05d820b1cb3e30086 Mon Sep 17 00:00:00 2001 From: Luciano Tolomei Date: Mon, 31 Mar 2014 11:21:57 -0400 Subject: [PATCH 1/3] Added Spain support --- README.md | 10 ++++++++++ p2pool/networks.py | 29 ++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ff3120c..cc4fcafb 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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: ------------------------- diff --git a/p2pool/networks.py b/p2pool/networks.py index a5fc385d..3d9a7410 100644 --- a/p2pool/networks.py +++ b/p2pool/networks.py @@ -67,7 +67,7 @@ VERSION_CHECK=lambda v: True, ), - vertcoin=math.Object( # --> main net + vertcoin=math.Object( PARENT=networks.nets['vertcoin'], SHARE_PERIOD=15, # seconds CHAIN_LENGTH=24*60*60//10, # shares @@ -81,12 +81,12 @@ 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, ), - vertcoin2=math.Object( # --> low hashrate net + vertcoin2=math.Object( PARENT=networks.nets['vertcoin'], SHARE_PERIOD=15, # seconds CHAIN_LENGTH=24*60*60//10, # shares @@ -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, ), @@ -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, ), @@ -160,6 +160,25 @@ BOOTSTRAP_ADDRS='p2pool.letsmine.it lovok.no-ip.com'.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, ), ) From f4a7e2b1c043da7c6ce8a7f6d246d14ffb1f7a7b Mon Sep 17 00:00:00 2001 From: Luciano Tolomei Date: Mon, 31 Mar 2014 11:27:25 -0400 Subject: [PATCH 2/3] Added Spaincoin support --- p2pool/networks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2pool/networks.py b/p2pool/networks.py index 3d9a7410..cbe03beb 100644 --- a/p2pool/networks.py +++ b/p2pool/networks.py @@ -67,7 +67,7 @@ VERSION_CHECK=lambda v: True, ), - vertcoin=math.Object( + vertcoin=math.Object( # --> main net PARENT=networks.nets['vertcoin'], SHARE_PERIOD=15, # seconds CHAIN_LENGTH=24*60*60//10, # shares @@ -86,7 +86,7 @@ VERSION_CHECK=lambda v: True, ), - vertcoin2=math.Object( + vertcoin2=math.Object( # --> low hashrate net PARENT=networks.nets['vertcoin'], SHARE_PERIOD=15, # seconds CHAIN_LENGTH=24*60*60//10, # shares From cb733cb8d4ae70d6377328df1569c5f6a1a6a446 Mon Sep 17 00:00:00 2001 From: Luciano Tolomei Date: Tue, 1 Apr 2014 05:29:20 -0400 Subject: [PATCH 3/3] Addin Spaincoin missin p2pool/bitcoin/network.py file --- p2pool/bitcoin/networks.py | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/p2pool/bitcoin/networks.py b/p2pool/bitcoin/networks.py index 8ebeb5b3..2bdc8605 100644 --- a/p2pool/bitcoin/networks.py +++ b/p2pool/bitcoin/networks.py @@ -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 @@ -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