slush0 / stratum-mining-proxy

Application providing bridge between old HTTP/getwork protocol and Stratum mining protocol.
400 stars 280 forks source link

REJECTED at 100% with latest build. #35

Closed TazMan143 closed 10 years ago

TazMan143 commented 11 years ago

I had been running your older build from August with no issues. Since moving to the latest build I get the following. I have tried with both the stratum and getwork protocols.

./mining_proxy.py -o stratum.ltc123.net -p 3333 2013-10-04 07:54:54,889 INFO proxy jobs. # C extension for midstate not available. Using default implementation instead. 2013-10-04 07:54:54,907 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2 2013-10-04 07:54:54,915 WARNING proxy mining_proxy.test_update # Checking for updates... 2013-10-04 07:54:56,079 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.ltc123.net:3333 2013-10-04 07:54:56,204 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2013-10-04 07:54:56,204 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.ltc123.net:3333 2013-10-04 07:54:56,205 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs 2013-10-04 07:54:56,333 WARNING proxy mining_proxy.main # ----------------------------------------------------------------------- 2013-10-04 07:54:56,333 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork) 2013-10-04 07:54:56,333 WARNING proxy mining_proxy.main # ----------------------------------------------------------------------- 2013-10-04 07:54:56,334 INFO proxy client_service.handle_event # Setting new difficulty: 128 2013-10-04 07:54:56,334 INFO proxy client_service.handle_event # New job 3d98 for prevhash 2e62b5d8, clean_jobs=True 2013-10-04 07:55:11,069 INFO proxy client_service.handle_event # New job 3d99 for prevhash 2e62b5d8, clean_jobs=False 2013-10-04 07:55:36,429 INFO proxy client_service.handle_event # New job 3d9a for prevhash d029c168, clean_jobs=True 2013-10-04 07:55:57,328 INFO stats stats.print_stats # 2 peers connected, state changed 1 times 2013-10-04 07:56:11,011 INFO proxy stratum_listener.submit # [123ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:12,493 INFO proxy stratum_listener.submit # [124ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:15,516 INFO proxy stratum_listener.submit # [122ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:16,971 INFO proxy stratum_listener.submit # [123ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:18,461 INFO proxy stratum_listener.submit # [123ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:18,501 INFO proxy stratum_listener.submit # [124ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:21,542 INFO proxy stratum_listener.submit # [124ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) 2013-10-04 07:56:21,542 INFO proxy stratum_listener.submit # [124ms] Share from 'TazMan143.gpu1' REJECTED: (-2, u'Share is above target', None) ^C2013-10-04 07:56:23,585 INFO proxy mining_proxy.on_shutdown # Shutting down proxy... 2013-10-04 07:56:23,586 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.ltc123.net:3333 2013-10-04 07:56:23,586 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2013-10-04 07:56:23,587 INFO stats stats.print_stats # 0 peers connected, state changed 1 times

slush0 commented 11 years ago

Hi, actually you're not the first reporting such issue. Can I ask you what proxy version did you use originally?

TazMan143 commented 11 years ago

The old version that worked with no issues was version 1.3.0

./mining_proxy.py -o stratum.ltc123.net -p 3333 2013-10-04 08:47:05,622 WARNING proxy jobs. # C extension for midstate not available. Using default implementation instead. 2013-10-04 08:47:05,641 INFO proxy mining_proxy.main # Stratum proxy version: 1.3.0 2013-10-04 08:47:05,641 INFO proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.ltc123.net:3333 2013-10-04 08:47:05,644 INFO proxy mining_proxy.main # Setting PoW algo: scrypt 2013-10-04 08:47:05,874 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2013-10-04 08:47:05,875 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.ltc123.net:3333 2013-10-04 08:47:05,875 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs 2013-10-04 08:47:06,000 INFO proxy mining_proxy.main # ----------------------------------------------------------------------- 2013-10-04 08:47:06,000 INFO proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork) 2013-10-04 08:47:06,000 INFO proxy mining_proxy.main # ----------------------------------------------------------------------- 2013-10-04 08:47:06,001 INFO proxy client_service.handle_event # Setting new difficulty: 128 2013-10-04 08:47:06,001 INFO proxy client_service.handle_event # New job 3dd4 for prevhash da63a0a2, clean_jobs=True

TazMan143 commented 11 years ago

Sorry for the confusion. Bad mouse.

slush0 commented 11 years ago

Hm, I see such problem on one of my machine as well, but I need to dig into it more, because I don't see any obvious solution here.

GitWheelHub commented 10 years ago

I have the same problem as TazMan143

Pooler_cpu and CudaMiner connect and function flawlessly; however, both CGMiner and Reaper have problems.

With Reaper, mining_proxy says reaper is asking for work but not shares are ever submitted.

CGMiner cannot submit shares either. REJECTED: (-2, u'Share is above target', None)

Can you please help me resolve this?

GitWheelHub commented 10 years ago

I checked out 1.3.0 and CGMiner seems to be working with it.

I did receive an error:

