From 98c333ecefea7ea568638a7bd5534db858c9073b Mon Sep 17 00:00:00 2001 From: Terracoin Date: Sat, 8 Dec 2012 16:55:23 +0100 Subject: [PATCH] Add support for the Terracoin network. --- p2pool/bitcoin/networks.py | 38 ++++++++++++++++++++++++++++++++++++++ p2pool/networks.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 0 deletions(-) diff --git a/p2pool/bitcoin/networks.py b/p2pool/bitcoin/networks.py index ddb60af..ea53f05 100644 --- a/p2pool/bitcoin/networks.py +++ b/p2pool/bitcoin/networks.py @@ -117,6 +117,44 @@ nets = dict( ADDRESS_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/address/', SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256 - 1), ), + + terracoin=math.Object( + P2P_PREFIX='42babe56'.decode('hex'), + P2P_PORT=13333, + ADDRESS_VERSION=0, + RPC_PORT=13332, + RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue( + 'terracoinaddress' in (yield bitcoind.rpc_help()) and + not (yield bitcoind.rpc_getinfo())['testnet'] + )), + SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000, + POW_FUNC=data.hash256, + BLOCK_PERIOD=120, # s + SYMBOL='TRC', + CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Terracoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Terracoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.terracoin'), 'terracoin.conf'), + BLOCK_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/block/', + ADDRESS_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/address/', + SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1), + ), + terracoin_testnet=math.Object( + P2P_PREFIX='41babe56'.decode('hex'), + P2P_PORT=23333, + ADDRESS_VERSION=111, + RPC_PORT=23332, + RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue( + 'terracoinaddress' in (yield bitcoind.rpc_help()) and + (yield bitcoind.rpc_getinfo())['testnet'] + )), + SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000, + POW_FUNC=data.hash256, + BLOCK_PERIOD=120, # s + SYMBOL='tTRC', + CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Terracoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Terracoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.terracoin'), 'terracoin.conf'), + BLOCK_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/testnet/block/', + ADDRESS_EXPLORER_URL_PREFIX='http://cryptocoinexplorer.com:3750/testnet/address/', + SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1), + ), + ) for net_name, net in nets.iteritems(): net.NAME = net_name diff --git a/p2pool/networks.py b/p2pool/networks.py index 25472f1..63d827a 100644 --- a/p2pool/networks.py +++ b/p2pool/networks.py @@ -81,6 +81,44 @@ nets = dict( ANNOUNCE_CHANNEL='#p2pool-alt', VERSION_CHECK=lambda v: True, ), + + terracoin=math.Object( + PARENT=networks.nets['terracoin'], + SHARE_PERIOD=30, # seconds + CHAIN_LENGTH=24*60*60//30, # shares + REAL_CHAIN_LENGTH=24*60*60//30, # shares + TARGET_LOOKBEHIND=200, # shares + SPREAD=3, # blocks + IDENTIFIER='a41b2356a1b7d35e'.decode('hex'), + PREFIX='5623b62178d2b8a3'.decode('hex'), + P2P_PORT=9323, + MIN_TARGET=0, + MAX_TARGET=2**256//2**32 - 1, + PERSIST=True, + WORKER_PORT=9322, + BOOTSTRAP_ADDRS='seed1.p2pool.terracoin.org seed2.p2pool.terracoin.org forre.st vps.forre.st 74.220.242.6:9334 93.97.192.93 66.90.73.83 67.83.108.0 219.84.64.174 24.167.17.248 109.74.195.142 83.211.86.49 94.23.34.145 168.7.116.243 94.174.40.189:9344 89.79.79.195 portals94.ns01.us'.split(' '), + ANNOUNCE_CHANNEL='#p2pool-alt', + VERSION_CHECK=lambda v: True, + ), + terracoin_testnet=math.Object( + PARENT=networks.nets['terracoin_testnet'], + SHARE_PERIOD=30, # seconds + CHAIN_LENGTH=60*60//30, # shares + REAL_CHAIN_LENGTH=60*60//30, # shares + TARGET_LOOKBEHIND=200, # shares + SPREAD=3, # blocks + IDENTIFIER='b41b2356a5b7d35d'.decode('hex'), + PREFIX='1623b92172d2b8a2'.decode('hex'), + P2P_PORT=19323, + MIN_TARGET=0, + MAX_TARGET=2**256//2**32 - 1, + PERSIST=False, + WORKER_PORT=19322, + BOOTSTRAP_ADDRS='seed1.p2pool.terracoin.org seed2.p2pool.terracoin.org forre.st vps.forre.st'.split(' '), + ANNOUNCE_CHANNEL='#p2pool-alt', + VERSION_CHECK=lambda v: True, + ), + ) for net_name, net in nets.iteritems(): net.NAME = net_name -- 1.7.1