I guess I am faster with my code!
in pools.py:
@@ -9,6 +9,7 @@ import sys
import exceptions
import optparse
import time
+import re
from twisted.web import server, resource
from client import Agent
@@ -68,7 +69,11 @@ servers = {
'bitp':{'shares': default_shares, 'name': 'bitp.it',
'mine_address': 'pool.bitp.it:8334', 'user': bitp_user,
'pass': bitp_pass, 'lag': False, 'LP': None,
- 'api_address':'https://pool.bitp.it/api/pool'}
+ 'api_address':'https://pool.bitp.it/api/pool'},
+ 'triplemining':{'shares': default_shares, 'name': 'triplemining.com',
+ 'mine_address': 'eu.triplemining.com:8344', 'user': triplemining_user,
+ 'pass': triplemining_pass, 'lag': False, 'LP': None,
+ 'api_address':'https://www.triplemining.com/stats'}
}
current_server = 'btcg'
@@ -289,6 +294,14 @@ def bitclockers_sharesResponse(response):
servers['bitclockers']['shares'] = round_shares
log_dbg( 'bitclockers :' + str(round_shares))
+def triplemining_sharesResponse(response):
+ global servers
+ statpage = response
+ shares = re.search(r"[0-9]* | ", statpage).group(0)[4:-5]
+ round_shares = int(shares)
+ servers['triplemining']['shares'] = round_shares
+ log_dbg( 'triplemining :' + str(round_shares))
+
def errsharesResponse(error, args):
log_msg('Error in pool api for ' + str(args))
log_msg(str(error))
@@ -305,7 +318,8 @@ def selectsharesResponse(response, args):
'btcg':btcguild_sharesResponse,
'eclipsemc':eclipsemc_sharesResponse,
'miningmainframe':mmf_sharesResponse,
- 'bitp':bitp_sharesResponse}
+ 'bitp':bitp_sharesResponse,
+ 'triplemining':triplemining_sharesResponse}
func_map[args](response)
server_update()
and you need a triplemining_user and a triplemining_pass of course in the passwords file.
Th regex currently just takes the first number in a
tag which luckily is the current shares number. A bit more safe would be to check for the "MINING" line and then take the next number or so... however: It works for the time being!
member
Activity: 66
Merit: 10
I actually have a sharesResponse definition for triplemining. I used regex and I'm sure it would break if the layout changed at all, but it's functional. I'll post the code when I get home.
The main point for refactoring the code is that changes in the main pool.py routines wouldn't require merging those changes with my own changes. Maybe I'll see if I can do some of that myself and do a proper fork.
legendary
Activity: 2618
Merit: 1007
I think that would make it pretty easy for some of us that just play around with python to add a custom pool into the rotation.
It's the same difficulty as now, only that you have to write the function(s) in pool.py, not in a seperate file. There's not much to do anyways: A sharesResponse function, a entry in the dictionary and the user/pass info. I am writing one for triplemining right now, the only problem is that I need to load their stats-page and manually scrape it (with beautiful soup it would be easier but that adds another library - I'll try to do it with some regex kung-fu) instead of having it in json. That can all go in the sharesResponse though, so no big deal.
sr. member
Activity: 314
Merit: 251
Instead of or in addition to --disbale what about just evaluating the existence of username and/or password. If it doesn't exist ignore it.
full member
Activity: 157
Merit: 101
ah, ofcourse.
member
Activity: 61
Merit: 10
[17:05:01] Error in pool api for eclipsemc [17:05:01] [Failure instance: Traceback: : No JSON object could be decoded /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1076:gotResult /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1063:_inlineCallbacks /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:361:callback /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:455:_startRunCallbacks --- --- /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:542:_runCallbacks pool.py:309:selectsharesResponse pool.py:250:eclipsemc_sharesResponse /usr/lib/python2.7/json/__init__.py:326:loads /usr/lib/python2.7/json/decoder.py:360:decode /usr/lib/python2.7/json/decoder.py:378:raw_decode ]
I think this is caused by the fact that eclipse mining website https://eclipsemc.com/ is not currently working 100%, so no API data is currently available from them. Bithopper sees this and is reporting it as an API error; expected behavior I would say.
donator
Activity: 2058
Merit: 1007
Poor impulse control.
All in all, I fear that only client side stats from bithopper will be useful (but might not reflect the reality 100%, as in the end only what reaches your wallet counts!). The ones from pools might be interesting for basic statistics, but you can't even see how lucky/unlucky you were each round (something that I'm interested in). They could be used to verify the local stats though and/or to correct them.
A whole heap of Multipool is devoted to this. I couldn't do it, but Nick from Multiclone seems like a nice guy, and he's on the case and might be able to give a hand adapting it by explaining the bits to do with html scraping.
full member
Activity: 157
Merit: 101
[17:05:01] Error in pool api for eclipsemc [17:05:01] [Failure instance: Traceback: : No JSON object could be decoded /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1076:gotResult /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1063:_inlineCallbacks /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:361:callback /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:455:_startRunCallbacks --- --- /usr/lib/python2.7/dist-packages/twisted/internet/defer.py:542:_runCallbacks pool.py:309:selectsharesResponse pool.py:250:eclipsemc_sharesResponse /usr/lib/python2.7/json/__init__.py:326:loads /usr/lib/python2.7/json/decoder.py:360:decode /usr/lib/python2.7/json/decoder.py:378:raw_decode ]
donator
Activity: 2058
Merit: 1007
Poor impulse control.
Edit: It seems to me that bitHopper hops to early! According to https://forum.bitcoin.org/index.php?topic=3165.0 line 169 should read min_shares = difficulty*.435, not min_shares = difficulty*.40! We still loose some "hot" share this way in the worst case. the min_shares = difficulty*.435 comes from a special case of hopping from a 'contributed' model to a 'connected' model. It was a proof-of-concept, and I don't know how applicable the exact figure is to hopping multiple proportional pools. I was trying to figure it out and then thought it might just be easier to run a simulation and vary the percentages to see what the best outcomes were. Unfortunately I can't find a good poisson distribution random number generator for non-integers (ie fractions of difficulty). Any ideas?
member
Activity: 66
Merit: 10
Hey, c00w, what's the chance we could have the code a bit refactored so each pool has an include or something similar? Something along the lines that the user/pass, server definition, shares definition, etc. are in a single location? The reason I ask is that it would then be very easy to 'plug in' another pool option just by adding a new .py file for that pool.
I think that would make it pretty easy for some of us that just play around with python to add a custom pool into the rotation.
|