4 from twisted.internet import defer
7 from p2pool.util import math, pack
11 P2P_PREFIX='f9beb4d9'.decode('hex'),
15 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
16 'bitcoinaddress' in (yield bitcoind.rpc_help()) and
17 not (yield bitcoind.rpc_getinfo())['testnet']
19 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
20 POW_FUNC=data.hash256,
23 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Bitcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Bitcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.bitcoin'), 'bitcoin.conf'),
24 BLOCK_EXPLORER_URL_PREFIX='https://blockchain.info/block/',
25 ADDRESS_EXPLORER_URL_PREFIX='https://blockchain.info/address/',
26 TX_EXPLORER_URL_PREFIX='https://blockchain.info/tx/',
27 SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
29 DUST_THRESHOLD=0.001e8,
31 bitcoin_testnet=math.Object(
32 P2P_PREFIX='0b110907'.decode('hex'),
36 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
37 'bitcoinaddress' in (yield bitcoind.rpc_help()) and
38 (yield bitcoind.rpc_getinfo())['testnet']
40 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
41 POW_FUNC=data.hash256,
44 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Bitcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Bitcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.bitcoin'), 'bitcoin.conf'),
45 BLOCK_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/block/',
46 ADDRESS_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/address/',
47 TX_EXPLORER_URL_PREFIX='http://blockexplorer.com/testnet/tx/',
48 SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
54 P2P_PREFIX='f9beb4fe'.decode('hex'),
58 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
59 'namecoinaddress' in (yield bitcoind.rpc_help()) and
60 not (yield bitcoind.rpc_getinfo())['testnet']
62 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
63 POW_FUNC=data.hash256,
66 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Namecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Namecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.namecoin'), 'bitcoin.conf'),
67 BLOCK_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/b/',
68 ADDRESS_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/a/',
69 TX_EXPLORER_URL_PREFIX='http://explorer.dot-bit.org/tx/',
70 SANE_TARGET_RANGE=(2**256//2**32 - 1, 2**256//2**32 - 1),
74 namecoin_testnet=math.Object(
75 P2P_PREFIX='fabfb5fe'.decode('hex'),
79 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
80 'namecoinaddress' in (yield bitcoind.rpc_help()) and
81 (yield bitcoind.rpc_getinfo())['testnet']
83 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
84 POW_FUNC=data.hash256,
87 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Namecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Namecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.namecoin'), 'bitcoin.conf'),
88 BLOCK_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/b/',
89 ADDRESS_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/a/',
90 TX_EXPLORER_URL_PREFIX='http://testnet.explorer.dot-bit.org/tx/',
91 SANE_TARGET_RANGE=(2**256//2**32 - 1, 2**256//2**32 - 1),
97 P2P_PREFIX='fbc0b6db'.decode('hex'),
101 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
102 'litecoinaddress' in (yield bitcoind.rpc_help()) and
103 not (yield bitcoind.rpc_getinfo())['testnet']
105 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//840000,
106 POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
107 BLOCK_PERIOD=150, # s
109 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Litecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Litecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.litecoin'), 'litecoin.conf'),
110 BLOCK_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/block/',
111 ADDRESS_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/address/',
112 TX_EXPLORER_URL_PREFIX='http://explorer.litecoin.net/tx/',
113 SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
114 DUMB_SCRYPT_DIFF=2**16,
115 DUST_THRESHOLD=0.03e8,
117 litecoin_testnet=math.Object(
118 P2P_PREFIX='fcc1b7dc'.decode('hex'),
122 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
123 'litecoinaddress' in (yield bitcoind.rpc_help()) and
124 (yield bitcoind.rpc_getinfo())['testnet']
126 SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//840000,
127 POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
128 BLOCK_PERIOD=150, # s
130 CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Litecoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Litecoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.litecoin'), 'litecoin.conf'),
131 BLOCK_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/block/',
132 ADDRESS_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/address/',
133 TX_EXPLORER_URL_PREFIX='http://nonexistent-litecoin-testnet-explorer/tx/',
134 SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256 - 1),
135 DUMB_SCRYPT_DIFF=2**16,
139 terracoin=math.Object(
140 P2P_PREFIX='42babe56'.decode('hex'),
144 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
145 'terracoinaddress' in (yield bitcoind.rpc_help()) and
146 not (yield bitcoind.rpc_getinfo())['testnet']
148 SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000,
149 POW_FUNC=data.hash256,
150 BLOCK_PERIOD=120, # s
152 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'),
153 BLOCK_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/block/',
154 ADDRESS_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/address/',
155 TX_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/tx/',
156 SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
160 terracoin_testnet=math.Object(
161 P2P_PREFIX='41babe56'.decode('hex'),
165 RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
166 'terracoinaddress' in (yield bitcoind.rpc_help()) and
167 (yield bitcoind.rpc_getinfo())['testnet']
169 SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000,
170 POW_FUNC=data.hash256,
171 BLOCK_PERIOD=120, # s
173 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'),
174 BLOCK_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/testnet/block/',
175 ADDRESS_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/testnet/address/',
176 TX_EXPLORER_URL_PREFIX='http://trc.cryptocoinexplorer.com/testnet/tx/',
177 SANE_TARGET_RANGE=(2**256//2**32//1000 - 1, 2**256//2**32 - 1),
183 for net_name, net in nets.iteritems():