terracoin blockexplorer url update.
[p2pool.git] / p2pool / bitcoin / networks.py
1 import os
2 import platform
3
4 from twisted.internet import defer
5
6 from . import data
7 from p2pool.util import math, pack
8
9 nets = dict(
10     bitcoin=math.Object(
11         P2P_PREFIX='f9beb4d9'.decode('hex'),
12         P2P_PORT=8333,
13         ADDRESS_VERSION=0,
14         RPC_PORT=8332,
15         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
16             'bitcoinaddress' in (yield bitcoind.rpc_help()) and
17             not (yield bitcoind.rpc_getinfo())['testnet']
18         )),
19         SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
20         POW_FUNC=data.hash256,
21         BLOCK_PERIOD=600, # s
22         SYMBOL='BTC',
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),
28         DUMB_SCRYPT_DIFF=1,
29         DUST_THRESHOLD=0.001e8,
30     ),
31     bitcoin_testnet=math.Object(
32         P2P_PREFIX='0b110907'.decode('hex'),
33         P2P_PORT=18333,
34         ADDRESS_VERSION=111,
35         RPC_PORT=18332,
36         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
37             'bitcoinaddress' in (yield bitcoind.rpc_help()) and
38             (yield bitcoind.rpc_getinfo())['testnet']
39         )),
40         SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
41         POW_FUNC=data.hash256,
42         BLOCK_PERIOD=600, # s
43         SYMBOL='tBTC',
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),
49         DUMB_SCRYPT_DIFF=1,
50         DUST_THRESHOLD=1e8,
51     ),
52     
53     namecoin=math.Object(
54         P2P_PREFIX='f9beb4fe'.decode('hex'),
55         P2P_PORT=8334,
56         ADDRESS_VERSION=52,
57         RPC_PORT=8332,
58         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
59             'namecoinaddress' in (yield bitcoind.rpc_help()) and
60             not (yield bitcoind.rpc_getinfo())['testnet']
61         )),
62         SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
63         POW_FUNC=data.hash256,
64         BLOCK_PERIOD=600, # s
65         SYMBOL='NMC',
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),
71         DUMB_SCRYPT_DIFF=1,
72         DUST_THRESHOLD=0.2e8,
73     ),
74     namecoin_testnet=math.Object(
75         P2P_PREFIX='fabfb5fe'.decode('hex'),
76         P2P_PORT=18334,
77         ADDRESS_VERSION=111,
78         RPC_PORT=8332,
79         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
80             'namecoinaddress' in (yield bitcoind.rpc_help()) and
81             (yield bitcoind.rpc_getinfo())['testnet']
82         )),
83         SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
84         POW_FUNC=data.hash256,
85         BLOCK_PERIOD=600, # s
86         SYMBOL='tNMC',
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),
92         DUMB_SCRYPT_DIFF=1,
93         DUST_THRESHOLD=1e8,
94     ),
95     
96     litecoin=math.Object(
97         P2P_PREFIX='fbc0b6db'.decode('hex'),
98         P2P_PORT=9333,
99         ADDRESS_VERSION=48,
100         RPC_PORT=9332,
101         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
102             'litecoinaddress' in (yield bitcoind.rpc_help()) and
103             not (yield bitcoind.rpc_getinfo())['testnet']
104         )),
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
108         SYMBOL='LTC',
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,
116     ),
117     litecoin_testnet=math.Object(
118         P2P_PREFIX='fcc1b7dc'.decode('hex'),
119         P2P_PORT=19333,
120         ADDRESS_VERSION=111,
121         RPC_PORT=19332,
122         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
123             'litecoinaddress' in (yield bitcoind.rpc_help()) and
124             (yield bitcoind.rpc_getinfo())['testnet']
125         )),
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
129         SYMBOL='tLTC',
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,
136         DUST_THRESHOLD=1e8,
137     ),
138
139     terracoin=math.Object(
140         P2P_PREFIX='42babe56'.decode('hex'),
141         P2P_PORT=13333,
142         ADDRESS_VERSION=0,
143         RPC_PORT=13332,
144         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
145             'terracoinaddress' in (yield bitcoind.rpc_help()) and
146             not (yield bitcoind.rpc_getinfo())['testnet']
147         )),
148         SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000,
149         POW_FUNC=data.hash256,
150         BLOCK_PERIOD=120, # s
151         SYMBOL='TRC',
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),
157         DUMB_SCRYPT_DIFF=1,
158         DUST_THRESHOLD=1e8,
159     ),
160     terracoin_testnet=math.Object(
161         P2P_PREFIX='41babe56'.decode('hex'),
162         P2P_PORT=23333,
163         ADDRESS_VERSION=111,
164         RPC_PORT=23332,
165         RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
166             'terracoinaddress' in (yield bitcoind.rpc_help()) and
167             (yield bitcoind.rpc_getinfo())['testnet']
168         )),
169         SUBSIDY_FUNC=lambda height: 20*100000000 >> (height + 1)//1050000,
170         POW_FUNC=data.hash256,
171         BLOCK_PERIOD=120, # s
172         SYMBOL='tTRC',
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),
178         DUMB_SCRYPT_DIFF=1,
179         DUST_THRESHOLD=1e8,
180     ),
181
182 )
183 for net_name, net in nets.iteritems():
184     net.NAME = net_name