03eea086e458d12ba39693ee059c656097027029
[p2pool.git] / p2pool / bitcoin / networks.py
1 from twisted.internet import defer
2
3 from . import data
4 from p2pool.util import math
5
6 BitcoinMainnet = math.Object(
7     P2P_PREFIX='f9beb4d9'.decode('hex'),
8     P2P_PORT=8333,
9     ADDRESS_VERSION=0,
10     RPC_PORT=8332,
11     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
12         'bitcoinaddress' in (yield bitcoind.rpc_help()) and
13         not (yield bitcoind.rpc_getinfo())['testnet']
14     )),
15     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
16     POW_FUNC=data.block_header_type.hash256,
17     SYMBOL='BTC',
18 )
19 BitcoinTestnet = math.Object(
20     P2P_PREFIX='fabfb5da'.decode('hex'),
21     P2P_PORT=18333,
22     ADDRESS_VERSION=111,
23     RPC_PORT=8332,
24     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
25         'bitcoinaddress' in (yield bitcoind.rpc_help()) and
26         (yield bitcoind.rpc_getinfo())['testnet']
27     )),
28     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
29     POW_FUNC=data.block_header_type.hash256,
30     SYMBOL='tBTC',
31 )
32
33 NamecoinMainnet = math.Object(
34     P2P_PREFIX='f9beb4fe'.decode('hex'),
35     P2P_PORT=8334,
36     ADDRESS_VERSION=52,
37     RPC_PORT=8332,
38     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
39         'namecoinaddress' in (yield bitcoind.rpc_help()) and
40         not (yield bitcoind.rpc_getinfo())['testnet']
41     )),
42     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
43     POW_FUNC=data.block_header_type.hash256,
44     SYMBOL='NMC',
45 )
46 NamecoinTestnet = math.Object(
47     P2P_PREFIX='fabfb5fe'.decode('hex'),
48     P2P_PORT=18334,
49     ADDRESS_VERSION=111,
50     RPC_PORT=8332,
51     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
52         'namecoinaddress' in (yield bitcoind.rpc_help()) and
53         (yield bitcoind.rpc_getinfo())['testnet']
54     )),
55     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//210000,
56     POW_FUNC=data.block_header_type.hash256,
57     SYMBOL='tNMC',
58 )
59
60 LitecoinMainnet = math.Object(
61     P2P_PREFIX='fbc0b6db'.decode('hex'),
62     P2P_PORT=9333,
63     ADDRESS_VERSION=48,
64     RPC_PORT=9332,
65     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
66         'litecoinaddress' in (yield bitcoind.rpc_help()) and
67         not (yield bitcoind.rpc_getinfo())['testnet']
68     )),
69     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//840000,
70     POW_FUNC=data.block_header_type.scrypt,
71     SYMBOL='LTC',
72 )
73 LitecoinTestnet = math.Object(
74     P2P_PREFIX='fcc1b7dc'.decode('hex'),
75     P2P_PORT=19333,
76     ADDRESS_VERSION=111,
77     RPC_PORT=19332,
78     RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
79         'litecoinaddress' in (yield bitcoind.rpc_help()) and
80         (yield bitcoind.rpc_getinfo())['testnet']
81     )),
82     SUBSIDY_FUNC=lambda height: 50*100000000 >> (height + 1)//840000,
83     POW_FUNC=data.block_header_type.scrypt,
84     SYMBOL='tLTC',
85 )