2013-11-28 10:23:05,813 DEBUG proxy mining_proxy._on_authorized # Worker 'XXXXX.xx' asks for new work Unhandled error in Deferred: Unhandled Error Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/resource.py", line 250, in render return m(request) File "./mining_proxy.py", line 556, in render_POST d.addCallback(self._on_authorized, request, worker_name) File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 306, in addCallback callbackKeywords=kw) File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 295, in addCallbacks self._runCallbacks() --- --- File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 577, in _runCallbacks current.result = callback(current.result, _args, *_kw) File "./mining_proxy.py", line 501, in _on_authorized request.write(self.json_response(data['id'], self.job_registry.getwork())) File "./mining_proxy.py", line 343, in getwork merkle_root = binascii.hexlify(reverse_hash2(job.build_merkle_root(coinbase_hash))) exceptions.NameError: global name 'reverse_hash2' is not defined 2013-11-28 10:23:44,608 INFO proxy mining_proxy.add_template # New job for prevhash f6d0e998de09324fc7b6d9c1681c137fea0a0d20458bcbbf7849da0d13f5 d510 2013-11-28 10:24:14,579 INFO proxy mining_proxy.add_template # New job for prevhash da8a95acc2acb5dbb7c206be57232c4a8b88a91aec1b5225358948aa49c7

gjcourt commented 10 years ago

I'm also having the same problem as @TazMan143. I'm running 2 BFL Jalapenos with cgminer on an rpi model b over wifi. My connection isn't great, about 7mb down.

From the latest master of the stratum proxy 2013-12-07_17:18:14.51030 2013-12-07 17:18:14,508 INFO proxy client_service.handle_event # New job 84cf for prevhash cf4f86bd, clean_jobs=True
2013-12-07_17:18:16.29370 2013-12-07 17:18:16,291 INFO proxy client_service.handle_event # New job 84d0 for prevhash cf4f86bd, clean_jobs=False
2013-12-07_17:18:18.19646 2013-12-07 17:18:18,195 INFO proxy stratum_listener.submit # [477ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)
2013-12-07_17:18:18.80288 2013-12-07 17:18:18,801 INFO proxy stratum_listener.submit # [106ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)
2013-12-07_17:18:19.85999 2013-12-07 17:18:19,858 INFO proxy stratum_listener.submit # [106ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)
2013-12-07_17:18:21.82065 2013-12-07 17:18:21,819 INFO proxy stratum_listener.submit # [102ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)
2013-12-07_17:18:21.85828 2013-12-07 17:18:21,856 INFO proxy stratum_listener.submit # [105ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)
2013-12-07_17:18:28.89484 2013-12-07 17:18:28,893 INFO proxy stratum_listener.submit # [185ms] Share fr m 'gjcourt.worker1' REJECTED: (-2, u'Share is above target', None)

