Show Posts
|
Pages: [1]
|
Just to answer a question over in the miner section, which got discussed there under the title "New pure-python CPU miner, for fun and testing" http://forum.bitcoin.org/index.php?topic=3546.0;all, due to my newbie restriction now here. The patch I provided only fixes the problem with running pyminer under windows. Unfortunately I haven't found a solution to the btcguild problem with the error message BadStatusLine. I believe it has something to do with btcguild and I am not familiar with their interface.
|
|
|
I also get the error if I use btcguild. I use phython 2.5.3 on linux debian lenny (is this a problem). I run The program with one thread.
...
I ran it under Ubuntu Lucid Lynx with Python 2.6.5 and under Windows with Python 2.7. In both cases I get the error. It looks like the problem occurs when after the second request another one is started. When adding debug output I see it run in the miner.loop() the self.iterate(rpc) call twice. After it finishes the second loop and starts the 3rd call to self.iterate(rpc) the response with an empty header is returned. Breaking with the 3rd rpc call is independent of the amount of threads. So with one thread it breaks with the 3rd call and with two threads running it breaks each thread with the 3rd call as well. One interesting thing to note is, that the max_nonce value goes up. I thought it would go down in consecutive runs. In the first run it is set to 1,000,000. In the second run it goes up to 4,885,595.
|
|
|
No.
This is IMHO one of the core problems if Bitcoin - not "someone looses it", but when mining finally stops, the amount of coins WILL deteriorate over time. Even a small drippling effect WILL slowly reduce butcoins out of existence. Over a long long long time.
And then every bitcoin will be worth more. So prices will drop to small fractions. And then we just shift everything a bit, and finally by magical division, we have enough full coins again Maybe I still don't get the whole concept, but I understand that due to some computation a bitcoin is represented by a proven hash calculation. So now, the overall volumen is not created yet and there is are still bitcoins mined. But once mining stops, the volume is set. From this time on no more bitcoins can be "created" but they can get "lost" by i.e. people loosing their wallet. I understand that this does not harm the value of the currency, but if I understand it right, the volume will in the best case remain the same or decrease after mining stopped. But there is no way to compensate for lost bitcoins after mining stopped. I guess due to the amount of bitcoins it is considered acceptable to lose some?
|
|
|
Create a new wallet with entirely new keys. Transfer your entire balance to one or more of the new keys.
Best answer, I think. Is it possible to transfer the balance, if the keys of the old wallet account are not available anymore?
|
|
|
I ran the latest git-version with the patch I posted earlier under windows and linux using an account at btcguild.com and got the following error message: G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer>python pyminer.py btcguild-config.cfg 2 mining threads started Sat Jun 04 00:41:52 2011 Miner Starts - btcguild.com:8332 HashMeter(0): 1000000 hashes, 136.18 Khash/sec HashMeter(1): 1000000 hashes, 136.46 Khash/sec HashMeter(0): 8171047 hashes, 135.41 Khash/sec Process Process-1: Traceback (most recent call last): File "G:\Python27\lib\multiprocessing\process.py", line 232, in _bootstrap self.run() File "G:\Python27\lib\multiprocessing\process.py", line 88, in run self._target(*self._args, **self._kwargs) File "G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer\pyminer.py", line 208, in miner_thread miner.loop() File "G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer\pyminer.py", line 204, in loop self.iterate(rpc) File "G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer\pyminer.py", line 168, in iterate work = rpc.getwork() File "G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer\pyminer.py", line 76, in getwork return self.rpc('getwork', data) File "G:\Dokumente und Einstellungen\anna\Eigene Dateien\pj\pyminer\pyminer.py", line 56, in rpc resp = self.conn.getresponse() File "G:\Python27\lib\httplib.py", line 1025, in getresponse response.begin() File "G:\Python27\lib\httplib.py", line 401, in begin version, status, reason = self._read_status() File "G:\Python27\lib\httplib.py", line 365, in _read_status raise BadStatusLine(line) BadStatusLine: '' HashMeter(1): 8187772 hashes, 135.47 Khash/sec Process Process-2: ... Sat Jun 04 00:43:00 2011 Miner Stops - btcguild.com:8332
Running it with two threads I took out the trace back from the second process. Anyone knows why there is an empty status line returned? Thanks for your help.
|
|
|
... Sorry, not in a patch form.
OK, fixed that. Here is a diff of it. diff --git pyminer.py pyminer.py index 051abb3..b203aa8 100755 --- pyminer.py +++ pyminer.py @@ -97,8 +97,9 @@ def wordreverse(in_buf): return ''.join(out_words) class Miner: - def __init__(self, id): + def __init__(self, id, settings=None): self.id = id + self.settings=settings self.max_nonce = MAX_NONCE def work(self, datastr, targetstr): @@ -181,11 +182,11 @@ class Miner: time_diff = time_end - time_start self.max_nonce = long( - (hashes_done * settings['scantime']) / time_diff) + (hashes_done * self.settings['scantime']) / time_diff) if self.max_nonce > 0xfffffffaL: self.max_nonce = 0xfffffffaL - if settings['hashmeter']: + if self.settings['hashmeter']: print "HashMeter(%d): %d hashes, %.2f Khash/sec" % ( self.id, hashes_done, (hashes_done / 1000.0) / time_diff) @@ -194,16 +195,16 @@ class Miner: self.submit_work(rpc, work['data'], nonce_bin) def loop(self): - rpc = BitcoinRPC(settings['host'], settings['port'], - settings['rpcuser'], settings['rpcpass']) + rpc = BitcoinRPC(self.settings['host'], self.settings['port'], + self.settings['rpcuser'], self.settings['rpcpass']) if rpc is None: return while True: self.iterate(rpc) -def miner_thread(id): - miner = Miner(id) +def miner_thread(id, settings): + miner = Miner(id, settings) miner.loop() if __name__ == '__main__': @@ -248,7 +249,7 @@ if __name__ == '__main__': thr_list = [] for thr_id in range(settings['threads']): - p = Process(target=miner_thread, args=(thr_id,)) + p = Process(target=miner_thread, args=(thr_id, settings,)) p.start() thr_list.append(p) time.sleep(1) # stagger threads
|
|
|
I'm trying to run this and getting an exception: Process Process-1: Traceback (most recent call last): File "C:\Python26\lib\multiprocessing\process.py", line 232, in _bootstrap self.run() File "C:\Python26\lib\multiprocessing\process.py", line 88, in run self._target(*self._args, **self._kwargs) File "C:\Users\Chris\workspace\pyminer\pyminer.py", line 197, in miner_thread miner.loop() File "C:\Users\Chris\workspace\pyminer\pyminer.py", line 187, in loop rpc = BitcoinRPC(settings['host'], settings['port'], KeyError: 'host' 1 mining threads started Sun Feb 27 15:51:18 2011 Miner Starts - 127.0.0.1:8332 Sun Feb 27 15:51:18 2011 Miner Stops - 127.0.0.1:8332
It seems that the settings dictionary is empty, because when we're using separate processes the children don't have access to the parent's variables. Probably the settings should be passed in as constructor arguments. I might put this up on GitHub and hack on it a bit if you don't mind I did some changes to make it work under Windows: class Miner: def __init__(self, id, settings=None): self.id = id self.settings=settings self.max_nonce = MAX_NONCE ...
def iterate(self, rpc): ... self.max_nonce = long( (hashes_done * self.settings['scantime']) / time_diff) if self.max_nonce > 0xfffffffaL: self.max_nonce = 0xfffffffaL ... if self.settings['hashmeter']: print "HashMeter(%d): %d hashes, %.2f Khash/sec" % ( self.id, hashes_done, (hashes_done / 1000.0) / time_diff)
...
def loop(self): rpc = BitcoinRPC(self.settings['host'], self.settings['port'], self.settings['rpcuser'], self.settings['rpcpass']) if rpc is None: return
...
def miner_thread(id, settings): miner = Miner(id, settings) miner.loop()
...
thr_list = [] for thr_id in range(settings['threads']): p = Process(target=miner_thread, args=(thr_id, settings)) p.start() thr_list.append(p) time.sleep(1) # stagger threads
Sorry, not in a patch form.
|
|
|
|