Replace "%p" with the previous block hash in CoinbaserCmd
[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 # %d is replaced with the total value of the block reward (in satoshis)
63 # %p is replaced with the previous block hash in hexadecimal
64 # NOTE: This example donates 1% of block rewards to Luke-Jr for Eloipool development
65 CoinbaserCmd = 'echo -e "1\\n$((%d / 100))\\n1579aXhdwvKZEMrAKoCZhzGuqMa8EonuXU"'
66
67 ### Settings relating to upstream data providers
68
69 # JSON-RPC servers to get block templates from
70 # See https://en.bitcoin.it/wiki/BIP_0023#Logical_Services for key details
71 TemplateSources = (
72         {
73                 'name': 'primary',
74                 'uri': 'http://user:pass@localhost:8332',
75                 'priority': 0,
76                 'weight': 1,
77         },
78         {
79                 'name': 'secondary',
80                 'uri': 'http://user:pass@localhost:18332',
81                 'priority': 1,
82                 'weight': 1,
83         },
84 )
85
86 # JSON-RPC servers to check block proposals with
87 # If none provided, and selected source supports proposals, it alone will also
88 # be used for checking
89 # NOTE: Any servers listed here MUST support BIP 23 Block Proposals
90 # NOTE: Mainline bitcoind (as of 0.8) does NOT support this (though the 0.8.0.eligius branch does)
91 TemplateChecks = (
92         {
93                 'name': 'primary',
94                 'uri': 'http://user:pass@localhost:8332',
95                 
96                 # If 'unanimous' is true, no template will be used if this node
97                 # rejects it
98                 'unanimous': False,
99                 
100                 # If check servers disagree on all templates, they will be scored and
101                 # the highest score will be used; 'weight' can be used to control the
102                 # scoring per-server
103                 'weight': 1.1,
104         },
105         {
106                 'name': 'secondary',
107                 'uri': 'http://user:pass@localhost:18332',
108                 'unanimous': False,
109                 'weight': 1,
110         },
111 )
112
113 # JSON-RPC servers to submit found blocks to (when they meet the full target)
114 # The specific TemplateSource that the block was based on will always be sent
115 # the block first.
116 # If setting is not specified, or None, full TemplateSources list will be used.
117 # If an empty list, no extra submissions will be attempted.
118 # If an empty list, and the block was found on a "clear" merkle root (not based
119 # on any TemplateSource), the full TemplateSources list will be used.
120 BlockSubmissions = (
121         {
122                 'name': 'primary',
123                 'uri': 'http://user:pass@localhost:8332',
124         },
125         {
126                 'name': 'secondary',
127                 'uri': 'http://user:pass@localhost:18332',
128         }
129 )
130
131 # Templates will not be used unless they have an acceptance ratio above this
132 # Range: 0.00 - 1.00
133 MinimumTemplateAcceptanceRatio = 0
134
135 # No template with a combined total score below this will be used
136 MinimumTemplateScore = 1
137
138 # Set to True if you want shares meeting the upstream target to wait for a
139 # response from an upstream server before logging them. Otherwise, for such
140 # shares, upstreamResult will always be True and upstreamRejectReason will
141 # always be None. Note that enabling this may cause shares to be logged out of
142 # order, or with the wrong timestamp (if your share logger uses the log-time
143 # rather than share-time).
144 DelayLogForUpstream = False
145
146 # Bitcoin p2p server for announcing blocks found
147 UpstreamBitcoindNode = ('127.0.0.1', 18333)  # testnet
148
149 # Network ID for the primary blockchain
150 # Other known network IDs can be found at:
151 #     https://en.bitcoin.it/wiki/Protocol_specification#Message_structure
152 UpstreamNetworkId = b'\x0b\x11\x09\x07'  # testnet3
153
154 # Secret username allowed to use setworkaux
155 #SecretUser = ""
156
157 # URI to send gotwork with info for every share submission
158 #GotWorkURI = ''
159
160 # Share hashes must be below this to be submitted to gotwork
161 GotWorkTarget = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
162
163 # Aim to produce blocks with transaction counts that are a power of two
164 # This helps avoid any chance of someone abusing CVE-2012-2459 with them
165 # 1 = cut out feeless transactions; 2 = cut out even fee-included transactions (if possible)
166 POT = 2
167
168 # Avoid mining feeless transactions except to satisfy POT
169 # Note this only works if POT is in fact enabled in the first place
170 Greedy = False
171
172 ### Settings relating to network services
173 # Note that Eloipool only supports IPv6 sockets, and if you want to bind to an
174 # IPv4 address you will need to prepend it with ::ffff: eg ::ffff:192.168.1.2
175
176 # Addresses to listen on for JSON-RPC GBT/getwork server
177 JSONRPCAddresses = (
178         ('', 8337),
179 )
180
181 # Addresses to listen on for Stratum mining server
182 StratumAddresses = (
183         ('', 3334),
184 )
185
186 # Addresses to listen on for Bitcoin node
187 # Note this will only be used to distribute blocks the pool finds, nothing else
188 BitcoinNodeAddresses = (
189         ('', 8338),
190 )
191
192 # Addresses that are allowed to "spoof" from address with the X-Forwarded-For header
193 TrustedForwarders = ('::ffff:127.0.0.1',)
194
195
196 # Logging of shares:
197 ShareLogging = (
198         {
199                 'type': 'logfile',
200                 'filename': 'share-logfile',
201                 'format': "{time} {Q(remoteHost)} {username} {YN(not(rejectReason))} {dash(YN(upstreamResult))} {dash(rejectReason)} {solution}\n",
202         },
203         {
204                 'type': 'sql',
205                 'engine': 'postgres',
206                 'dbopts': {
207                         'host': 'localhost',
208                         'database': 'pooldb',
209                         'user': 'eloipool',
210                         'password': 'somethingsecret',
211                 },
212                 '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'))",
213         },
214         {
215                 'type': 'sql',
216                 'engine': 'mysql',
217                 'dbopts': {
218                         'host': 'localhost',
219                         'db': 'pooldb',
220                         'user': 'eloipool',
221                         'password': 'somethingsecret',
222                 },
223                 '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}))",
224         },
225         {
226                 'type': 'sql',
227                 'engine': 'sqlite',
228                 'dbopts': {
229                         'database': 'share.db',
230                 },
231                 'statement': "insert into shares (remoteHost, username, rejectReason, upstreamResult, solution) values ({remoteHost}, {username}, {rejectReason}, {upstreamResult}, {solution})",
232         },
233 )
234
235 # Authentication
236 # There currently are 2 modules.
237 # - allowall will allow every username/password combination
238 # - simplefile will use the username/passwords from a file, which contains username<tab>password\n with no \n on the last line.
239 Authentication =  (
240         {
241                 'module': 'allowall',
242         },
243 #       {
244 #               'module': 'simplefile',
245 #               'filename': 'userdatabase',
246 #       },
247 )
248
249 ### Settings related to poolserver logging
250
251 # By default, significant events will be printed to the interactive console
252 # You can customize your logging using either simple parameters, or Python's advanced logging framework
253 # Note that using Python's logging framework will override the default console logging!
254
255 # To simply log everything to the system log (syslog) as well:
256 # LogToSysLog = True
257
258 # To make a log file:
259 # LogFile = 'filename.log'
260
261 # For a rotating log file:
262 LogFile = {
263         'filename': 'filename.log',
264         'when': 'midnight',
265         'backupCount': 7,
266 }
267 # For details, see:
268 # http://docs.python.org/3/library/logging.handlers.html#logging.handlers.TimedRotatingFileHandler