And from cgminer 3.8.3 [2013-12-07 17:18:18] Rejected 0a522950 Diff 25/13 BAJ 0 pool 0 ((-2, u'Share is above target 2013-12-07_17:18:18.81090 [2013-12-07 17:18:18] Rejected 0bf08b93 Diff 21/13 BAJ 0 pool 0 ((-2, u'Sha e is above target 2013-12-07_17:18:19.86852 [2013-12-07 17:18:19] Rejected 132a7eaf Diff 13/13 BAJ 0 pool 0 ((-2, u'Sha e is above target 2013-12-07_17:18:21.82863 [2013-12-07 17:18:21] Rejected 0348cb7e Diff 78/13 BAJ 0 pool 0 ((-2, u'Sha e is above target 2013-12-07_17:18:21.86704 [2013-12-07 17:18:21] Rejected 03bcc3e6 Diff 68/13 BAJ 1 pool 0 ((-2, u'Sha e is above target 2013-12-07_17:18:22.66638 [2013-12-07 17:18:18] Rejected 0a522950 Diff 25/13 BAJ 0 pool 0 ((-2, u'Sha e is above target
2013-12-07_17:18:22.67539 [2013-12-07 17:18:18] Rejected 0bf08b93 Diff 21/13 BAJ 0 pool 0 ((-2, u'Sha e is above target
2013-12-07_17:18:22.67634 [2013-12-07 17:18:19] Rejected 132a7eaf Diff 13/13 BAJ 0 pool 0 ((-2, u'Sha e is above target
2013-12-07_17:18:22.67739 [2013-12-07 17:18:21] Rejected 0348cb7e Diff 78/13 BAJ 0 pool 0 ((-2, u'Sha e is above target
2013-12-07_17:18:22.67869 [2013-12-07 17:18:21] Rejected 03bcc3e6 Diff 68/13 BAJ 1 pool 0 ((-2, u'Sha e is above target

FaysalM commented 10 years ago

I can confirm that the latest bfgminer does not have this problem. It is submitting shares correctly. Problem seems to be isolated to cgminer. I am using cgminer 3.7.2 with 100% rejects.

Looks like there is an issue with difficulty changing on the proxy but the pool is reporting a different difficult.

FaysalM commented 10 years ago

bfgminer also has its own issues, its not showing any diff on the miner itself, but the proxy shows accepts. Output from BFGminer

[2013-12-15 21:42:54] Accepted 0196a835 OCL 0 Diff 0/0 [2013-12-15 21:43:01] Accepted 0070eab8 OCL 0 Diff 0/0 [2013-12-15 21:43:53] Accepted 00114718 OCL 0 Diff 0/0 [2013-12-15 21:43:54] Accepted 01b89c7a OCL 0 Diff 0/0 [2013-12-15 21:43:54] Stratum from pool 0 requested work update [2013-12-15 21:44:03] Accepted 0067fb2a OCL 0 Diff 0/0 [2013-12-15 21:44:03] Accepted 017b4cf1 OCL 0 Diff 0/0 [2013-12-15 21:44:13] Accepted 00d7bace OCL 0 Diff 0/0 [2013-12-15 21:44:15] Accepted 0016a817 OCL 0 Diff 0/0 [2013-12-15 21:44:16] Accepted 005ebedd OCL 0 Diff 0/0 [2013-12-15 21:44:24] Accepted 01afce24 OCL 0 Diff 0/0 [2013-12-15 21:44:24] Accepted 0118421f OCL 0 Diff 0/0 [2013-12-15 21:44:33] Accepted 0054c148 OCL 0 Diff 0/0

elproducto commented 10 years ago

Using CGMINER 3.7.2 I am seeing the same error From CGMiner winodws [2013-12-16 15:52:16] Pool 1 stale share detected, submitting as user requested [2013-12-16 15:52:16] Rejected 02c27c6f Diff 93/55 GPU 0 pool 1 ((-2, u"Job '5a03' not found" [2013-12-16 15:52:21] Rejected 034d53fd Diff 78/55 GPU 0 pool 1 ((-2, u'Share is above target [2013-12-16 15:52:29] Rejected 02c723ed Diff 92/55 GPU 0 pool 1 ((-2, u'Share is above target From Proxy Window 2013-12-16 15:52:15,215 INFO proxy client_service.handle_event # New job 5a04 for prevhash 3b9e9bab, clean_jobs=True 2013-12-16 15:52:16,256 INFO proxy stratum_listener.submit # [202ms] Share from 'elproducto.2' REJECTED: (-2, u"Job '5a03' not found", None) 2013-12-16 15:52:21,393 INFO proxy stratum_listener.submit # [197ms] Share from 'elproducto.2' REJECTED: (-2, u'Share is above target', None) 2013-12-16 15:52:29,987 INFO proxy stratum_listener.submit # [203ms] Share from 'elproducto.2' REJECTED: (-2, u'Share is above target', None) 2013-12-16 15:52:54,002 INFO proxy stratum_listener.submit # [203ms] Share from 'elproducto.2' REJECTED: (-2, u'Share is above target', None) 2013-12-16 15:52:57,434 INFO proxy stratum_listener.submit # [201ms] Share from 'elproducto.2' REJECTED: (-2, u'Share is above target', None)

bigbaug commented 10 years ago

I believe this is a cgminer issue. I have this problem with both proxy 1.3 and 1.5. (scrypt mining)

I just started using the proxy so thought I would test various cgminer builds against proxy 1.5 & 1.3

3.0.0 works normally 3.2.2 works 3.3.0 works 3.3.2 works 3.3.3 does not work but gives "Rejected ((-2, u' Incorrect size of ext 3.3.4 and all later versions up to 3.7.2 gives the "Rejected ((-2, u' Share is above target

I tried this with the proxy connected to hashfaster and ltcrabbit, which I believe are both vardiff pools (256 & 600).

Anyway, hope that is of some help. Maybe some of the others can test cgminer 3.3.2 and see if the problem goes away for you.

chriscohoat commented 10 years ago

I've tested all of the way up to 3.9.0 and it gives the same "Rejected, share is above target" error. Just confirming that 3.9.0 produces the same error.

Going to downgrade to 3.3.2 to see if it fixes things.

ghost commented 10 years ago

hello Tazman , could you please share the Stratum proxy version: 1.3.0 please ? thx you very much

derenma commented 10 years ago

i know 1.3.0 version is bundled with copies of guiminer-scrypt, so you should be able to pick up the windows version that way...

would this issue be related to the removal of the '-pa' option in later versions of stratum? i would love to run the older version if it didn't try to autoupdate during install. :/

derenma commented 10 years ago

not sure... i dunno enough about the code to tell you.

(i dont remember where) but i have heard things about stratum not being nice with x64 architectures as well. i am going to build a 32-bit linux vm today to find out and will report those details as well.

On Sat, Jan 18, 2014 at 1:58 PM, mdude77 notifications@github.com wrote:

Is the cause of it? If so I think it was fixed in cgminer 3.9.0, but the last cgminer with scrypt support was 3.7.2. It'd be awesome if a workaround could be added to the proxy.

https://bitcointalk.org/index.php?topic=28402.msg3971916#msg3971916

look at the msg from nwoolls.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32689723 .

mdude77 commented 10 years ago

I use the stratum proxy today on win x64 for sha256 (for a cube) without a problem. this problem only happens with scrypt.

derenma commented 10 years ago

Check out this fork: https://github.com/CryptoManiac/stratum-mining-proxy

It should still have the scrypt support that we need.

On Sat, Jan 18, 2014 at 4:18 PM, mdude77 notifications@github.com wrote:

I use the stratum proxy today on win x64 for sha256 (for a cube) without a problem. this problem only happens with scrypt.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32693442 .

mdude77 commented 10 years ago

Same error.

derenma commented 10 years ago

ditto. :( i started looking through the code and i have a suspicion the nonce is incorrectly calculated prior to the block being submitted to the remote server. additionally, there are exceptions being thrown from the Python Twisted libs about incorrect arguments being passed to its rpc functions.

i really need this so I will be hacking away at it for the next few days... . two pairs of eyes couldnt hurt, though... how are your Python skills? :D

On Sat, Jan 18, 2014 at 8:46 PM, mdude77 notifications@github.com wrote:

Same error.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32698829 .

derenma commented 10 years ago

i might just fork this project myself....

On Sun, Jan 19, 2014 at 11:35 AM, M. Deren matthew.deren@gmail.com wrote:

ditto. :( i started looking through the code and i have a suspicion the nonce is incorrectly calculated prior to the block being submitted to the remote server. additionally, there are exceptions being thrown from the Python Twisted libs about incorrect arguments being passed to its rpc functions.

i really need this so I will be hacking away at it for the next few days... . two pairs of eyes couldnt hurt, though... how are your Python skills? :D

On Sat, Jan 18, 2014 at 8:46 PM, mdude77 notifications@github.com wrote:

Same error.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32698829 .

slush0 commented 10 years ago

Hi guys, I think there's some problem in recent cgminer, however I have no time to dig into it and find the problem myself. Any help and/or pull request with workaround/fix would be very useful.

derenma commented 10 years ago

Slush: if you have a Stratum protocol reference handy, that would be awesome. Also, if you know of a mining pool that is specifically available for testing, that would be even better. I would hate to flood some poor guys pool with foul data while I am working through this.

Since development has all but stopped for cgminer GPU mining, writing a patch to translate the "bad' request/responses from it would be trivial if the data isn't completely borked. It might have some longevity since every one is stuck on =<3.7.2. Just throwing that out there as my knowledge-base is still fairly limited.

On Sun, Jan 19, 2014 at 12:32 PM, slush0 notifications@github.com wrote:

Hi guys, I think there's some problem in recent cgminer, however I have no time to dig into it and find the problem myself. Any help and/or pull request with workaround/fix would be very useful.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32713931 .

derenma commented 10 years ago

This post is more of a tag for the google-bots and a placeholder for myself. Will post solutions if and when I get them.

Combinations of the following have been tested:

Stratum: v1.5.2, v1.3.0 Ubuntu Server 12.0.4 i386 CentOS 6.5 64bit cgminer 3.6.0 cgminer 3.6.6 cgminer 3.7.2

(Errors are the same regardless if the miners are using getwork or stratum)

root@stratum:/opt/slush0-stratum-mining-proxy-17d3226# ./mining_proxy.py -o us-west.multipool.us -p 7777 -sh 192.x.x.x.x -sp 3333

/usr/lib/python2.7/dist-packages/zope/init.py:3: UserWarning: Module twisted was already imported from /usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-i686.egg/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.7.4-py2.7.egg is being added to sys.path import pkg_resources 2014-01-19 23:20:09,381 INFO proxy jobs. # C extension for midstate not available. Using default implementation instead. 2014-01-19 23:20:09,383 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed Traceback (most recent call last): File "./mining_proxy.py", line 178, in main new_host = (yield utils.detect_stratum(args.host, args.port)) AttributeError: 'module' object has no attribute '_parse' 2014-01-19 23:20:09,384 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2 2014-01-19 23:20:09,386 WARNING proxy mining_proxy.test_update # Checking for updates... 2014-01-19 23:20:09,567 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at us-west.multipool.us:7777 2014-01-19 23:20:09,697 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2014-01-19 23:20:09,698 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at us-west.multipool.us:7777 2014-01-19 23:20:09,699 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs

2014-01-19 23:20:10,004 WARNING proxy mining_proxy.main

2014-01-19 23:20:10,004 WARNING proxy mining_proxy.main # LISTENING FOR MINERS ON http://0.0.0.0:8332 (getwork) and stratum+tcp://:3333 (stratum)

2014-01-19 23:20:10,005 WARNING proxy mining_proxy.main

2014-01-19 23:20:10,005 INFO proxy client_service.handle_event # Setting new difficulty: 512 2014-01-19 23:20:10,006 INFO proxy client_service.handle_event # New job 187d for prevhash 27e22e51, clean_jobs=True 2014-01-19 23:20:41,652 INFO proxy client_service.handle_event # New job 187e for prevhash efb62bec, clean_jobs=True 2014-01-19 23:20:54,310 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:20:54,314 INFO proxy getwork_listener._on_authorized # Worker 'endian01.1' asks for new work 2014-01-19 23:20:54,316 INFO stats stats.print_stats # 2 peers connected, state changed 1 times 2014-01-19 23:20:54,322 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2014-01-19 23:20:54,323 INFO stats stats.print_stats # 2 peers connected, state changed 1 times 2014-01-19 23:20:54,326 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2014-01-19 23:20:54,327 INFO stats stats.print_stats # 2 peers connected, state changed 1 times 2014-01-19 23:20:54,425 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:20:57,874 INFO proxy stratum_listener.submit # [97ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:00,366 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:21:00,367 INFO proxy stratum_listener.submit # [100ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:02,764 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:21:02,766 INFO proxy stratum_listener.submit # [102ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:08,954 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:21:08,956 INFO proxy stratum_listener.submit # [99ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:15,970 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-19 23:21:15,971 INFO proxy stratum_listener.submit # [100ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:17,595 INFO proxy client_service.handle_event # New job 187f for prevhash e25c6c60, clean_jobs=True 2014-01-19 23:21:17,602 INFO proxy stratum_listener.submit # [105ms] Share from 'endian01.1' REJECTED: (-2, u"STALE SHARE (Previous Job '187e')", None) 2014-01-19 23:21:20,111 INFO proxy stratum_listener.submit # [98ms] Share from 'endian01.1' REJECTED: (-2, u'Share is above target', None) 2014-01-19 23:21:20,113 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at us-west.multipool.us:7777

-regards..

On Sun, Jan 19, 2014 at 1:21 PM, M. Deren matthew.deren@gmail.com wrote:

Slush: if you have a Stratum protocol reference handy, that would be awesome. Also, if you know of a mining pool that is specifically available for testing, that would be even better. I would hate to flood some poor guys pool with foul data while I am working through this.

Since development has all but stopped for cgminer GPU mining, writing a patch to translate the "bad' request/responses from it would be trivial if the data isn't completely borked. It might have some longevity since every one is stuck on =<3.7.2. Just throwing that out there as my knowledge-base is still fairly limited.

On Sun, Jan 19, 2014 at 12:32 PM, slush0 notifications@github.com wrote:

Hi guys, I think there's some problem in recent cgminer, however I have no time to dig into it and find the problem myself. Any help and/or pull request with workaround/fix would be very useful.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32713931 .

miner256 commented 10 years ago

I believe I can explain what the problem is: all this is due to a bug in recent versions of Cgminer where CGminer performs miscalculations due to the fact that extranonce size is reduced to 2 bytes by slush's stratum proxy. In fact those versions of CGminer can only handle 4 bytes of extranonce. If the proxy somehow manages to workaround this issue by reformatting extra nonce, adjusting offset, adding null bytes or passing extranonce in separate argument, then all versions of CGminer will be able to connect. Anyone who wants to provide a bugfix for slush stratum proxy, please check cgminer's source code in relation to extranonce size.

derenma commented 10 years ago

OMG, you just saved me hours of research. Thanks miner256!!! :)

miner256 commented 10 years ago

darenma: you're welcome. :) We would all appreciate if you share a patch/fix...

derenma commented 10 years ago

I should be able to hack at this tonight. This is a priority for me as well as my collection of miners is starting to grow. :)

ghost commented 10 years ago

if u need test server add me to skype ill give u one vps that u can test on (skype=pierredemarque)

slush0 commented 10 years ago

Are cgminer developers aware of this bug? Seems to be better solution to fix cgminer and not implement workaround in the proxy; reducing extranonce by 2 bytes is fully valid construct.

mdude77 commented 10 years ago

The problem is scrypt users want to make use of this ... and cgminer stopped supporting scrypt a few versions ago. cgminer dev's will not fix this.

slush0 commented 10 years ago

So the problem with extranonce handling is fixed in recent cgminer?

miner256 commented 10 years ago

slush0: yes, it is fixed in the latest version, but users that are forced to use previous versions of cgminer cannot use any type of proxy unless there is a fix at the proxy side.

derenma commented 10 years ago

Pardon my ignorance on the stratum protocol, but it seems that an extra byte (0xF8) is getting appended to the extranonce when the proxy sends the result to the mining.subsribe method. If this is a valid part of the extranonce, thats fine. If this is an error on cgminers side, it is simply expecting a 4 byte nonce and when it calculates extranonce2, it simply truncates the response to the size request of the proxy...

Can we force the proxy to always force a request for an extranonce2 at 4 bytes?

method: 0x0060: 6c74 223a 205b 5b5b 226d 696e 696e 672e lt":.[[["mining. 0x0070: 7365 745f 6469 6666 6963 756c 7479 222c set_difficulty", 0x0080: 2022 6234 6236 3639 3362 3732 6135 3063 ."b4b6693b72a50c 0x0090: 3731 3136 6462 3138 6436 3439 3763 6163 7116db18d6497cac 0x00a0: 3532 225d 2c20 5b22 6d69 6e69 6e67 2e6e 52"],.["mining.n 0x00b0: 6f74 6966 7922 2c20 2261 6536 3831 3265 otify",."ae6812e 0x00c0: 6234 6364 3737 3335 6133 3032 6138 6139 b4cd7735a302a8a9 0x00d0: 6464 3935 6366 3731 6622 5d5d 2c20 2266 dd95cf71f"]],."f 0x00e0: 3830 3038 3438 3030 3122 2c20 335d 7d0a 800848001",.3]}. <-- extranonce1 f800848001, extranonce2 length = 3

result: 0x0040: 3cbf 7b22 7061 7261 6d73 223a 205b 2265 <.{"params":.["e 0x0050: 6e64 6961 6e30 312e 3322 2c20 2233 3032 ndian01.3",."302 0x0060: 222c 2022 3030 3030 3030 222c 2022 3532 ",."000000",."52 <--- 3 byte extranonce. 0x0070: 6464 6465 3465 222c 2022 6661 3338 3234 ddde4e",."fa3824 0x0080: 3030 225d 2c20 2269 6422 3a20 362c 2022 00"],."id":.6,." 0x0090: 6d65 7468 6f64 223a 2022 6d69 6e69 6e67 method":."mining 0x00a0: 2e73 7562 6d69 7422 7d0a .submit"}.

derenma commented 10 years ago

I have forced a fix. However, I fear that the subscription service may be borked since i had to tamper with the way stratum calculates the size of the extranonce2 combined with "tail".

I will submit a patch for slush0's review in a few....

2014-01-21 11:51:54,006 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2 2014-01-21 11:51:54,020 WARNING proxy mining_proxy.test_update # Checking for updates... 2014-01-21 11:51:54,258 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at us-east.multipool.us:7777 2014-01-21 11:51:54,300 INFO stats stats.print_stats # 1 peers connected, state changed 1 times 2014-01-21 11:51:54,301 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at us-east.multipool.us:7777 2014-01-21 11:51:54,302 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs

2014-01-21 11:51:54,350 WARNING proxy mining_proxy.main

2014-01-21 11:51:54,351 WARNING proxy mining_proxy.main # LISTENING FOR MINERS ON http://0.0.0.0:8332 (getwork) and stratum+tcp://192.168.2.254:3333(stratum)

2014-01-21 11:51:54,352 WARNING proxy mining_proxy.main

2014-01-21 11:51:54,353 INFO proxy client_service.handle_event # Setting new difficulty: 512 2014-01-21 11:51:54,357 INFO proxy client_service.handle_event # New job 293 for prevhash 858308dd, clean_jobs=True 2014-01-21 11:52:12,359 INFO stats stats.print_stats # 2 peers connected, state changed 1 times 2014-01-21 11:52:12,369 INFO proxy stratum_listener.subscribe # Expected extranonce2_size of '4' 2014-01-21 11:52:12,410 INFO proxy client_service.handle_event # Setting new difficulty: 32 2014-01-21 11:52:19,853 INFO proxy stratum_listener.submit # [39ms] Share from 'endian01.1' accepted, diff 32 2014-01-21 11:52:22,185 INFO proxy client_service.handle_event # New job 294 for prevhash b7a264dc, clean_jobs=True 2014-01-21 11:52:28,972 INFO proxy stratum_listener.submit # [33ms] Share from 'endian01.1' accepted, diff 32 2014-01-21 11:52:29,474 INFO proxy stratum_listener.submit # [33ms] Share from 'endian01.1' accepted, diff 32 2014-01-21 11:52:30,762 INFO proxy stratum_listener.submit # [34ms] Share from 'endian01.1' accepted, diff 32

derenma commented 10 years ago

I have emailed the patches directly to slush0 at his listed info@.... email address. If he approves, cool. I don't want to risk making this public now and having miners flood these forums (again) about a broken proxy.

-endian

(jobless atm, IF patches approved, donations welcomed, but think of the original author of this app first.: BTC: 1PpDqPDnpAV1Ja52j39982Z1mE5PepPXro )

slush0 commented 10 years ago

derenma: I'm no longer using info@b...cz for my private email, please use email listed here in github. I'll fix email in stratum sources soon...

slush0 commented 10 years ago

Ad extranonce handling: proxy takes few bytes of extranonce2 for identifying downstream stratum connections; every stratum connection need to have unique extranonce1 to produce unique shares. So if the pool indicates extranonce2_size as 4 bytes, proxy currently takes 2 bytes for internal purposes and provide extranonce2_size=2 to connected miner for calculating jobs on its side.

This logic is implemented in _get_unused_tail() in stratum proxy and it cannot be changed easily IF the bugged cgminer requires 4bytes extranonce2_size.

I still think that forking old cgminer with scrypt support and applying patch fixing that cgminer bug is a better way to go...

derenma commented 10 years ago

hey... i guess i am silly or something, but there is no private email listed. I am going to create a new ticket for the patch and you can hide(?) if you feel its appropriate to do that.

On Tue, Jan 21, 2014 at 1:45 PM, slush0 notifications@github.com wrote:

Ad extranonce handling: proxy takes few bytes of extranonce2 for identifying downstream stratum connections; every stratum connection need to have unique extranonce1 to produce unique shares. So if the pool indicates extranonce2_size as 4 bytes, proxy currently takes 2 bytes for internal purposes and provide extranonce2_size=2 to connected miner for calculating jobs on its side.

This logic is implemented in _get_unused_tail() in stratum proxy and it cannot be changed easily IF the bugged cgminer requires 4bytes extranonce2_size.

I still think that forking old cgminer with scrypt support and applying patch fixing that cgminer bug is a better way to go...

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32919469 .

derenma commented 10 years ago

fyi, there is something else of note... looks like the calc for the coinbase was not equal to what you have listed in your docs. corrected it, but not sure if that is relevant to this particular fix.

On Tue, Jan 21, 2014 at 1:49 PM, M. Deren matthew.deren@gmail.com wrote:

hey... i guess i am silly or something, but there is no private email listed. I am going to create a new ticket for the patch and you can hide(?) if you feel its appropriate to do that.

On Tue, Jan 21, 2014 at 1:45 PM, slush0 notifications@github.com wrote:

Ad extranonce handling: proxy takes few bytes of extranonce2 for identifying downstream stratum connections; every stratum connection need to have unique extranonce1 to produce unique shares. So if the pool indicates extranonce2_size as 4 bytes, proxy currently takes 2 bytes for internal purposes and provide extranonce2_size=2 to connected miner for calculating jobs on its side.

This logic is implemented in _get_unused_tail() in stratum proxy and it cannot be changed easily IF the bugged cgminer requires 4bytes extranonce2_size.

I still think that forking old cgminer with scrypt support and applying patch fixing that cgminer bug is a better way to go...

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-32919469 .

derenma commented 10 years ago

All:

It seems slush doesn't "think" I have my miners working. For some reason, he can't read his own documentation on how the nonce's are generated and can't take the time to be bothered with our information that we are giving him.

So.. With that being said, here is a temp fix that I would love people to test out:

( - remove; + add) jobs.py: ~ line 61

stratum_listener.py: ~ line 155

~line 171

Pcap from an actual connection that I think is happening:

16:24:14.826207 IP 192.168.2.253.dec-notes > 192.168.2.73.60402: Flags [P.], seq 992:1100, ack 183, win 227, options [nop,nop,TS val 267953584 ecr 66607513], length 108 0x0000: bcae c560 13e0 4061 8666 7d3e 0800 4500 .....@a.f}>..E. 0x0010: 00a0 c276 4000 4006 f14a c0a8 02fd c0a8 ...v@.@..J...... 0x0020: 0249 0d05 ebf2 f1b6 6b1f 7cbe 578b 8018 .I......k.|.W... 0x0030: 00e3 8729 0000 0101 080a 0ff8 a5b0 03f8 ...)............ 0x0040: 5999 7b22 7061 7261 6d73 223a 205b 3332 Y.{"params":.[32 0x0050: 5d2c 2022 6964 223a 206e 756c 6c2c 2022 ],."id":.null,." 0x0060: 6d65 7468 6f64 223a 2022 6d69 6e69 6e67 method":."mining 0x0070: 2e73 6574 5f64 6966 6669 6375 6c74 7922 .set_difficulty" 0x0080: 7d0a 7b22 6572 726f 7222 3a20 6e75 6c6c }.{"error":.null 0x0090: 2c20 2269 6422 3a20 3731 3133 2c20 2272 ,."id":.7113,."r 0x00a0: 6573 756c 7422 3a20 7472 7565 7d0a esult":.true}. 16:24:14.865547 IP 192.168.2.73.60402 > 192.168.2.253.dec-notes: Flags [.], ack 1100, win 244, options [nop,nop,TS val 66607551 ecr 267953584], length 0 0x0000: 4061 8666 7d3e bcae c560 13e0 0800 4500 @a.f}>.......E. 0x0010: 0034 0f46 4000 4006 a4e7 c0a8 0249 c0a8 .4.F@.@......I.. 0x0020: 02fd ebf2 0d05 7cbe 578b f1b6 6b8b 8010 ......|.W...k... 0x0030: 00f4 b14e 0000 0101 080a 03f8 59bf 0ff8 ...N........Y... 0x0040: a5b0 .. 16:24:28.258492 IP 192.168.2.73.60402 > 192.168.2.253.dec-notes: Flags [P.], seq 183:292, ack 1100, win 244, options [nop,nop,TS val 66610899 ecr 267953584], length 109 0x0000: 4061 8666 7d3e bcae c560 13e0 0800 4500 @a.f}>.......E. 0x0010: 00a1 0f47 4000 4006 a479 c0a8 0249 c0a8 ...G@.@..y...I.. 0x0020: 02fd ebf2 0d05 7cbe 578b f1b6 6b8b 8018 ......|.W...k... 0x0030: 00f4 c7da 0000 0101 080a 03f8 66d3 0ff8 ............f... 0x0040: a5b0 7b22 7061 7261 6d73 223a 205b 2265 ..{"params":.["e 0x0050: 6e64 6961 6e30 312e 3122 2c20 2234 3365 ndian01.1",."43e 0x0060: 222c 2022 3031 3030 3030 3030 222c 2022 ",."01000000",." 0x0070: 3532 6465 6535 3733 222c 2022 3463 3464 52dee573",."4c4d 0x0080: 3062 3030 225d 2c20 2269 6422 3a20 3731 0b00"],."id":.71 0x0090: 3136 2c20 226d 6574 686f 6422 3a20 226d 16,."method":."m 0x00a0: 696e 696e 672e 7375 626d 6974 227d 0a ining.submit"}. 16:24:28.258543 IP 192.168.2.253.dec-notes > 192.168.2.73.60402: Flags [.], ack 292, win 227, options [nop,nop,TS val 267967017 ecr 66610899], length 0 0x0000: bcae c560 13e0 4061 8666 7d3e 0800 4500 .....@a.f}>..E. 0x0010: 0034 c277 4000 4006 f1b5 c0a8 02fd c0a8 .4.w@.@......... 0x0020: 0249 0d05 ebf2 f1b6 6b8b 7cbe 57f8 8010 .I......k.|.W... 0x0030: 00e3 6f65 0000 0101 080a 0ff8 da29 03f8 ..oe.........).. 0x0040: 66d3 f. 16:24:28.367542 IP 192.168.2.253.dec-notes > 192.168.2.73.60402: Flags [P.], seq 1100:1144, ack 292, win 227, options [nop,nop,TS val 267967126 ecr 66610899], length 44 0x0000: bcae c560 13e0 4061 8666 7d3e 0800 4500 .....@a.f}>..E. 0x0010: 0060 c278 4000 4006 f188 c0a8 02fd c0a8 ..x@.@......... 0x0020: 0249 0d05 ebf2 f1b6 6b8b 7cbe 57f8 8018 .I......k.|.W... 0x0030: 00e3 86e9 0000 0101 080a 0ff8 da96 03f8 ................ 0x0040: 66d3 7b22 6572 726f 7222 3a20 6e75 6c6c f.{"error":.null 0x0050: 2c20 2269 6422 3a20 3731 3136 2c20 2272 ,."id":.7116,."r 0x0060: 6573 756c 7422 3a20 7472 7565 7d0a esult":.true}.

Regards.

slush0 commented 10 years ago

Reasoning why this branch is a wrong place for accepting such patch: https://github.com/slush0/stratum-mining-proxy/issues/43

p4u commented 10 years ago

Maybe this is not the best way to fix it but works (at least for me). So, in the time a better solution is applied to the original source I've added the patch to my fork: https://github.com/p4u/stratum-mining-proxy

Thank you both for your work!

liling commented 10 years ago

I checkout p4u's fork, the first rig works find, but another one with 4 card installed still 100% rejected

p4u commented 10 years ago

I think I experienced the same. With a single miner it works fine but with several, I get the error "Duplicate shared" all time.

derenma commented 10 years ago

Keep in mind that this quick-fix may cause issues with the way the jobs are tracked for multiple miners, or worst case, may cause miners to rehash the same block.

Please read my discussion with slush about the possible issues this may cause. I will shift over to your project Pau so that I can continue work, but all that really needs to be done is to ensure that a more robust extranonce1 is generated that cgminer 3.7.2 and later can process.

On Sun, Jan 26, 2014 at 8:39 AM, Pau notifications@github.com wrote:

I think I experienced the same. With a single miner it works fine but with several, I get the error "Duplicate shared" all time.

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-33316963 .

p4u commented 10 years ago

Ok, so that explains what I experienced. I cannot contribute deeply in the code but I can test. I'll follow your contributions.

RoostayFish commented 10 years ago

Would it be worth changing the extra nonce system in https://github.com/veox/sgminer ?

derenma commented 10 years ago

If the performance is on-par with cgminer, and it works with the newest versions of stratum, then it would (as slush has said) just to switch miners. cgminer 3.7.2 is getting dated, and their devs really don't want to fix the issues with their code.

On Mon, Jan 27, 2014 at 8:25 AM, RoostayFish notifications@github.comwrote:

Would it be worth changing the extra nonce system in https://github.com/veox/sgminer ?

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-33366870 .

RoostayFish commented 10 years ago

So far its just optimisations and removing unused SHA-256 code https://litecointalk.org/index.php?topic=13190.0

derenma commented 10 years ago

So far, that sgminer works great. I will see if I can track-down the changes that were implemented in the newer versions of cgminer that fixed the bugs against stratum.

On Mon, Jan 27, 2014 at 8:56 AM, RoostayFish notifications@github.comwrote:

So far its just optimisations and removing unused SHA-256 code https://litecointalk.org/index.php?topic=13190.0

— Reply to this email directly or view it on GitHubhttps://github.com/slush0/stratum-mining-proxy/issues/35#issuecomment-33369106 .