added configuration file finders for litecoin and both testnets
[p2pool.git] / p2pool / networks.py
1 import os
2 import platform
3
4 from p2pool.bitcoin import networks
5 from p2pool.util import math
6
7 # CHAIN_LENGTH = number of shares back client keeps
8 # REAL_CHAIN_LENGTH = maximum number of shares back client uses to compute payout
9 # REAL_CHAIN_LENGTH must always be <= CHAIN_LENGTH
10 # REAL_CHAIN_LENGTH must be changed in sync with all other clients
11 # changes can be done by changing one, then the other
12
13 BitcoinMainnet = math.Object(
14     PARENT=networks.BitcoinMainnet,
15     SHARE_PERIOD=10, # seconds
16     CHAIN_LENGTH=24*60*60//10, # shares
17     REAL_CHAIN_LENGTH=24*60*60//10, # shares
18     TARGET_LOOKBEHIND=200, # shares
19     SPREAD=3, # blocks
20     IDENTIFIER='fc70035c7a81bc6f'.decode('hex'),
21     PREFIX='2472ef181efcd37b'.decode('hex'),
22     NAME='bitcoin',
23     P2P_PORT=9333,
24     MAX_TARGET=2**256//2**32 - 1,
25     PERSIST=True,
26     WORKER_PORT=9332,
27     BOOTSTRAP_ADDRS='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 89.78.212.44 94.23.34.145 168.7.116.243 72.14.191.28 94.174.40.189:9344'.split(' '),
28     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'),
29 )
30 BitcoinTestnet = math.Object(
31     PARENT=networks.BitcoinTestnet,
32     SHARE_PERIOD=10, # seconds
33     CHAIN_LENGTH=24*60*60//10, # shares
34     REAL_CHAIN_LENGTH=24*60*60//10, # shares
35     TARGET_LOOKBEHIND=200, # shares
36     SPREAD=3, # blocks
37     IDENTIFIER='5fc2be2d4f0d6bfb'.decode('hex'),
38     PREFIX='3f6057a15036f441'.decode('hex'),
39     NAME='bitcoin_testnet',
40     P2P_PORT=19333,
41     MAX_TARGET=2**256//2**32 - 1,
42     PERSIST=False,
43     WORKER_PORT=19332,
44     BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
45     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'), 'testnet', 'bitcoin.conf'),
46 )
47
48 LitecoinMainnet = math.Object(
49     PARENT=networks.LitecoinMainnet,
50     SHARE_PERIOD=10, # seconds
51     CHAIN_LENGTH=24*60*60//10, # shares
52     REAL_CHAIN_LENGTH=24*60*60//10, # shares
53     TARGET_LOOKBEHIND=200, # shares
54     SPREAD=12, # blocks
55     IDENTIFIER='e037d5b8c6923410'.decode('hex'),
56     PREFIX='7208c1a53ef629b0'.decode('hex'),
57     NAME='litecoin',
58     P2P_PORT=9338,
59     MAX_TARGET=2**256//2**20 - 1,
60     PERSIST=True,
61     WORKER_PORT=9327,
62     BOOTSTRAP_ADDRS='76.26.53.101 124.205.120.178 190.195.79.161 173.167.113.73 82.161.65.210 67.83.108.0 78.101.67.239 78.100.161.252 87.58.117.233 78.100.162.223 216.239.45.4 78.101.131.221 72.14.191.28 97.81.163.217 69.126.183.240 219.84.64.174 78.101.119.27 89.211.228.244 178.152.122.30 172.16.0.3 76.26.53.101:51319'.split(' '),
63     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'),
64 )
65 LitecoinTestnet = math.Object(
66     PARENT=networks.LitecoinTestnet,
67     SHARE_PERIOD=10, # seconds
68     CHAIN_LENGTH=24*60*60//10, # shares
69     REAL_CHAIN_LENGTH=24*60*60//10, # shares
70     TARGET_LOOKBEHIND=200, # shares
71     SPREAD=12, # blocks
72     IDENTIFIER='cca5e24ec6408b1e'.decode('hex'),
73     PREFIX='ad9614f6466a39cf'.decode('hex'),
74     NAME='litecoin_testnet',
75     P2P_PORT=19338,
76     MAX_TARGET=2**256//2**17 - 1,
77     PERSIST=False,
78     WORKER_PORT=19327,
79     BOOTSTRAP_ADDRS='72.14.191.28'.split(' '),
80     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'), 'testnet', 'litecoin.conf'),
81 )
82
83 nets=dict((net.NAME, net) for net in set([BitcoinMainnet, BitcoinTestnet, LitecoinMainnet, LitecoinTestnet]))
84 realnets=dict((net.NAME, net) for net in nets.itervalues() if '_testnet' not in net.NAME)