Implemented authentication modules, and added 2 modules: allowall and simplefile
[bitcoin:eloipool.git] / config.py.example
1 # Please note that config files are Python source code!
2 # A common mistake is to put an option list (such as TemplateChecks,
3 # JSONRPCAddresses, etc) excluding the final comma.
4 # For example (this is WRONG):
5 #     JSONRPCAddresses = (
6 #         ('', 8337)  # <-- there must be a comma after EVERY item, even last
7 #     )
8 # Without the final comma, should the option list ever have only one item in
9 # it, Python would interpret the "main" parenthesis as a mere sub-expression
10 # instead of a list of values. If that occurs, you might get crazy errors, or
11 # things might just not work correctly. Be careful to not miss the commas.
12
13 ### Settings relating to server identity
14
15 # Name of the server
16 ServerName = 'Private Eloipool'
17
18 ### Settings relating to server scaling/load
19
20 # Share hashes must be below this to be valid shares
21 # If dynamic targetting is enabled, this is a minimum
22 ShareTarget = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
23
24 # Automatically adjust targets per username
25 # 0 = disabled
26 # 1 = arbitrary targets
27 # 2 = power of two difficulties (zero bit counts)
28 DynamicTargetting = 0
29
30 # How many shares per minute to try to achieve on average
31 DynamicTargetGoal = 8
32
33 # Number of seconds hashrate is measured over
34 DynamicTargetWindow = 120
35
36 # Minimum and maximum of merkle roots to keep queued
37 WorkQueueSizeRegular = (0x100, 0x1000)
38
39 # Minimum and maximum of BLANK merkle roots to keep queued
40 # (used if we run out of populated ones)
41 WorkQueueSizeClear = (0x1000, 0x2000)
42
43 # Minimum and maximum of BLANK merkle roots to keep queued, one height up
44 # (used for longpolls)
45 WorkQueueSizeLongpoll = (0x1000, 0x2000)
46
47 # How long to wait between getmemorypool updates normally
48 MinimumTxnUpdateWait = 5
49
50 # How long to wait between retries if getmemorypool fails
51 TxnUpdateRetryWait = 1
52
53 # How long to sleep in idle loops (temporary!)
54 IdleSleepTime = 0.1
55
56 ### Settings relating to reward generation
57
58 # Address to generate rewards to
59 TrackerAddr = 'mrsP7M31efGkQHXb7nRiWLDjfV2M8oakf2'  # testnet
60
61 # Coinbaser command to control reward delegation
62 # NOTE: This example donates 1% of block rewards to Luke-Jr for Eloipool development
63 CoinbaserCmd = 'echo -e "1\\n$((%d / 100))\\n1579aXhdwvKZEMrAKoCZhzGuqMa8EonuXU"'
64
65 ### Settings relating to upstream data providers
66
67 # JSON-RPC servers to get block templates from
68 # See https://en.bitcoin.it/wiki/BIP_0023#Logical_Services for key details
69 TemplateSources = (
70         {
71                 'name': 'primary',
72                 'uri': 'http://user:pass@localhost:8332',
73                 'priority': 0,
74                 'weight': 1,
75         },
76         {
77                 'name': 'secondary',
78                 'uri': 'http://user:pass@localhost:18332',
79                 'priority': 1,
80                 'weight': 1,
81         },
82 )
83
84 # JSON-RPC servers to check block proposals with
85 # If none provided, and selected source supports proposals, it alone will also
86 # be used for checking
87 # NOTE: Any servers listed here MUST support BIP 23 Block Proposals
88 # NOTE: Mainline bitcoind (as of 0.8) does NOT support this (though the 0.8.0.eligius branch does)
89 TemplateChecks = (
90         {
91                 'name': 'primary',
92                 'uri': 'http://user:pass@localhost:8332',
93                 
94                 # If 'unanimous' is true, no template will be used if this node
95                 # rejects it
96                 'unanimous': False,
97                 
98                 # If check servers disagree on all templates, they will be scored and
99                 # the highest score will be used; 'weight' can be used to control the
100                 # scoring per-server
101                 'weight': 1.1,
102         },
103         {
104                 'name': 'secondary',
105                 'uri': 'http://user:pass@localhost:18332',
106                 'unanimous': False,
107                 'weight': 1,
108         },
109 )
110
111 # JSON-RPC servers to submit found blocks to (when they meet the full target)
112 # The specific TemplateSource that the block was based on will always be sent
113 # the block first.
114 # If setting is not specified, or None, full TemplateSources list will be used.
115 # If an empty list, no extra submissions will be attempted.
116 # If an empty list, and the block was found on a "clear" merkle root (not based
117 # on any TemplateSource), the full TemplateSources list will be used.
118 BlockSubmissions = (
119         {
120                 'name': 'primary',
121                 'uri': 'http://user:pass@localhost:8332',
122         },
123         {
124                 'name': 'secondary',
125                 'uri': 'http://user:pass@localhost:18332',
126         }
127 )
128
129 # Templates will not be used unless they have an acceptance ratio above this
130 # Range: 0.00 - 1.00
131 MinimumTemplateAcceptanceRatio = 0
132
133 # No template with a combined total score below this will be used
134 MinimumTemplateScore = 1
135
136 # Set to True if you want shares meeting the upstream target to wait for a
137 # response from an upstream server before logging them. Otherwise, for such
138 # shares, upstreamResult will always be True and upstreamRejectReason will
139 # always be None. Note that enabling this may cause shares to be logged out of
140 # order, or with the wrong timestamp (if your share logger uses the log-time
141 # rather than share-time).
142 DelayLogForUpstream = False
143
144 # Bitcoin p2p server for announcing blocks found
145 UpstreamBitcoindNode = ('127.0.0.1', 18333)  # testnet
146
147 # Network ID for the primary blockchain
148 # Other known network IDs can be found at:
149 #     https://en.bitcoin.it/wiki/Protocol_specification#Message_structure
150 UpstreamNetworkId = b'\x0b\x11\x09\x07'  # testnet3
151
152 # Secret username allowed to use setworkaux
153 #SecretUser = ""
154
155 # URI to send gotwork with info for every share submission
156 #GotWorkURI = ''
157
158 # Share hashes must be below this to be submitted to gotwork
159 GotWorkTarget = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
160
161 # Aim to produce blocks with transaction counts that are a power of two
162 # This helps avoid any chance of someone abusing CVE-2012-2459 with them
163 # 1 = cut out feeless transactions; 2 = cut out even fee-included transactions (if possible)
164 POT = 2
165
166 # Avoid mining feeless transactions except to satisfy POT
167 # Note this only works if POT is in fact enabled in the first place
168 Greedy = False
169
170 ### Settings relating to network services
171 # Note that Eloipool only supports IPv6 sockets, and if you want to bind to an
172 # IPv4 address you will need to prepend it with ::ffff: eg ::ffff:192.168.1.2
173
174 # Addresses to listen on for JSON-RPC GBT/getwork server
175 JSONRPCAddresses = (
176         ('', 8337),
177 )
178
179 # Addresses to listen on for Stratum mining server
180 StratumAddresses = (
181         ('', 3334),
182 )
183
184 # Addresses to listen on for Bitcoin node
185 # Note this will only be used to distribute blocks the pool finds, nothing else
186 BitcoinNodeAddresses = (
187         ('', 8338),
188 )
189
190 # Addresses that are allowed to "spoof" from address with the X-Forwarded-For header
191 TrustedForwarders = ('::ffff:127.0.0.1',)
192
193
194 # Logging of shares:
195 ShareLogging = (
196         {
197                 'type': 'logfile',
198                 'filename': 'share-logfile',
199                 'format': "{time} {Q(remoteHost)} {username} {YN(not(rejectReason))} {dash(YN(upstreamResult))} {dash(rejectReason)} {solution}\n",
200         },
201         {
202                 'type': 'sql',
203                 'engine': 'postgres',
204                 'dbopts': {
205                         'host': 'localhost',
206                         'database': 'pooldb',
207                         'user': 'eloipool',
208                         'password': 'somethingsecret',
209                 },
210                 'statement': "insert into shares (rem_host, username, our_result, upstream_result, reason, solution) values ({Q(remoteHost)}, {username}, {YN(not(rejectReason))}, {YN(upstreamResult)}, {rejectReason}, decode({solution}, 'hex'))",
211         },
212         {
213                 'type': 'sql',
214                 'engine': 'mysql',
215                 'dbopts': {
216                         'host': 'localhost',
217                         'db': 'pooldb',
218                         'user': 'eloipool',
219                         'password': 'somethingsecret',
220                 },
221                 'statement': "insert into shares (rem_host, username, our_result, upstream_result, reason, solution) values ({Q(remoteHost)}, {username}, {YN(not(rejectReason))}, {YN(upstreamResult)}, {rejectReason}, unhex({solution}))",
222         },
223         {
224                 'type': 'sql',
225                 'engine': 'sqlite',
226                 'dbopts': {
227                         'database': 'share.db',
228                 },
229                 'statement': "insert into shares (remoteHost, username, rejectReason, upstreamResult, solution) values ({remoteHost}, {username}, {rejectReason}, {upstreamResult}, {solution})",
230         },
231 )
232
233 # Authentication
234 # There currently are 2 modules.
235 # - allowall will allow every username/password combination
236 # - simplefile will use the username/passwords from a file, which contains username<tab>password\n with no \n on the last line.
237 Authentication =  (
238         {
239                 'module': 'allowall',
240         },
241 #       {
242 #               'module': 'simplefile',
243 #               'filename': 'userdatabase',
244 #       },
245 )
246
247 ### Settings related to poolserver logging
248
249 # By default, significant events will be printed to the interactive console
250 # You can customize your logging using either simple parameters, or Python's advanced logging framework
251 # Note that using Python's logging framework will override the default console logging!
252
253 # To simply log everything to the system log (syslog) as well:
254 # LogToSysLog = True
255
256 # To make a log file:
257 # LogFile = 'filename.log'
258
259 # For a rotating log file:
260 LogFile = {
261         'filename': 'filename.log',
262         'when': 'midnight',
263         'backupCount': 7,
264 }
265 # For details, see:
266 # http://docs.python.org/3/library/logging.handlers.html#logging.handlers.TimedRotatingFileHandler