Added BITCOIN_POW_FUNC to network definitions
[p2pool.git] / p2pool / bitcoin / networks.py
1 from twisted.internet import defer
2
3 from . import data
4
5
6 class BitcoinMainnet(object):
7     BITCOIN_P2P_PREFIX = 'f9beb4d9'.decode('hex')
8     BITCOIN_P2P_PORT = 8333
9     BITCOIN_ADDRESS_VERSION = 0
10     BITCOIN_RPC_PORT = 8332
11     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
12         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
13         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
14         not (yield bitcoind.rpc_getinfo())['testnet']
15     )))
16     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
17     BITCOIN_POW_FUNC = data.block_header_type.hash256
18     BITCOIN_SYMBOL = 'BTC'
19
20 class BitcoinTestnet(object):
21     BITCOIN_P2P_PREFIX = 'fabfb5da'.decode('hex')
22     BITCOIN_P2P_PORT = 18333
23     BITCOIN_ADDRESS_VERSION = 111
24     BITCOIN_RPC_PORT = 8332
25     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
26         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
27         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
28         (yield bitcoind.rpc_getinfo())['testnet']
29     )))
30     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
31     BITCOIN_POW_FUNC = data.block_header_type.hash256
32     BITCOIN_SYMBOL = 'tBTC'
33
34
35 class NamecoinMainnet(object):
36     BITCOIN_P2P_PREFIX = 'f9beb4fe'.decode('hex')
37     BITCOIN_P2P_PORT = 8334
38     BITCOIN_ADDRESS_VERSION = 52
39     BITCOIN_RPC_PORT = 8332
40     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
41         'name_firstupdate' in (yield bitcoind.rpc_help()) and
42         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
43         not (yield bitcoind.rpc_getinfo())['testnet']
44     )))
45     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
46     BITCOIN_POW_FUNC = data.block_header_type.hash256
47     BITCOIN_SYMBOL = 'NMC'
48
49 class NamecoinTestnet(object):
50     BITCOIN_P2P_PREFIX = 'fabfb5fe'.decode('hex')
51     BITCOIN_P2P_PORT = 18334
52     BITCOIN_ADDRESS_VERSION = 111
53     BITCOIN_RPC_PORT = 8332
54     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
55         'name_firstupdate' in (yield bitcoind.rpc_help()) and
56         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
57         (yield bitcoind.rpc_getinfo())['testnet']
58     )))
59     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
60     BITCOIN_POW_FUNC = data.block_header_type.hash256
61     BITCOIN_SYMBOL = 'tNMC'
62
63
64 class IxcoinMainnet(object):
65     BITCOIN_P2P_PREFIX = 'f9beb4d9'.decode('hex')
66     BITCOIN_P2P_PORT = 8337
67     BITCOIN_ADDRESS_VERSION = 138
68     BITCOIN_RPC_PORT = 8338
69     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
70         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
71         'ixcoinaddress' in (yield bitcoind.rpc_help()) and
72         not (yield bitcoind.rpc_getinfo())['testnet']
73     )))
74     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 96*100000000 >> (height + 1)//210000)
75     BITCOIN_POW_FUNC = data.block_header_type.hash256
76     BITCOIN_SYMBOL = 'IXC'
77
78 class IxcoinTestnet(object):
79     BITCOIN_P2P_PREFIX = 'fabfb5da'.decode('hex')
80     BITCOIN_P2P_PORT = 18337
81     BITCOIN_ADDRESS_VERSION = 111
82     BITCOIN_RPC_PORT = 8338
83     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
84         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
85         'ixcoinaddress' in (yield bitcoind.rpc_help()) and
86         (yield bitcoind.rpc_getinfo())['testnet']
87     )))
88     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 96*100000000 >> (height + 1)//210000)
89     BITCOIN_POW_FUNC = data.block_header_type.hash256
90     BITCOIN_SYMBOL = 'tIXC'
91
92
93 class I0coinMainnet(object):
94     BITCOIN_P2P_PREFIX = 'f1b2b3d4'.decode('hex')
95     BITCOIN_P2P_PORT = 7333
96     BITCOIN_ADDRESS_VERSION = 105
97     BITCOIN_RPC_PORT = 7332
98     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
99         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
100         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
101         'i0coinaddress' in (yield bitcoind.rpc_help()) and
102         not (yield bitcoind.rpc_getinfo())['testnet']
103     )))
104     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 48*100000000 >> (height + 1)//218750)
105     BITCOIN_POW_FUNC = data.block_header_type.hash256
106     BITCOIN_SYMBOL = 'I0C'
107
108 class I0coinTestnet(object):
109     BITCOIN_P2P_PREFIX = 'f5b6b7d8'.decode('hex')
110     BITCOIN_P2P_PORT = 17333
111     BITCOIN_ADDRESS_VERSION = 112
112     BITCOIN_RPC_PORT = 7332
113     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
114         'name_firstupdate' not in (yield bitcoind.rpc_help()) and
115         'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
116         'i0coinaddress' in (yield bitcoind.rpc_help()) and
117         (yield bitcoind.rpc_getinfo())['testnet']
118     )))
119     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 48*100000000 >> (height + 1)//218750)
120     BITCOIN_POW_FUNC = data.block_header_type.hash256
121     BITCOIN_SYMBOL = 'tI0C'
122
123
124 class SolidcoinMainnet(object):
125     BITCOIN_P2P_PREFIX = 'deadbabe'.decode('hex')
126     BITCOIN_P2P_PORT = 7555
127     BITCOIN_ADDRESS_VERSION = 125
128     BITCOIN_RPC_PORT = 8332
129     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
130         'solidcoinaddress' in (yield bitcoind.rpc_help()) and
131         not (yield bitcoind.rpc_getinfo())['testnet']
132     )))
133     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 32*100000000 >> (height + 1)//300000)
134     BITCOIN_POW_FUNC = data.block_header_type.hash256
135     BITCOIN_SYMBOL = 'SC'
136
137
138 class LitecoinMainnet(object):
139     BITCOIN_P2P_PREFIX = 'fbc0b6db'.decode('hex')
140     BITCOIN_P2P_PORT = 9333
141     BITCOIN_ADDRESS_VERSION = 48
142     BITCOIN_RPC_PORT = 9332
143     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
144         'litecoinaddress' in (yield bitcoind.rpc_help()) and
145         not (yield bitcoind.rpc_getinfo())['testnet']
146     )))
147     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//840000)
148     BITCOIN_POW_FUNC = data.block_header_type.scrypt
149     BITCOIN_SYMBOL = 'LTC'
150
151 class LitecoinTestnet(object):
152     BITCOIN_P2P_PREFIX = 'fcc1b7dc'.decode('hex')
153     BITCOIN_P2P_PORT = 19333
154     BITCOIN_ADDRESS_VERSION = 111
155     BITCOIN_RPC_PORT = 19332
156     BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
157         'litecoinaddress' in (yield bitcoind.rpc_help()) and
158         (yield bitcoind.rpc_getinfo())['testnet']
159     )))
160     BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//840000)
161     BITCOIN_POW_FUNC = data.block_header_type.scrypt
162     BITCOIN_SYMBOL = 'tLTC'