Giter VIP home page Giter VIP logo

stratum-mining-proxy's Introduction

!! Obsolete, not maintanied - DO NOT USE !! I keep this repository alive and open for study and historical purposes only. It is no longer actively maintained (although there may be other forks that are still maintained).

stratum-mining-proxy

Application providing bridge between old HTTP/getwork protocol and Stratum mining protocol as described here: http://mining.bitcoin.cz/stratum-mining.

Installation on Windows

  1. Download official Windows binaries (EXE) from https://mining.bitcoin.cz/media/download/mining_proxy.exe
  2. Open downloaded file. It will open console window. Using default settings, proxy connects to Slush's pool interface
  3. If you want to connect to another pool or change other proxy settings, type "mining_proxy.exe --help" in console window.

Installation on Linux - local hierarchy

  1. Download TGZ file from https://github.com/slush0/stratum-mining-proxy/tarball/master
  2. Unpack it by typing "tar xf slush0-stratum-mining_proxy*.tar.gz"
  3. Most likely you already have Python respectively OpenSSL installed on your system. Otherwise install it by "sudo apt-get install python-dev libssl-dev" (on Ubuntu and Debian).
  4. Type "sudo python setup.py install" in the unpacked directory.
  5. You can start the proxy by typing "./mining_proxy.py" in the terminal window. Using default settings, proxy connects to Slush's pool interface.
  6. If you want to connect to another pool or change other proxy settings, type "mining_proxy.py --help".

Packaging for Debian

  1. Install devscripts, debhelper, pbuilder.
  2. Download and unpack a tarball or clone this repository. Enter the unpacked/cloned direcotry.
  3. Type "debuild-pbuilder -b -uc -us". You will be asked your password for sudo command. If you're a sudoer, skip to the last step.
  4. If you're not a sudoer, an error will occur. Do `apt-get -f install' as root to correct the situation and call "debuild -b -uc -us".
  5. A .deb package will be generated in parent directory. Use it to install stratum-mining-proxy on a Debian compatible system.

Installation on Mac

  1. Download TGZ file from https://github.com/slush0/stratum-mining-proxy/tarball/master
  2. Unpack it by typing "tar xf slush0-stratum-mining-proxy*.tar.gz"
  3. On Mac OS X you already have Python installed on your system, but you lack the llvm-gcc-4.2 binary required to run the setup.py file, so:
  4. a) If you don't want to install Xcode, get gcc here: https://github.com/kennethreitz/osx-gcc-installer
  5. b) OR download Xcode (free) from the App Store, Open it up (it's in your applications folder) and go to preferences, to the downloads section and download/install the 'command line tools'. This will install llvm-gc-4.2.
  6. Type "sudo python setup.py install" in the unpacked directory from step 2.
  7. You can start the proxy by typing "./mining_proxy.py" in the terminal window. Using default settings, proxy connects to Slush's pool interface.
  8. If you want to connect to another pool or change other proxy settings, type "mining_proxy.py --help".

N.B. Once Apple releases Xcode 4.7 they will remove the optional install of gcc (they want you to use clang). When that happens you can either choose not to upgrade, or return to the aforementioned https://github.com/kennethreitz/osx-gcc-installer and download the specific gcc binary for your version of Mac OS.

Installation on Linux using Git

This is advanced option for experienced users, but give you the easiest way for updating the proxy.

  1. git clone git://github.com/slush0/stratum-mining-proxy.git
  2. cd stratum-mining-proxy
  3. sudo apt-get install python-dev # Development package of Python are necessary
  4. sudo python distribute_setup.py # This will upgrade setuptools package
  5. sudo python setup.py develop # This will install required dependencies (namely Twisted and Stratum libraries), but don't install the package into the system.
  6. You can start the proxy by typing "./mining_proxy.py" in the terminal window. Using default settings, proxy connects to Slush's pool interface.
  7. If you want to connect to another pool or change other proxy settings, type "./mining_proxy.py --help".
  8. If you want to update the proxy, type "git pull" in the package directory.

Installation with Docker

This works on any system with Docker (Linux/Mac/Windows) and doesn't need anything other than Git and Docker.

  1. git clone git://github.com/slush0/stratum-mining-proxy.git
  2. cd stratum-mining-proxy
  3. docker build -t stratum-mining-proxy .
  4. Run interactively: docker run --rm -p 8332:8332 -it stratum-mining-proxy [-o eu.stratum.slushpool.com -p 3333 ...]
  5. Run as a service: docker run -d --name stratum-mining-proxy --restart unless-stopped -p 8332:8332 stratum-mining-proxy [-o eu.stratum.slushpool.com -p 3333 ...]

Compiling midstate C extension

For some really big operations using getwork interface of this proxy, you'll find useful "midstatec" C extension, which significantly speeds up midstate calculations (yes, plain python implementation is so slow). For enabling this extension, just type "make" in midstatec directory. Proxy will auto-detect compiled extension on next startup.

Contact

This proxy is provided by Slush's mining pool at http://mining.bitcoin.cz. You can contact the author by email slush(at)satoshilabs.com.

Donation

This project helps thousands of miners to improve their mining experience and optimize bandwidth of large mining operations. Now it is listed on tip4commit service, so if you find this tool handy, feel free to throw few satoshis to the basket :-).

tip for next commit

stratum-mining-proxy's People

Contributors

admin-slush avatar bearggg avatar bitbandi avatar coreyralph avatar decherneyge avatar fredericjacobs avatar ilyasemenov avatar schultemarkus avatar shmuma avatar skralg avatar slush0 avatar verement avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stratum-mining-proxy's Issues

0.9.0

mining_proxy_0.9.0.exe โ€” Windows executable (EXE), version 0.9.0

Says "File was not found." trying to download. You might want to check it. Thanks.

Stack traces when disconnected from upstream server

Getting disconnected from the upstream server results in one of at least two different stack traces.

Here is one:

Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "twisted\internet\tcp.pyo", line 287, in connectionLost

File "stratum\protocol.pyo", line 321, in connectionLost

File "twisted\internet\defer.pyo", line 368, in callback

File "twisted\internet\defer.pyo", line 464, in _startRunCallbacks

--- ---
File "twisted\internet\defer.pyo", line 551, in _runCallbacks

File "mining_proxy.py", line 114, in on_disconnect

File "mining_libs\stratum_listener.pyo", line 44, in disconnect_all

Here is another:

2013-09-16 21:56:23,907 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'excepti
ons.AttributeError'>: 'NoneType' object has no attribute 'write'
twisted\internet\selectreactor.pyo:150:_doReadOrWrite
twisted\internet\tcp.pyo:203:doRead
twisted\internet\tcp.pyo:209:_dataReceived
stratum\protocol.pyo:185:dataReceived
--- ---
stratum\protocol.pyo:230:lineReceived
stratum\event_handler.pyo:7:_handle_event
mining_libs\client_service.pyo:79:handle_event
mining_libs\stratum_listener.pyo:28:on_new_difficulty
stratum\pubsub.pyo:54:emit
stratum\pubsub.pyo:160:emit
stratum\pubsub.pyo:66:emit_single
stratum\protocol.pyo:102:writeJsonRequest
stratum\protocol.pyo:83:transport_write
]
Traceback (most recent call last):
File "stratum\protocol.pyo", line 230, in lineReceived
File "stratum\event_handler.pyo", line 7, in _handle_event
File "mining_libs\client_service.pyo", line 79, in handle_event
File "mining_libs\stratum_listener.pyo", line 28, in on_new_difficulty
File "stratum\pubsub.pyo", line 54, in emit
File "stratum\pubsub.pyo", line 160, in emit
File "stratum\pubsub.pyo", line 66, in emit_single
File "stratum\protocol.pyo", line 102, in writeJsonRequest
File "stratum\protocol.pyo", line 83, in transport_write
AttributeError: 'NoneType' object has no attribute 'write'

Stratum Proxy on Pi

I am trying to run 2 instances of the mining proxy on a Pi. I have one instance working without issue, it's been running since version 0.8.3 without issue. I have about 9 rigs pointed at it.

Before I was running 2 instances on Windows 7 and all I had to do was change the --getwork-port so they would not step on each other. I could then have another 6 rigs running BAMT w/phoenix pointed at that 2nd proxy using port 8331, but without the --real-target and everything would work great. (I know I should run cgminer on the BAMT rigs, but they have been stable for months, and I don't want to touch the configs, only the pool info.)

So I am starting it pretty much the same way on the Pi, but I'm getting the following error message. Do I need to run it out of it's own directory? What am I missing? Thanks.

root@raspberrypi:/opt/miners/stratum# ./mining_proxy.py --getwork-port 8331 --host btcguild.com --port 9332
2012-10-16 21:30:59,651 INFO proxy jobs. # C extension for midstate not available. Using default implementation instead.
2012-10-16 21:30:59,953 INFO proxy mining_proxy.main # Stratum proxy version: 1.1.1
2012-10-16 21:30:59,956 INFO proxy mining_proxy.main # Trying to connect to Stratum pool at 50.31.149.59:10332
2012-10-16 21:31:00,041 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2012-10-16 21:31:00,045 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at 50.31.149.59:10332
2012-10-16 21:31:00,048 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/defer.py", line 368, in callback
self._startRunCallbacks(result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/defer.py", line 464, in _startRunCallbacks
self._runCallbacks()
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/defer.py", line 551, in _runCallbacks
current.result = callback(current.result, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/defer.py", line 1101, in gotResult
_inlineCallbacks(r, g, deferred)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/defer.py", line 1045, in _inlineCallbacks
result = g.send(result)
File "./mining_proxy.py", line 171, in main
reactor.listenTCP(args.stratum_port, SocketTransportFactory(debug=False, event_handler=ServiceEventHandler))
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/posixbase.py", line 476, in listenTCP
p.startListening()
File "/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py", line 969, in startListening
raise CannotListenError, (self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on any:3333: [Errno 98] Address already in use.
2012-10-16 21:31:00,165 INFO proxy client_service.handle_event # New job 9077 for prevhash c87c948b, clean_jobs=True
2012-10-16 21:31:00,186 INFO proxy client_service.handle_event # Setting new difficulty: 1

Exceptions thrown when client connects

Installed on to raspberry-pi. No issues there. Running it, however, many issues running it.

Client shows this upon enabling connections to proxy:

0: Disabled Dead  Quota 1 Pool 1: stratum+tcp://rpi.local:3333  User:utdrmac.asuras
1: Enabled  Strtm Quota 1 Pool 0: stratum+tcp://stratum.bitcoin.cz:3333  User:utdrmac.asuras

Current pool management strategy: Failover
[F]ailover only disabled
Pool [A]dd [R]emove [D]isable [E]nable [P]rioritize [Q]uota change
[C]hange management strategy [S]witch pool [I]nformation
Or press any other key to continue
 [2014-01-21 22:33:55] pool 1 JSON stratum auth failed: [
   -3,
   "Method 'get_transactions' not found for service 'mining'",
   "Traceback: <class 'stratum.custom_exceptions.MethodNotFoundException'>: Method 'get_transactions'
 not found for service 'mining'\n/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-ar
mv6l.egg/twisted/internet/posixbase.py:614:_doReadOrWrite\n/usr/local/lib/python2.7/dist-packages/Twi
sted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:215:doRead\n/usr/local/lib/python2.7/dist-
packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:221:_dataReceived\n/usr/local/
lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived\n--- <excep
tion caught here> ---\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protoc
ol.py:230:lineReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/servi
ces.py:13:_handle_event\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/serv
ices.py:75:call\n"
]```


And mining_proxy showed this:

```root@rpi:~/stratum-mining-proxy# ./mining_proxy.py
/usr/local/lib/python2.7/dist-packages/zope.interface-4.0.5-py2.7-linux-armv6l.egg/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-armv6l.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-21 22:33:42,151 INFO proxy jobs.<module> # Using C extension for midstate speedup. Good!
2014-01-21 22:33:42,173 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2
2014-01-21 22:33:42,221 WARNING proxy mining_proxy.test_update # Checking for updates...
2014-01-21 22:33:42,526 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.bitcoin.cz:3333
2014-01-21 22:33:42,834 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-21 22:33:42,838 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.bitcoin.cz:3333
2014-01-21 22:33:42,841 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2014-01-21 22:33:43,060 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2014-01-21 22:33:43,063 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork)
2014-01-21 22:33:43,066 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2014-01-21 22:33:43,072 INFO proxy client_service.handle_event # Setting new difficulty: 3
2014-01-21 22:33:43,078 INFO proxy client_service.handle_event # New job 3c54 for prevhash 45aca989, clean_jobs=True
2014-01-21 22:33:55,731 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2014-01-21 22:33:57,264 INFO proxy client_service.handle_event # New job 3c55 for prevhash 45aca989, clean_jobs=False
2014-01-21 22:34:25,940 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-21 22:34:27,086 INFO proxy client_service.handle_event # Setting new difficulty: 1
2014-01-21 22:34:27,091 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'write'
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:215:doRead
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:221:_dataReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py:7:_handle_event
/root/stratum-mining-proxy/mining_libs/client_service.py:79:handle_event
/root/stratum-mining-proxy/mining_libs/stratum_listener.py:36:on_new_difficulty
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:54:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:160:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:66:emit_single
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:102:writeJsonRequest
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:83:transport_write
]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 230, in lineReceived
    result = self.event_handler._handle_event(msg_method, msg_params, connection_ref=self)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py", line 7, in _handle_event
    return defer.maybeDeferred(wrap_result_object, self.handle_event(msg_method, msg_params, connection_ref))
  File "/root/stratum-mining-proxy/mining_libs/client_service.py", line 79, in handle_event
    stratum_listener.DifficultySubscription.on_new_difficulty(difficulty)
  File "/root/stratum-mining-proxy/mining_libs/stratum_listener.py", line 36, in on_new_difficulty
    cls.emit(new_difficulty)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 54, in emit
    return Pubsub.emit(cls.event, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 160, in emit
    subscription.emit_single(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 66, in emit_single
    conn.writeJsonRequest(self.event, payload, is_notification=True)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 102, in writeJsonRequest
    self.transport_write("%s\n" % serialized)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 83, in transport_write
    self.transport.write(data)
AttributeError: 'NoneType' object has no attribute 'write'
2014-01-21 22:34:27,112 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'write'
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:215:doRead
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:221:_dataReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py:7:_handle_event
/root/stratum-mining-proxy/mining_libs/client_service.py:64:handle_event
/root/stratum-mining-proxy/mining_libs/stratum_listener.py:59:on_template
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:54:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:160:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:66:emit_single
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:102:writeJsonRequest
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:83:transport_write
]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 230, in lineReceived
    result = self.event_handler._handle_event(msg_method, msg_params, connection_ref=self)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py", line 7, in _handle_event
    return defer.maybeDeferred(wrap_result_object, self.handle_event(msg_method, msg_params, connection_ref))
  File "/root/stratum-mining-proxy/mining_libs/client_service.py", line 64, in handle_event
    job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
  File "/root/stratum-mining-proxy/mining_libs/stratum_listener.py", line 59, in on_template
    cls.emit(job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 54, in emit
    return Pubsub.emit(cls.event, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 160, in emit
    subscription.emit_single(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 66, in emit_single
    conn.writeJsonRequest(self.event, payload, is_notification=True)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 102, in writeJsonRequest
    self.transport_write("%s\n" % serialized)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 83, in transport_write
    self.transport.write(data)
AttributeError: 'NoneType' object has no attribute 'write'
2014-01-21 22:34:27,128 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'write'
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:215:doRead
/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-armv6l.egg/twisted/internet/tcp.py:221:_dataReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py:7:_handle_event
/root/stratum-mining-proxy/mining_libs/client_service.py:64:handle_event
/root/stratum-mining-proxy/mining_libs/stratum_listener.py:59:on_template
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:54:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:160:emit
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:66:emit_single
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:102:writeJsonRequest
/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:83:transport_write
]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 230, in lineReceived
    result = self.event_handler._handle_event(msg_method, msg_params, connection_ref=self)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py", line 7, in _handle_event
    return defer.maybeDeferred(wrap_result_object, self.handle_event(msg_method, msg_params, connection_ref))
  File "/root/stratum-mining-proxy/mining_libs/client_service.py", line 64, in handle_event
    job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
  File "/root/stratum-mining-proxy/mining_libs/stratum_listener.py", line 59, in on_template
    cls.emit(job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 54, in emit
    return Pubsub.emit(cls.event, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 160, in emit
    subscription.emit_single(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 66, in emit_single
    conn.writeJsonRequest(self.event, payload, is_notification=True)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 102, in writeJsonRequest
    self.transport_write("%s\n" % serialized)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 83, in transport_write
    self.transport.write(data)
AttributeError: 'NoneType' object has no attribute 'write'
2014-01-21 22:34:30,840 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
^C2014-01-21 22:34:31,062 INFO proxy mining_proxy.on_shutdown # Shutting down proxy...
2014-01-21 22:34:31,080 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-21 22:34:31,086 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.bitcoin.cz:3333
2014-01-21 22:34:31,090 INFO stats stats.print_stats # 0 peers connected, state changed 1 times

Record in mysql.

Is it possible to record information on production in mysql, work has been accepted or not, and technical information? How to do it? It is advisable not once, but several batches of transactions.
Help us to please.

Exception on reconnect to pool

2014-01-31 14:24:34,751 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2014-01-31 14:24:34,751 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork)
2014-01-31 14:24:34,751 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2014-01-31 14:24:34,752 INFO proxy client_service.handle_event # Setting new difficulty: 2
2014-01-31 14:24:34,752 INFO proxy client_service.handle_event # New job 479038 for prevhash cbe45727, clean_jobs=False
2014-01-31 14:25:12,877 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.btcguild.com:3333
2014-01-31 14:25:12,877 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
2014-01-31 14:25:15,660 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-31 14:25:15,660 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.btcguild.com:3333
2014-01-31 14:25:15,660 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2014-01-31 14:25:15,785 INFO proxy client_service.handle_event # Setting new difficulty: 2
2014-01-31 14:25:15,786 INFO proxy client_service.handle_event # New job 479090 for prevhash cbe45727, clean_jobs=False
2014-01-31 14:26:12,996 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.btcguild.com:3333
2014-01-31 14:26:12,996 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
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/server.py", line 189, in process
self.render(resrc)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 238, in render
body = resrc.render(self)
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 "/home/xeenon/stratum-mining-proxy/mining_libs/getwork_listener.py", line 165, in render_POST
d = defer.maybeDeferred(self.workers.authorize, worker_name, password)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 139, in maybeDeferred
result = f(_args, *_kw)
File "/home/xeenon/stratum-mining-proxy/mining_libs/worker_registry.py", line 37, in authorize
d = self.f.rpc('mining.authorize', [worker_name, password])
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/socket_transport.py", line 93, in rpc
raise custom_exceptions.TransportException("Not connected")
stratum.custom_exceptions.TransportException: Not connected
2014-01-31 14:26:15,585 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-31 14:26:15,585 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.btcguild.com:3333
2014-01-31 14:26:15,586 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2014-01-31 14:26:15,711 INFO proxy client_service.handle_event # Setting new difficulty: 2
2014-01-31 14:26:15,711 INFO proxy client_service.handle_event # New job 479117 for prevhash cbe45727, clean_jobs=False
2014-01-31 14:26:16,768 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:16,772 INFO proxy client_service.handle_event # Setting new difficulty: 8
2014-01-31 14:26:16,773 INFO proxy client_service.handle_event # New job 479118 for prevhash cbe45727, clean_jobs=True
2014-01-31 14:26:16,833 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:16,881 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:16,896 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:16,957 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,010 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,020 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,069 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,117 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,168 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,216 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,267 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,314 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,365 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,413 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,493 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,564 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,651 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,715 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,789 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,842 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,852 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,901 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:17,978 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,056 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,126 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,198 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,250 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,300 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,348 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,399 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,447 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,504 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,586 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,615 INFO proxy jobs.submit # Submitting 393336df
2014-01-31 14:26:18,616 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:18,669 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,715 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,765 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,811 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,861 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,907 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:18,957 INFO proxy getwork_listener._on_authorized # Worker 'worker_name' asks for new work
2014-01-31 14:26:19,101 INFO proxy jobs.submit # Submitting 6a8a4381
2014-01-31 14:26:19,102 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:19,408 INFO proxy jobs.submit # Submitting 91858bb5
2014-01-31 14:26:19,409 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:19,610 INFO proxy jobs.submit # Submitting 09c6a0b1
2014-01-31 14:26:19,610 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:20,601 INFO proxy jobs.submit # Submitting 2932b076
2014-01-31 14:26:20,602 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:22,563 INFO proxy jobs.submit # Submitting 79624bfd
2014-01-31 14:26:22,564 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:22,939 INFO proxy jobs.submit # Submitting 85636ef0
2014-01-31 14:26:22,940 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:23,392 INFO proxy jobs.submit # Submitting 1fd5d27f
2014-01-31 14:26:23,393 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:23,402 INFO proxy jobs.submit # Submitting 8fb2a9f2
2014-01-31 14:26:23,403 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:23,604 INFO proxy jobs.submit # Submitting 504c5b26
2014-01-31 14:26:23,604 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:24,349 INFO proxy jobs.submit # Submitting 62024d81
2014-01-31 14:26:24,350 WARNING proxy getwork_listener._on_submit # [0ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:24,539 INFO proxy jobs.submit # Submitting fe13c8be
2014-01-31 14:26:24,663 WARNING proxy getwork_listener._on_submit # [123ms] Share from 'worker_name' accepted, diff 8
2014-01-31 14:26:24,664 INFO proxy client_service.handle_event # Server asked us to reconnect to stratum-lb-usa48.btcguild.com:3333
2014-01-31 14:26:24,665 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.btcguild.com:3333
2014-01-31 14:26:24,666 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
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/server.py", line 189, in process
self.render(resrc)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 238, in render
body = resrc.render(self)
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 "/home/xeenon/stratum-mining-proxy/mining_libs/getwork_listener.py", line 165, in render_POST
d = defer.maybeDeferred(self.workers.authorize, worker_name, password)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 139, in maybeDeferred
result = f(_args, *_kw)
File "/home/xeenon/stratum-mining-proxy/mining_libs/worker_registry.py", line 37, in authorize
d = self.f.rpc('mining.authorize', [worker_name, password])
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/socket_transport.py", line 93, in rpc
raise custom_exceptions.TransportException("Not connected")
stratum.custom_exceptions.TransportException: Not connected
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/server.py", line 189, in process
self.render(resrc)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 238, in render
body = resrc.render(self)
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 "/home/xeenon/stratum-mining-proxy/mining_libs/getwork_listener.py", line 165, in render_POST
d = defer.maybeDeferred(self.workers.authorize, worker_name, password)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 139, in maybeDeferred
result = f(_args, *_kw)
File "/home/xeenon/stratum-mining-proxy/mining_libs/worker_registry.py", line 37, in authorize
d = self.f.rpc('mining.authorize', [worker_name, password])
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/socket_transport.py", line 93, in rpc
raise custom_exceptions.TransportException("Not connected")
stratum.custom_exceptions.TransportException: Not connected

Fix the output

Hello,

Can you fix on the output:
Clean and online disconnection.
Arg to hide/show the connection/disconnection to have cleaner log.

Cheer,

getwork_listener._on_submit_failure

After 1-5 min have this issue:

2012-12-24 07:30:55,834 INFO proxy jobs. # C extension for midstate not available. Using default implementation instead.
2012-12-24 07:30:55,835 WARNING proxy mining_proxy.main # Stratum proxy version: 1.3.0
2012-12-24 07:30:55,835 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.bitcoin.cz:3333
2012-12-24 07:30:55,887 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2012-12-24 07:30:55,887 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.bitcoin.cz:3333
2012-12-24 07:30:55,887 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2012-12-24 07:30:55,939 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-24 07:30:55,939 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 8332 (getwork)
2012-12-24 07:30:55,939 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-24 07:30:55,939 INFO proxy client_service.handle_event # New job 15bc for prevhash 9611e206, clean_jobs=True
2012-12-24 07:30:56,693 INFO proxy client_service.handle_event # New job 15bd for prevhash 9611e206, clean_jobs=False
2012-12-24 07:30:56,705 INFO proxy getwork_listener._on_authorized # Worker 'aslok.3r' asks for new work
2012-12-24 07:30:56,716 WARNING proxy getwork_listener.render_POST # Worker 'aslok.3r' subscribed for LP
2012-12-24 07:30:56,756 INFO proxy getwork_listener._on_authorized # Worker 'aslok.3r' asks for new work
2012-12-24 07:31:26,699 INFO proxy client_service.handle_event # New job 15be for prevhash 9611e206, clean_jobs=False
2012-12-24 07:31:55,755 INFO proxy getwork_listener._on_authorized # Worker 'aslok.3r' asks for new work
2012-12-24 07:31:55,768 INFO proxy getwork_listener._on_authorized # Worker 'aslok.3r' asks for new work
2012-12-24 07:31:56,710 INFO proxy client_service.handle_event # New job 15bf for prevhash 9611e206, clean_jobs=False
2012-12-24 07:32:26,733 INFO proxy client_service.handle_event # New job 15c0 for prevhash 9611e206, clean_jobs=False
2012-12-24 07:32:29,490 INFO proxy client_service.handle_event # New job 15c1 for prevhash 2f7da851, clean_jobs=True
2012-12-24 07:32:29,490 INFO proxy getwork_listener._on_lp_broadcast # LP broadcast for worker 'aslok.3r'
2012-12-24 07:32:29,505 INFO proxy getwork_listener._on_authorized # Worker 'aslok.3r' asks for new work
2012-12-24 07:32:29,748 WARNING proxy getwork_listener.render_POST # Worker 'aslok.3r' subscribed for LP
2012-12-24 07:32:31,085 INFO proxy client_service.handle_event # New job 15c2 for prevhash 2f7da851, clean_jobs=False
2012-12-24 07:32:39,778 INFO proxy jobs.submit # Submitting 57cf93c9
2012-12-24 07:32:39,893 WARNING proxy getwork_listener._on_submit # [114ms] Share from 'aslok.3r' accepted, diff 1
2012-12-24 07:32:39,900 INFO proxy jobs.submit # Submitting 57cf93c9
2012-12-24 07:32:39,954 WARNING proxy getwork_listener._on_submit_failure # [53ms] Share from 'aslok.3r' REJECTED: (-2, u'Duplicate share', None)
2012-12-24 07:32:39,957 INFO proxy jobs.submit # Submitting 57cf93c9
2012-12-24 07:32:40,008 WARNING proxy getwork_listener._on_submit_failure # [50ms] Share from 'aslok.3r' REJECTED: (-2, u'Duplicate share', None)
2012-12-24 07:32:40,011 INFO proxy jobs.submit # Submitting 57cf93c9
2012-12-24 07:32:40,063 WARNING proxy getwork_listener._on_submit_failure # [50ms] Share from 'aslok.3r' REJECTED: (-2, u'Duplicate share', None)
2012-12-24 07:32:40,066 INFO proxy jobs.submit # Submitting 57cf93c9
2012-12-24 07:32:40,118 WARNING proxy getwork_listener._on_submit_failure # [51ms] Share from 'aslok.3r' REJECTED: (-2, u'Duplicate share', None)

This message have in loop :(

Do u need samething more from me to know issue?

twisted.internet.error.CannotListenError

2013-06-03 11:28:32,629 WARNING proxy # Trying to connect to Stratum pool at stratum.bitcoin.cz:3333
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 380, in callback
    self._startRunCallbacks(result)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 488, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 575, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 1126, in gotResult
    _inlineCallbacks(r, g, deferred)
---  ---
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 1070, in _inlineCallbacks
    result = g.send(result)
  File "./mining_proxy.py", line 255, in main
    reactor.listenMulticast(3333, multicast_responder.MulticastResponder((args.host, args.port), args.stratum_port, args.getwork_port), listenMultiple=True)
  File "/usr/lib64/python2.7/site-packages/twisted/internet/posixbase.py", line 387, in listenMulticast
    p.startListening()
  File "/usr/lib64/python2.7/site-packages/twisted/internet/udp.py", line 103, in startListening
    self._bindSocket()
  File "/usr/lib64/python2.7/site-packages/twisted/internet/udp.py", line 111, in _bindSocket
    raise error.CannotListenError(self.interface, self.port, le)

not working on p2pool ltc


python mining_proxy.py --pow-algo scrypt --host 127.0.0.1 --port 9327 --stratum-port 3333 --getwork-port 9999 --no-midstate --real-target --custom-user pool --custom-password x --verbose
2013-07-31 21:44:08,350 DEBUG stats logger.get_logger # Logging initialized
2013-07-31 21:44:08,360 DEBUG protocol logger.get_logger # Logging initialized
2013-07-31 21:44:08,360 DEBUG socket_transport logger.get_logger # Logging initialized
2013-07-31 21:44:08,415 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,415 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,433 WARNING proxy jobs. # C extension for midstate not available. Using default implementation instead.
2013-07-31 21:44:08,433 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,434 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,435 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,435 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,436 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,436 DEBUG proxy logger.get_logger # Logging initialized
2013-07-31 21:44:08,438 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
File "mining_proxy.py", line 155, in main
new_host = (yield utils.detect_stratum(args.host, args.port))
AttributeError: 'module' object has no attribute '_parse'
2013-07-31 21:44:08,439 INFO proxy mining_proxy.main # Stratum proxy version: 1.3.0
2013-07-31 21:44:08,439 INFO proxy mining_proxy.main # Trying to connect to Stratum pool at 127.0.0.1:9327
2013-07-31 21:44:08,440 INFO proxy mining_proxy.main # Setting PoW algo: scrypt
2013-07-31 21:44:08,441 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-07-31 21:44:08,441 DEBUG protocol protocol.connectionMade # Connected 127.0.0.1
2013-07-31 21:44:08,441 DEBUG protocol protocol.connectionMade # Resuming connection: []
2013-07-31 21:44:08,441 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at 127.0.0.1:9327
2013-07-31 21:44:08,441 INFO proxy mining_proxy.on_connect # Authorizing custom user pool, password x
2013-07-31 21:44:08,442 DEBUG protocol protocol.writeJsonRequest # < {"params": ["pool", "x"], "id": 1, "method": "mining.authorize"}
2013-07-31 21:44:08,442 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2013-07-31 21:44:08,442 DEBUG protocol protocol.writeJsonRequest # < {"params": [], "id": 2, "method": "mining.subscribe"}
2013-07-31 21:44:08,461 DEBUG protocol protocol.lineReceived # > {u'result': None, u'jsonrpc': u'2.0', u'id': 1, u'error': None}
2013-07-31 21:44:08,461 DEBUG protocol protocol.lineReceived # > {u'result': [[u'mining.notify', u'ae6812eb4cd7735a302a8a9dd95cf71f'], u'', 2], u'jsonrpc': u'2.0', u'id': 2, u'error': None}
2013-07-31 21:44:08,464 INFO proxy mining_proxy.main # -----------------------------------------------------------------------
2013-07-31 21:44:08,464 INFO proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 9999 (getwork)
2013-07-31 21:44:08,464 INFO proxy mining_proxy.main # -----------------------------------------------------------------------
2013-07-31 21:44:08,465 DEBUG protocol protocol.lineReceived # > {u'jsonrpc': u'2.0', u'params': [14.52613027417101], u'method': u'mining.set_difficulty', u'id': 940918514}
2013-07-31 21:44:08,465 INFO proxy client_service.handle_event # Setting new difficulty: 14.5261302742
2013-07-31 21:44:08,465 DEBUG protocol protocol.writeJsonResponse # < {"error": null, "id": 940918514, "result": null}
/usr/lib/python2.6/site-packages/stratum-0.2.13-py2.6.egg/stratum/protocol.py:201: DeprecationWarning: Returning a value other than None from stratum.protocol.ClientProtocol.dataReceived is deprecated since Twisted 11.0.0.
return self.lineLengthExceeded(self._buffer)
2013-07-31 21:44:08,489 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at 127.0.0.1:9327
2013-07-31 21:44:08,489 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
2013-07-31 21:44:08,489 DEBUG socket_transport socket_transport.clientConnectionLost # [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion.
]
2013-07-31 21:44:11,332 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-07-31 21:44:11,332 DEBUG protocol protocol.connectionMade # Connected 127.0.0.1
2013-07-31 21:44:11,332 DEBUG protocol protocol.connectionMade # Resuming connection: []
2013-07-31 21:44:11,332 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at 127.0.0.1:9327
2013-07-31 21:44:11,333 INFO proxy mining_proxy.on_connect # Authorizing custom user pool, password x
2013-07-31 21:44:11,333 DEBUG protocol protocol.writeJsonRequest # < {"params": ["pool", "x"], "id": 1, "method": "mining.authorize"}
2013-07-31 21:44:11,333 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2013-07-31 21:44:11,333 DEBUG protocol protocol.writeJsonRequest # < {"params": [], "id": 2, "method": "mining.subscribe"}
2013-07-31 21:44:11,337 DEBUG protocol protocol.lineReceived # > {u'result': None, u'jsonrpc': u'2.0', u'id': 1, u'error': None}
2013-07-31 21:44:11,338 DEBUG protocol protocol.lineReceived # > {u'result': [[u'mining.notify', u'ae6812eb4cd7735a302a8a9dd95cf71f'], u'', 2], u'jsonrpc': u'2.0', u'id': 2, u'error': None}
2013-07-31 21:44:11,338 DEBUG protocol protocol.lineReceived # > {u'jsonrpc': u'2.0', u'params': [14.52613027417101], u'method': u'mining.set_difficulty', u'id': 512789334}
2013-07-31 21:44:11,339 INFO proxy client_service.handle_event # Setting new difficulty: 14.5261302742
2013-07-31 21:44:11,339 DEBUG protocol protocol.writeJsonResponse # < {"error": null, "id": 512789334, "result": null}
2013-07-31 21:44:11,340 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at 127.0.0.1:9327
2013-07-31 21:44:11,340 INFO stats stats.print_stats # 0 peers connected, state changed 1 times

2013-07-31 21:44:11,340 DEBUG socket_transport socket_transport.clientConnectionLost # [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion.

Failure: stratum.custom_exceptions.TransportException: SocketTransportClientFactory connection timed out

After installing the script i get a connection problem to different pools. I tried the default (slush) and BTC Guild.

I get the following:
Trying to connect to Stratum pool at stratum.bitcoin.cz:3333
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
Failure: stratum.custom_exceptions.TransportException: SocketTransportClientFactory connection timed out

It is running on CentOS 6.

How can this be solved?

Silently ignore mining.get_transactions call from bfgminer

Neither slush's pool nor btcguild support this call. It causes bcgminer crashes when running proxy on RaspberryPi. This tiny patch logs requests to debug. Someone with more Python experience than me may be able to return something more valid like an empty array.

--- a/mining_libs/stratum_listener.py
+++ b/mining_libs/stratum_listener.py
@@ -181,3 +181,7 @@ class StratumProxyService(GenericService):
         response_time = (time.time() - start) * 1000
         log.info("[%dms] Share from '%s' accepted, diff %d" % (response_time, worker_name, DifficultySubscription.difficulty))
         defer.returnValue(result)
+
+    @classmethod
+    def get_transactions(self, *args):
+        log.debug("'mining.get_transactions' call not supported by proxy.")

ERROR template_registry

Hi, i have problem with stratum-mining

2013-07-02 13:08:37+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:38,174 INFO template_registry # target_info: 17668201048317171789435028337278314961968102597311964175491250976823
2013-07-02 13:08:38,174 INFO template_registry # hash_int: 7828964347598659544576338303256361750942983294788636737368951610161891
2013-07-02 13:08:38,174 INFO template_registry # job.target: 46824477683132239135561803058851965969788731792469148591448018386944
2013-07-02 13:08:39+0200 [-] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39,097 INFO block_updater # New block! Prevhash: 000000013c8ec61561e6d307395909d475306657f17fba750cf845e2fa06a568
2013-07-02 13:08:39+0200 [HTTPPageGetter,client] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39,099 ERROR template_registry # [Failure instance: Traceback: <class 'struct.error'>: unpack requires a string argument of length 4
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1126:gotResult
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1113:_inlineCallbacks
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:380:callback
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:488:_startRunCallbacks
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:575:_runCallbacks
/home/miner/bin/pools/lib/template_registry.py:130:_update_block
/home/miner/bin/pools/lib/block_template.py:64:fill_from_rpc
/home/miner/bin/pools/lib/halfnode.py:141:deserialize
/home/miner/bin/pools/lib/util.py:71:deser_vector
/home/miner/bin/pools/lib/halfnode.py:107:deserialize
]
2013-07-02 13:19:00+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:19:01,640 INFO template_registry # target_info: 17668201048317171789435028337278314961968102597311964175491250976823
2013-07-02 13:19:01,640 INFO template_registry # hash_int: 26931581362785944347414155924451665936093937277250586439267436797026
2013-07-02 13:19:01,640 INFO template_registry # job.target: 48025696009976719546334930562118831838426128974381661891692502974464
2013-07-02 13:19:01,640 INFO template_registry # We found a block candidate! 00000000ffbb0c3a4e54a9e19125996c7b1471b91c1f41af3f09267a05b11c62
2013-07-02 13:19:01+0200 [Protocol,1,159.205.49.59] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:19:01,641 INFO interfaces # 00000000ffbb0c3a4e54a9e19125996c7b1471b91c1f41af3f09267a05b11c62 valid rocker
2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Unhandled error in Deferred:
2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Unhandled Error
        Traceback (most recent call last):
        Failure: twisted.web.error.Error: 500 Internal Server Error

2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>

Thanks for help

few questions

sorry didn't find answers anywhere else.

  1. I can't find -pa option In latest build. In previous releases I used "-pa scrypt" in order to mine coins on scrypt pools. Is this option crucial for successful mining or there is no need for it anymore?

my proxy config: mining_proxy -o poolURL -p poolPort (no -pa scrypt available :( )
my miner config: cgminer -o http://proxyURL:8332 -u user.worker -p pass

P.S.: should I add "--scrypt" to my miner config? (cgminer)

  1. May be because of the issues above I face this problem: when I connect to pool through stratum proxy no stats are displayed. Worker status is inactive. (if i connect directly to pool, stats are showing fine)

  2. Did you increase maximum peers in latest release? What is maximum amount for now? (didn't find any kind of changelog, sorry)

Setting New Difficulty Every Share! (Same One)

The stratum proxy protocol sets new difficulty every share (Same)

It looks like this

Setting New Difficulty: 32
Share Accepted
Setting New Difficulty: 32
Share Accepted

I know it can be a pool problem but adding some small check to stratum_listener.py inside class DifficultySubscription(Subscription): to compare the difficulty if the same don't have to set the difficulty should fix this. I don't know programming I just was able to analyze the issue, Can anyone code this?

Strange targets being produced

I'm using pretty old miners, and that may be the cause, but if I connect directly to api.bitcoin.cz I get a target something like 00000000fffffffffff (etc) but if I connect via the proxy I get a target like 00000000ffff0000000000000.... etc.

I left one running overnight and despite running at around 88MH/s (yeah, I know, small fry) it found no matches. That's pretty unusual.

Am I doing something wrong? Do I need to do something to the proxy?

Let me know if there's any more information you need.

Getting "Unhandled error in Deferred:"

I am getting this in the logs after a certain amount of time. Does this have to do with the pool not responding or something else? I have been restarting the proxy and it works fine until it starts up again.


Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 192, in process
self.render(resrc)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 241, in render
body = resrc.render(self)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/resource.py", line 250, in render
return m(request)
File "/home/ubuntu/stratum-mining-proxy/mining_libs/getwork_listener.py", line 163, in render_POST
d = defer.maybeDeferred(self.workers.authorize, worker_name, password)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 137, in maybeDeferred
result = f(_args, *_kw)
File "/home/ubuntu/stratum-mining-proxy/mining_libs/worker_registry.py", line 37, in authorize
d = self.f.rpc('mining.authorize', [worker_name, password])
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/socket_transport.py", line 93, in rpc
raise custom_exceptions.TransportException("Not connected")
stratum.custom_exceptions.TransportException: Not connected

REJECTED at 100% with latest build.

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

mining_proxy.py not binding to IP when stratum host is used

Hi,

mining_proxy.py is not binding to IP when -sh (-sh STRATUM_HOST, --stratum-host STRATUM_HOST) options are used.

Fix:
line 257@stratum-mining-proxy/mining_proxy.py
replace:reactor.listenTCP(args.stratum_port, SocketTransportFactory(debug=False, event_handler=ServiceEventHandler))
with: reactor.listenTCP(args.stratum_port, SocketTransportFactory(debug=False, event_handler=ServiceEventHandler), interface=args.stratum_host)

Authorizing clients with custom user and password

Hello!

I use your proxy to connect 7 pc's in one miner, how can i set up your proxy to authorize all connected pc's and submit shares with only one user name and password?

I know -cu and -cp but this credentials used only for submitting shares but how can i use it to authorize clients with this user too no matter with which user client miners are started? (Clients connects with statum cgminer)

Thanks!

unhandled error

Hi, i am trying to make a proxy for all of my rigs, i am getting this error, any help?

2014-02-01 23:26:15,217 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
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/internet/defer.py", line 382, in callback
self._startRunCallbacks(result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 490, in _startRunCallbacks
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 "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 1155, in gotResult
_inlineCallbacks(r, g, deferred)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 1099, in _inlineCallbacks
result = g.send(result)
File "./mining_proxy.py", line 243, in main
interface=args.getwork_host)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 495, in listenTCP
p.startListening()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 980, in startListening
raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on 0.0.0.0:8332: [Errno 98] Address already in use.
2014-02-01 23:26:15,579 INFO proxy client_service.handle_event # Setting new difficulty: 1024

exception handling

can you add a way test if there repeated errors and a way to launch a script when ./mining_proxy.py ends up in limbo?

i was unable to check my system for a week and found the following error repeating the whole time i was away: http://pastebin.com/GAC9kASD

Error processing message failed

--grammar edits--

Errors when mining with ASIC blade

I stated getting errors like the one below a few days ago. Tried downloading and running proxy again without change. I then tried installing it on a Ubuntu server instead of win 7/64 bit. Still getting the same errors

If i connect to my pool through GetWork the blade works (both through the proxy and the pool directly). I get it to pick up work using BFGMiner, but only around 90% efficiency. Also I prefer this proxy.

Any Help you can provide is appreciated!

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

this same item repeats several hundred times, my hashrate stays at 0 :(

2013-12-13 14:03:29,135 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-13 14:03:29,165 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2013-12-13 14:03:29,180 INFO stats stats.print_stats # 3 peers connected, state changed 1 times
2013-12-13 14:03:29,183 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 216, in lineReceived
raise custom_exceptions.ProtocolException("Cannot decode message '%s'" % line)
'rotocolException: Cannot decode message 'POST / HTTP/1.1
2013-12-13 14:03:29,184 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2013-12-13 14:03:29,199 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 216, in lineReceived
raise custom_exceptions.ProtocolException("Cannot decode message '%s'" % line)
'rotocolException: Cannot decode message 'POST / HTTP/1.1
2013-12-13 14:03:29,200 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-13 14:03:29,369 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2013-12-13 14:03:29,383 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 216, in lineReceived
raise custom_exceptions.ProtocolException("Cannot decode message '%s'" % line)
'rotocolException: Cannot decode message 'POST / HTTP/1.1
2013-12-13 14:03:29,384 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-13 14:03:29,428 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2013-12-13 14:03:29,432 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 216, in lineReceived
raise custom_exceptions.ProtocolException("Cannot decode message '%s'" % line)
'rotocolException: Cannot decode message 'POST / HTTP/1.1
2013-12-13 14:03:29,433 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-13 14:03:30,323 INFO stats stats.print_stats # 2 peers connected, state changed 1 times
2013-12-13 14:03:30,330 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 216, in lineReceived
raise custom_exceptions.ProtocolException("Cannot decode message '%s'" % line)
'rotocolException: Cannot decode message 'POST / HTTP/1.1
2013-12-13 14:03:30,330 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-13 14:03:36,333 INFO proxy client_service.handle_event # New job 46a3-cc for prevhash b51e8368, clean_jobs=False
2013-12-13 14:03:42,204 INFO proxy client_service.handle_event # New job 46a4-8a for prevhash b51e8368, clean_jobs=True

Not working on p2pool v10

log:

~/stratum-mining-proxy$ ./mining_proxy.py -o rav3n.dtdns.net -p 9332 -t -gp 9999 -v >> debug.log
2012-12-31 03:54:17,168 DEBUG stats logger.get_logger # Logging initialized
2012-12-31 03:54:17,178 DEBUG protocol logger.get_logger # Logging initialized
2012-12-31 03:54:17,179 DEBUG socket_transport logger.get_logger # Logging initialized
2012-12-31 03:54:17,222 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,222 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,224 INFO proxy jobs.<module> # Using C extension for midstate speedup. Good!
2012-12-31 03:54:17,224 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,225 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,225 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,226 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,226 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,226 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:17,275 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
  File "./mining_proxy.py", line 154, in main
    new_host = (yield utils.detect_stratum(args.host, args.port))
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1045, in _inlineCallbacks
    result = g.send(result)
  File "/home/rav3n/stratum-mining-proxy/mining_libs/utils.py", line 69, in detect_stratum
    header = f.response_headers.get('x-stratum', None)[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
2012-12-31 03:54:17,276 WARNING proxy mining_proxy.main # Stratum proxy version: 1.3.0
2012-12-31 03:54:17,276 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:17,282 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2012-12-31 03:54:17,283 DEBUG protocol protocol.connectionMade # Connected 91.235.254.37
2012-12-31 03:54:17,283 DEBUG protocol protocol.connectionMade # Resuming connection: []
2012-12-31 03:54:17,283 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:17,284 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2012-12-31 03:54:17,284 DEBUG protocol protocol.writeJsonRequest # < {"params": [], "id": 1, "method": "mining.subscribe"}
2012-12-31 03:54:17,288 DEBUG protocol protocol.lineReceived # > {u'result': [[u'mining.notify', u'ae6812eb4cd7735a302a8a9dd95cf71f'], u'', 4], u'jsonrpc': u'2.0', u'id': 1, u'error': None}
2012-12-31 03:54:17,292 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-31 03:54:17,293 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 9999 (getwork)
2012-12-31 03:54:17,293 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-31 03:54:18,289 INFO proxy mining_proxy.run_test # Running performance self-test...
2012-12-31 03:54:18,289 INFO proxy mining_proxy.run_test # Generating with midstate: True
2012-12-31 03:54:18,289 INFO proxy mining_proxy.run_test # Example getwork:
Unhandled Error
Traceback (most recent call last):
  File "./mining_proxy.py", line 233, in <module>
    reactor.run()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1169, in run
    self.mainLoop()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1178, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 800, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "./mining_proxy.py", line 125, in run_test
    log.info(job_registry.getwork(no_midstate=not m))
  File "/home/rav3n/stratum-mining-proxy/mining_libs/jobs.py", line 176, in getwork
    extranonce2 = job.increase_extranonce2()
exceptions.AttributeError: 'NoneType' object has no attribute 'increase_extranonce2'
^C2012-12-31 03:54:20,412 INFO proxy mining_proxy.on_shutdown # Shutting down proxy...
2012-12-31 03:54:20,413 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:20,413 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
rav3n@rav3n:~/stratum-mining-proxy$ ./mining_proxy.py -o rav3n.dtdns.net -p 9332 -t -gp 9999 -v
2012-12-31 03:54:47,541 DEBUG stats logger.get_logger # Logging initialized
2012-12-31 03:54:47,551 DEBUG protocol logger.get_logger # Logging initialized
2012-12-31 03:54:47,552 DEBUG socket_transport logger.get_logger # Logging initialized
2012-12-31 03:54:47,596 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,596 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,598 INFO proxy jobs.<module> # Using C extension for midstate speedup. Good!
2012-12-31 03:54:47,598 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,599 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,600 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,600 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,601 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,602 DEBUG proxy logger.get_logger # Logging initialized
2012-12-31 03:54:47,825 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
  File "./mining_proxy.py", line 154, in main
    new_host = (yield utils.detect_stratum(args.host, args.port))
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1045, in _inlineCallbacks
    result = g.send(result)
  File "/home/rav3n/stratum-mining-proxy/mining_libs/utils.py", line 69, in detect_stratum
    header = f.response_headers.get('x-stratum', None)[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
2012-12-31 03:54:47,826 WARNING proxy mining_proxy.main # Stratum proxy version: 1.3.0
2012-12-31 03:54:47,826 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:47,832 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2012-12-31 03:54:47,832 DEBUG protocol protocol.connectionMade # Connected 91.235.254.37
2012-12-31 03:54:47,832 DEBUG protocol protocol.connectionMade # Resuming connection: []
2012-12-31 03:54:47,833 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:47,833 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2012-12-31 03:54:47,833 DEBUG protocol protocol.writeJsonRequest # < {"params": [], "id": 1, "method": "mining.subscribe"}
2012-12-31 03:54:47,837 DEBUG protocol protocol.lineReceived # > {u'result': [[u'mining.notify', u'ae6812eb4cd7735a302a8a9dd95cf71f'], u'', 4], u'jsonrpc': u'2.0', u'id': 1, u'error': None}
2012-12-31 03:54:47,840 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-31 03:54:47,840 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 9999 (getwork)
2012-12-31 03:54:47,841 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2012-12-31 03:54:48,837 INFO proxy mining_proxy.run_test # Running performance self-test...
2012-12-31 03:54:48,837 INFO proxy mining_proxy.run_test # Generating with midstate: True
2012-12-31 03:54:48,837 INFO proxy mining_proxy.run_test # Example getwork:
Unhandled Error
Traceback (most recent call last):
  File "./mining_proxy.py", line 233, in <module>
    reactor.run()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1169, in run
    self.mainLoop()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1178, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 800, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "./mining_proxy.py", line 125, in run_test
    log.info(job_registry.getwork(no_midstate=not m))
  File "/home/rav3n/stratum-mining-proxy/mining_libs/jobs.py", line 176, in getwork
    extranonce2 = job.increase_extranonce2()
exceptions.AttributeError: 'NoneType' object has no attribute 'increase_extranonce2'
^C2012-12-31 03:54:52,129 INFO proxy mining_proxy.on_shutdown # Shutting down proxy...
2012-12-31 03:54:52,129 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at rav3n.dtdns.net:9332
2012-12-31 03:54:52,130 INFO stats stats.print_stats # 0 peers connected, state changed 1 times

clean_jobs=False STALL...?

Blade---proxy server --- Pool

every thing was working fine for 1 week and now the proxy is stalling and throws an error. I happed to catch one:

2013-12-07 01:16:36,536 INFO proxy jobs. # C extension for midstate not available. Using default implementation instead.
2013-12-07 01:16:36,537 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
File "/home/mathison/stratum-mining-proxy/mining_proxy.py", line 178, in main
new_host = (yield utils.detect_stratum(args.host, args.port))
AttributeError: 'module' object has no attribute '_parse'
2013-12-07 01:16:36,538 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2
2013-12-07 01:16:36,541 WARNING proxy mining_proxy.test_update # Checking for updates...
2013-12-07 01:16:36,687 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at stratum.triplemining.com:3334
2013-12-07 01:16:38,059 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2013-12-07 01:16:38,059 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at stratum.triplemining.com:3334
2013-12-07 01:16:38,060 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2013-12-07 01:16:38,260 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2013-12-07 01:16:38,260 WARNING proxy mining_proxy.main # PROXY IS LISTENING ON ALL IPs ON PORT 3333 (stratum) AND 5454 (getwork)
2013-12-07 01:16:38,260 WARNING proxy mining_proxy.main # -----------------------------------------------------------------------
2013-12-07 01:16:38,452 INFO proxy client_service.handle_event # Setting new difficulty: 1
2013-12-07 01:16:38,453 INFO proxy client_service.handle_event # New job 1386407793 21104 for prevhash 5a236900, clean_jobs=False
2013-12-07 01:17:28,764 INFO proxy client_service.handle_event # New job 1386407848 21105 for prevhash 5a236900, clean_jobs=False
2013-12-07 01:18:23,863 INFO proxy client_service.handle_event # New job 1386407903 21106 for prevhash 5a236900, clean_jobs=False
2013-12-07 01:18:42,850 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:42,912 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:42,978 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:43,044 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:43,111 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:43,176 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:43,242 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
2013-12-07 01:18:43,307 INFO proxy getwork_listener._on_authorized # Worker 'mato22_mato221' asks for new work
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 264, in lineReceived
meta['defer'].callback(msg_result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 382, in callback
self._startRunCallbacks(result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 490, in _startRunCallbacks
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 "/home/mathison/stratum-mining-proxy/mining_libs/getwork_listener.py", line 106, in _on_failure
request.finish()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 228, in finish
return http.Request.finish(self)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 929, in finish
"Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 264, in lineReceived
meta['defer'].callback(msg_result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 382, in callback
self._startRunCallbacks(result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 490, in _startRunCallbacks
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 "/home/mathison/stratum-mining-proxy/mining_libs/getwork_listener.py", line 106, in _on_failure
request.finish()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 228, in finish
return http.Request.finish(self)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 929, in finish
"Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 264, in lineReceived
meta['defer'].callback(msg_result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 382, in callback
self._startRunCallbacks(result)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 490, in _startRunCallbacks
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 "/home/mathison/stratum-mining-proxy/mining_libs/getwork_listener.py", line 106, in _on_failure
request.finish()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 228, in finish
return http.Request.finish(self)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 929, in finish
"Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.
^C2013-12-07 01:19:12,478 INFO proxy mining_proxy.on_shutdown # Shutting down proxy...
2013-12-07 01:19:12,480 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at stratum.triplemining.com:3334
2013-12-07 01:19:12,480 INFO stats stats.print_stats # 0 peers connected, state changed 1 times

Problem With Proxy & Bfgminer?

Setup proxy went fine on my Model B 512MB Raspberry Pi, runs fine and can mine to Slush's pool via the proxy running on it, but I regularly get this message in the proxy output:

2014-02-11 20:16:06,885 INFO proxy client_service.handle_event # New job 138db for prevhash a246d9bd, clean_jobs=False
2014-02-11 20:16:07,004 WARNING proxy stratum_listener.get_transactions # mining.get_transactions isn't supported by proxy

As soon as this appears in the proxy output, in Bfgminer I get this:

[2014-02-11 20:16:07] Stratum from pool 0 requested work update
[2014-02-11 20:16:07] Pool 0 is sending mismatched block contents to us (0 is not 512-1023)

The number range at the end varies.

If I mine with Bfgminer directly to the pool rather than via the proxy it doesn't show any errors regarding mismatched block contents.

Is this something wrong or an error not being handled correctly or something? Bit concerned I have done something wrong.

Thanks.

Running mining_proxy.py as nobody

I am trying to add my stratum proxy to my /etc/rc.local file so that the proxy loads on reboot.

I've used the described solution before, but it will not work correctly on the machine now that it's had the operating system re-installed.

/etc/rc.local
su - nobody -c '/usr/local/bin/mining_proxy.py -o stratum.btcguild.com -p 3333'

Running the command gives me the following error:

Traceback (most recent call last):
File "/usr/local/bin/mining_proxy.py", line 4, in
from pkg_resources import require; require('stratum-mining-proxy==1.5.2')
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2815, in
working_set.require(requires)
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 690, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: stratum-mining-proxy==1.5.2

Any ideas why this isn't working or any alternative methods of having mining_proxy.py start at boot as a non-root user?

Could running lots of proxy instances cause a problem?

Hey,

I'm trying to run approximately 1000 instances of the stratum proxy, sometimes there might be 50 or more proxy instances pointing to the same stratum server at the one time. I'm seeing lots of errors like this:

REJECTED: (-2, u"Job '6df' not found", None)

If I run a single proxy on the server its fine, but when I up the number I start to see these errors on virtually every share submitted.

Is there something special I need to change or is there a limit of how many stratum proxy instances can run at once?

Job Not Found

So I have been trying to use the proxy to connect multiple clients running cudaminer, cpuminer and cgminer so that I do not have to change configurations on each one if I need to change pool or currency. When I have one miner running through the proxy such as a getwork cpu miner it works beautifully. The problem I have is that as soon as I connect a second miner I start recieving mass amounts of REJECTED 'Job "xxxx" not found'. I get the job rejections no matter what two clients I have connected. I have tried using this with coinotron and Minar pools and the error is the same. any help would be great I really would love to use a centralized proxy for mining itll make handle my many clients much much easier.

C:\LTCminer>"C:\LTCminer\stratum_proxy.exe" -o phs.minar.cc -p 3338 -pa scrypt -
rt
C:\LTCminer\stratum_proxy.exe\twisted\web\util.py:372: DeprecationWarning: Passi
ng filenames or file objects to XMLFile is deprecated since Twisted 12.1. Pass
a FilePath instead.
2014-02-09 18:02:26,936 WARNING proxy jobs. # C extension for midstate n
ot available. Using default implementation instead.
2014-02-09 18:02:27,061 INFO proxy mining_proxy.main # Stratum proxy version: 1.
3.0
2014-02-09 18:02:27,061 INFO proxy mining_proxy.main # Trying to connect to Stra
tum pool at phs.minar.cc:3338
2014-02-09 18:02:27,061 INFO proxy mining_proxy.main # Setting PoW algo: scrypt
2014-02-09 18:02:27,108 INFO stats stats.print_stats # 1 peers connected, state
changed 1 times
2014-02-09 18:02:27,108 INFO proxy mining_proxy.on_connect # Connected to Stratu
m pool at phs.minar.cc:3338
2014-02-09 18:02:27,108 INFO proxy mining_proxy.on_connect # Subscribing for min
ing jobs

2014-02-09 18:02:27,170 INFO proxy mining_proxy.main # -------------------------

2014-02-09 18:02:27,170 INFO proxy mining_proxy.main # PROXY IS LISTENING ON ALL
IPs ON PORT 3333 (stratum) AND 8332 (getwork)

2014-02-09 18:02:27,170 INFO proxy mining_proxy.main # -------------------------

2014-02-09 18:02:27,170 INFO proxy client_service.handle_event # Setting new dif
ficulty: 32
2014-02-09 18:02:27,170 INFO proxy client_service.handle_event # New job 2b7d fo
r prevhash 1fd0ecaf, clean_jobs=True
2014-02-09 18:02:44,512 INFO proxy client_service.handle_event # New job 2b7e fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:03:16,428 INFO proxy client_service.handle_event # New job 2b7f fo
r prevhash 1fd0ecaf, clean_jobs=False
C:\LTCminer\stratum_proxy.exe\twisted\web\server.py:220: DeprecationWarning: Pas
sing non-bytes header values is deprecated since Twisted 12.3. Pass only bytes i
nstead.
2014-02-09 18:03:58,364 INFO proxy getwork_listener.render_POST # Worker 'staffo
rdjimmy.jimmycpu' subscribed for LP
2014-02-09 18:04:14,505 INFO proxy getwork_listener.render_POST # Worker 'staffo
rdjimmy.mattcpu' subscribed for LP
2014-02-09 18:04:18,154 INFO proxy client_service.handle_event # New job 796c fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:04:21,430 INFO proxy jobs.submit # Submitting 049398c8
2014-02-09 18:04:21,493 INFO proxy client_service.handle_event # Setting new dif
ficulty: 16.0
2014-02-09 18:04:21,493 INFO proxy client_service.handle_event # New job 79ef fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:04:21,493 INFO proxy getwork_listener._on_submit # [62ms] Share fr
om 'staffordjimmy.jimmycpu' accepted, diff 16
2014-02-09 18:04:52,302 INFO proxy jobs.submit # Submitting 155a956c
2014-02-09 18:04:52,348 INFO proxy getwork_listener._on_submit # [46ms] Share fr
om 'staffordjimmy.mattcpu' accepted, diff 16
2014-02-09 18:05:04,082 INFO proxy client_service.handle_event # New job 7a40 fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:05:06,115 INFO proxy jobs.submit # Submitting 14d80e63
2014-02-09 18:05:06,177 INFO proxy getwork_listener._on_submit # [62ms] Share fr
om 'staffordjimmy.mattcpu' accepted, diff 16
2014-02-09 18:05:32,946 INFO proxy jobs.submit # Submitting 1186300c
2014-02-09 18:05:32,992 INFO proxy getwork_listener._on_submit # [46ms] Share fr
om 'staffordjimmy.jimmycpu' accepted, diff 16
2014-02-09 18:05:34,618 INFO proxy jobs.submit # Submitting 0ba6ee81
2014-02-09 18:05:34,665 INFO proxy getwork_listener._on_submit # [46ms] Share fr
om 'staffordjimmy.mattcpu' accepted, diff 16
2014-02-09 18:05:41,480 INFO proxy jobs.submit # Submitting 4eebb313
2014-02-09 18:05:41,542 INFO proxy getwork_listener._on_submit # [62ms] Share fr
om 'staffordjimmy.mattcpu' accepted, diff 16
2014-02-09 18:05:44,026 INFO proxy client_service.handle_event # New job 7b15 fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:06:07,762 INFO proxy jobs.submit # Submitting 34f40d57
2014-02-09 18:06:07,809 WARNING proxy getwork_listener._on_submit_failure # [46m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7b15' not found", N
one)
2014-02-09 18:06:11,595 INFO proxy jobs.submit # Submitting 4a9a98ce
2014-02-09 18:06:11,657 WARNING proxy getwork_listener._on_submit_failure # [62m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7b15' not found", N
one)
2014-02-09 18:06:36,190 INFO proxy client_service.handle_event # New job 7be5 fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:06:45,538 INFO proxy jobs.submit # Submitting 54f5b7b5
2014-02-09 18:06:45,599 WARNING proxy getwork_listener._on_submit_failure # [61m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7b15' not found", N
one)
2014-02-09 18:06:49,476 INFO proxy jobs.submit # Submitting 9ef43ec3
2014-02-09 18:06:49,539 WARNING proxy getwork_listener._on_submit_failure # [46m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7be5' not found", N
one)
2014-02-09 18:06:52,029 INFO proxy jobs.submit # Submitting d34244e5
2014-02-09 18:06:52,075 WARNING proxy getwork_listener._on_submit_failure # [46m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7be5' not found", N
one)
2014-02-09 18:07:07,398 INFO proxy jobs.submit # Submitting 80e2716e
2014-02-09 18:07:11,382 WARNING proxy getwork_listener._on_submit_failure # [398
3ms] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7be5' not found",
None)
2014-02-09 18:07:29,940 INFO proxy jobs.submit # Submitting 7379dc81
2014-02-09 18:07:30,003 WARNING proxy getwork_listener._on_submit_failure # [62m
s] Share from 'staffordjimmy.jimmycpu' REJECTED: (-2, u"Job '7be5' not found", N
one)
2014-02-09 18:07:41,118 INFO proxy client_service.handle_event # New job 7cb5 fo
r prevhash 1fd0ecaf, clean_jobs=False
2014-02-09 18:07:55,045 INFO proxy jobs.submit # Submitting 3f5eebbb
2014-02-09 18:07:55,108 INFO proxy getwork_listener._on_submit # [62ms] Share fr
om 'staffordjimmy.mattcpu' accepted, diff 16

Got many REJECTED when not overriding worker details

When trying to use the proxy WITHOUT -cu, -cp and -cs options (so miners send directly their packets with the original worker information), I get many REJECTS (not all of them but more than 80%). It seems to me that the minig-proxy does not handle properly the job_id or so.

2014-01-30 22:23:54,607 INFO proxy stratum_listener.submit # [23ms] Share from 'worker.sm3' REJECTE:D (-2, u"Job 'bf7f' not found", u"Traceback: <class 'lib.exceptions.SubmitException'>: Job 'bf7f' not found\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:13:_handle_event\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:81:call\n--- ---\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:134:maybeDeferred\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:78:_run\n/root/stratum-pools/auto-pool/mining/service.py:168:submit\n/root/stratum-pools/auto-pool/lib/template_registry.py:198:submit_share\n")
2014-01-30 22:23:55,321 INFO proxy stratum_listener.submit # [21ms] Share from 'worker.sm1' REJECTED: (-2, u"Job 'bf7f' not found", u"Traceback: <class 'lib.exceptions.SubmitException'>: Job 'bf7f' not found\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:13:_handle_event\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:81:call\n--- ---\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:134:maybeDeferred\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:78:_run\n/root/stratum-pools/auto-pool/mining/service.py:168:submit\n/root/stratum-pools/auto-pool/lib/template_registry.py:198:submit_share\n")

Multiple workers mixing data

i have more than 1 rig. Firstly i was trying to use cgminer 3.7.2 but i always get rejects. after reading in your issues i downloaded sgminer 4.1.0 and everything worked fine for one worker but when i tried to connect 2-nd worker here what happend

2014-02-20 14:47:11,388 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:14,551 INFO proxy stratum_listener.submit # [1ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:19,907 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:40,713 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:44,711 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:46,042 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.1' accepted, diff 512
2014-02-20 14:47:53,133 INFO proxy client_service.handle_event # Setting new difficulty: 1024.0
2014-02-20 14:47:53,134 INFO proxy client_service.handle_event # New job 492 for prevhash ac2a570e, clean_jobs=False
2014-02-20 14:47:53,134 INFO proxy stratum_listener.submit # [44ms] Share from 'iaroslav.1' accepted, diff 1024
2014-02-20 14:47:56,331 INFO stats stats.print_stats # 3 peers connected, state changed 1 times
2014-02-20 14:48:01,355 INFO proxy client_service.handle_event # New job 493 for prevhash ac2a570e, clean_jobs=False
2014-02-20 14:48:06,347 INFO proxy client_service.handle_event # New job 494 for prevhash 25e6e21a, clean_jobs=True
2014-02-20 14:48:06,352 INFO proxy stratum_listener.submit # [0ms] Share from 'iaroslav.1' REJECTED: (-2, u"Job '493' not found", None)
2014-02-20 14:48:12,221 INFO proxy stratum_listener.submit # [31ms] Share from 'iaroslav.6' accepted, diff 1024
2014-02-20 14:48:19,364 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.6' accepted, diff 1024
2014-02-20 14:48:21,359 INFO proxy client_service.handle_event # New job 495 for prevhash e6762b46, clean_jobs=True
2014-02-20 14:48:33,154 INFO proxy stratum_listener.submit # [4ms] Share from 'iaroslav.6' accepted, diff 1024
2014-02-20 14:48:36,397 INFO proxy stratum_listener.submit # [3ms] Share from 'iaroslav.1' REJECTED: (-2, u"Job '495' not found", None)
2014-02-20 14:48:46,733 INFO proxy stratum_listener.submit # [3ms] Share from 'iaroslav.1' REJECTED: (-2, u"Job '495' not found", None)
2014-02-20 14:48:51,049 INFO proxy stratum_listener.submit # [3ms] Share from 'iaroslav.1' REJECTED: (-2, u"Job '495' not found", None)

normally each new worker should start with diff 16 and i see the 2-nd worker go directly to 1-st diff and 1-st worker get only rejects from here i have to restart proxy so 1-st worker to work again normally is this a problem of proxy or the sgminer ?

please advice how to run my rigs trough your proxy ? i tried cgminer and sgminer and no positive results.

Sends broken JSON upstream (big stack trace with double-quotes not escaped)

Upon an error occurring in the stratum proxy it attempts to send a big stack trace as an error message to the upstream server. Besides this (sending a stack trace upstream) not making sense in the first place the error message contains double-quotes that are not escaped, which makes the JSON code invalid and unparseable for the upstream server.

I would make two suggestions. The first is to not send stack traces upstream or downstream. The other is to escape double-quotes when encoding JSON.

extranonce2_size and tail fix.

Files stratum-mining-proxy.orig/mining_libs/client_service.py and ./stratum-mining-proxy.fixed/mining_libs/client_service.py are identical
Files stratum-mining-proxy.orig/mining_libs/getwork_listener.py and ./stratum-mining-proxy.fixed/mining_libs/getwork_listener.py are identical
Files stratum-mining-proxy.orig/mining_libs/__init__.py and ./stratum-mining-proxy.fixed/mining_libs/__init__.py are identical
diff -urNBs stratum-mining-proxy.orig/mining_libs/jobs.py ./stratum-mining-proxy.fixed/mining_libs/jobs.py
--- stratum-mining-proxy.orig/mining_libs/jobs.py       2014-01-21 12:18:57.985908472 -0500
+++ ./stratum-mining-proxy.fixed/mining_libs/jobs.py    2014-01-21 12:22:43.330185025 -0500
@@ -61,7 +61,7 @@
         return self.extranonce2

     def build_coinbase(self, extranonce):
-        return self.coinb1_bin + extranonce + self.coinb2_bin
+        return self.coinb1_bin + extranonce + self.extranonce2 + self.coinb2_bin

     def build_merkle_root(self, coinbase_hash):
         merkle_root = coinbase_hash
@@ -139,7 +139,7 @@

         # This is probably more common situation, but it is perfectly
         # safe to add whitespaces
-        return '\x00' * missing_len + extranonce2_bin
+        return '\x00' * missing_len + extranonce2_bin

     def add_template(self, template, clean_jobs):
         if clean_jobs:
Files stratum-mining-proxy.orig/mining_libs/midstate.py and ./stratum-mining-proxy.fixed/mining_libs/midstate.py are identical
Files stratum-mining-proxy.orig/mining_libs/multicast_responder.py and ./stratum-mining-proxy.fixed/mining_libs/multicast_responder.py are identical
diff -urNBs stratum-mining-proxy.orig/mining_libs/stratum_listener.py ./stratum-mining-proxy.fixed/mining_libs/stratum_listener.py
--- stratum-mining-proxy.orig/mining_libs/stratum_listener.py   2014-01-21 12:18:57.986908442 -0500
+++ ./stratum-mining-proxy.fixed/mining_libs/stratum_listener.py        2014-01-21 12:22:43.330185025 -0500
@@ -155,8 +155,10 @@
         self.connection_ref().on_disconnect.addCallback(self._drop_tail, tail)

         subs1 = Pubsub.subscribe(self.connection_ref(), DifficultySubscription())[0]
-        subs2 = Pubsub.subscribe(self.connection_ref(), MiningSubscription())[0]
-        defer.returnValue(((subs1, subs2),) + (self.extranonce1+tail, extranonce2_size))
+        subs2 = Pubsub.subscribe(self.connection_ref(), MiningSubscription())[0]
+        extranonce2_size = extranonce2_size + 1;
+        log.info("Expected extranonce2_size of '%s'" % (extranonce2_size))
+        defer.returnValue(((subs1, subs2),) + (self.extranonce1, extranonce2_size))

     @defer.inlineCallbacks
     def submit(self, worker_name, job_id, extranonce2, ntime, nonce, *args):
@@ -171,7 +173,7 @@
         start = time.time()

         try:
-            result = (yield self._f.rpc('mining.submit', [worker_name, job_id, tail+extranonce2, ntime, nonce]))
+            result = (yield self._f.rpc('mining.submit', [worker_name, job_id, extranonce2, ntime, nonce]))
         except RemoteServiceException as exc:
             response_time = (time.time() - start) * 1000
             log.info("[%dms] Share from '%s' REJECTED: %s" % (response_time, worker_name, str(exc)))
Files stratum-mining-proxy.orig/mining_libs/utils.py and ./stratum-mining-proxy.fixed/mining_libs/utils.py are identical
Files stratum-mining-proxy.orig/mining_libs/version.py and ./stratum-mining-proxy.fixed/mining_libs/version.py are identical
Files stratum-mining-proxy.orig/mining_libs/worker_registry.py and ./stratum-mining-proxy.fixed/mining_libs/worker_registry.py are identical

Install trouble on Linux

Hello, I've never installed or run this before so there is a fair chance that I've simply forgotten to do something but installation fails for lack of py2exe. Is there a chance that the dependency on py2exe may either be unneeded on Linux or that cx-freeze might serve the same purpose? Many thanks.

/home/nnnnn/nnnn/poclbm $ sudo python setup.py develop
[sudo] password for nnnnn:
Traceback (most recent call last):
File "setup.py", line 2, in
import py2exe
ImportError: No module named py2exe

Just for kicks, I tried to run it anyway and it failed as follows.

No PyOpenCL

Not using OpenCL

Traceback (most recent call last):
File "./poclbm.py", line 82, in
import BFLMiner
File "/home/nnnnn/nnnn/poclbm/BFLMiner.py", line 4, in
from ioutil import find_udev, find_serial_by_id, find_com_ports
File "/home/nnnnn/nnnn/poclbm/ioutil.py", line 2, in
from serial.tools import list_ports
ImportError: No module named tools

get_version exception

Very odd results from get_version:

{'result': None, 'id': 7, 'error': [-1, "local variable 'version' referenced before assignment", "Traceback: <type 'exceptions.UnboundLocalError'>: local variable 'version' referenced before assignment\n/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py:626:_doReadOrWrite\n/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:203:doRead\n/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:209:_dataReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/protocol.py:166:dataReceived\n--- <exception caught here> ---\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/protocol.py:191:lineReceived\n/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/event_handler.py:7:_handle_event\n/var/poclbm/stratum-mining-proxy/mining_libs/client_service.py:66:handle_event\n"]}

Or:

local variable 'version' referenced before assignment
Traceback: <type 'exceptions.UnboundLocalError'>: local variable 'version' referenced before assignment
/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py:626:_doReadOrWrite
/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:203:doRead
/usr/local/lib/python2.7/dist-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:209:_dataReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/protocol.py:166:dataReceived
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/protocol.py:191:lineReceived
/usr/local/lib/python2.7/dist-packages/stratum-0.2.7-py2.7.egg/stratum/event_handler.py:7:_handle_event
/var/poclbm/stratum-mining-proxy/mining_libs/client_service.py:66:handle_event

'NoneType' object has no attribute 'write'

2013-05-03 14:41:44,935 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'write'
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py:614:_doReadOrWrite
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:215:doRead
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py:221:_dataReceived
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:185:dataReceived
--- ---
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:230:lineReceived
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py:7:_handle_event
/home/stratum-mining-proxy/mining_libs/client_service.py:64:handle_event
/home/stratum-mining-proxy/mining_libs/stratum_listener.py:51:on_template
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:54:emit
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:160:emit
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py:66:emit_single
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:102:writeJsonRequest
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py:83:transport_write
]
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 230, in lineReceived
result = self.event_handler._handle_event(msg_method, msg_params, connection_ref=self)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/event_handler.py", line 7, in _handle_event
return defer.maybeDeferred(wrap_result_object, self.handle_event(msg_method, msg_params, connection_ref))
File "/home/stratum-mining-proxy/mining_libs/client_service.py", line 64, in handle_event
job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
File "/home/stratum-mining-proxy/mining_libs/stratum_listener.py", line 51, in on_template
cls.emit(job_id, prevhash, coinb1, coinb2, merkle_branch, version, nbits, ntime, clean_jobs)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 54, in emit
return Pubsub.emit(cls.event, _args, *_kwargs)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 160, in emit
subscription.emit_single(_args, *_kwargs)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/pubsub.py", line 66, in emit_single
conn.writeJsonRequest(self.event, payload, is_notification=True)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 102, in writeJsonRequest
self.transport_write("%s\n" % serialized)
File "/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 83, in transport_write
self.transport.write(data)
AttributeError: 'NoneType' object has no attribute 'write'

License?

Hi,

I'd like to borrow you stratum code for use in another bitcoin proxy. However there is no license listed or reuse terms. Can you either put your code other another license or release it into the public domain?

-Colin

cross compiled for Thecus NAS error on launch (Stratum host/port autodetection failed)

Stratum host/port autodetection failed
Traceback (most recent call last):
File "/raid0/data/module/stratumminingproxy/sys/lib/python2.7/site-packages/stratum_mining_proxy-1.5.2-py2.7.egg/EGG-INFO/scripts/mining_proxy.py", line 178, in main
new_host = (yield utils.detect_stratum(args.host, args.port))
AttributeError: 'module' object has no attribute '_parse'

any idea ? thanks

ERROR protocol protocol.dataReceived

Hi,

I'm testing out the latest Git version (as of 2014-01-27) of the slush0 mining_proxy in Linux, and I receive the following error when trying Scrypt:

user@host:~/stratum-mining-proxy$ ./mining_proxy.py -st -o pool-eu.hash.so -p 1337 -cu user.wk1 -cp pass
/usr/local/lib/python2.7/dist-packages/zope.interface-4.0.5-py2.7-linux-i686.egg/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-27 22:45:08,737 INFO proxy jobs.<module> # C extension for midstate not available. Using default implementation instead.
2014-01-27 22:45:08,738 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
  File "./mining_proxy.py", line 182, in main
    new_host = (yield utils.detect_stratum(args.host, args.port))
AttributeError: 'module' object has no attribute '_parse'
2014-01-27 22:45:08,738 WARNING proxy mining_proxy.main # Stratum proxy version: 1.5.2
2014-01-27 22:45:08,739 WARNING proxy mining_proxy.test_update # Checking for updates...
2014-01-27 22:45:09,743 WARNING proxy mining_proxy.main # Trying to connect to Stratum pool at pool-eu.hash.so:1337
2014-01-27 22:45:09,922 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-27 22:45:09,922 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at pool-eu.hash.so:1337
2014-01-27 22:45:09,922 WARNING proxy mining_proxy.on_connect # Authorizing custom user noveske.test, password qwe
2014-01-27 22:45:09,922 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2014-01-27 22:45:10,559 INFO proxy client_service.handle_event # Setting new difficulty: 16
2014-01-27 22:45:10,685 INFO proxy client_service.handle_event # New job 388 for prevhash cc899b97, clean_jobs=True
2014-01-27 22:45:10,685 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
    self.lineReceived(line, request_counter)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 257, in lineReceived
    raise custom_exceptions.ProtocolException("Lookup for deferred object for message ID '%s' failed." % msg_id)
ProtocolException: Lookup for deferred object for message ID '1' failed.
2014-01-27 22:45:10,685 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at pool-eu.hash.so:1337
2014-01-27 22:45:10,686 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
2014-01-27 22:45:12,735 INFO stats stats.print_stats # 1 peers connected, state changed 1 times
2014-01-27 22:45:12,735 INFO proxy mining_proxy.on_connect # Connected to Stratum pool at pool-eu.hash.so:1337
2014-01-27 22:45:12,735 WARNING proxy mining_proxy.on_connect # Authorizing custom user noveske.test, password qwe
2014-01-27 22:45:12,735 INFO proxy mining_proxy.on_connect # Subscribing for mining jobs
2014-01-27 22:45:13,366 INFO proxy client_service.handle_event # Setting new difficulty: 16
2014-01-27 22:45:13,512 INFO proxy client_service.handle_event # New job 35a for prevhash cc899b97, clean_jobs=True
2014-01-27 22:45:13,512 ERROR protocol protocol.dataReceived # Processing of message failed
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
    self.lineReceived(line, request_counter)
  File "/usr/local/lib/python2.7/dist-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 257, in lineReceived
    raise custom_exceptions.ProtocolException("Lookup for deferred object for message ID '%s' failed." % msg_id)
ProtocolException: Lookup for deferred object for message ID '1' failed.
2014-01-27 22:45:13,512 INFO proxy mining_proxy.on_disconnect # Disconnected from Stratum pool at pool-eu.hash.so:1337
2014-01-27 22:45:13,512 INFO stats stats.print_stats # 0 peers connected, state changed 1 times
^C
2014-01-27 22:45:14,456 INFO proxy mining_proxy.on_shutdown # Shutting down proxy...
user@host:~/stratum-mining-proxy$

Proxy tree don't work

Hello,

For proxy tree (200 proxy connected on one proxy connected on bitminter), the difficulty is not send throught the proxy (on the cascade).

Fix it please.

Stratum change on failure

I run multiple miners and sometimes I got lots of "Share is above target" on diff change. Yes, pools I use supports VARDIFF, so sometimes with diff 128 everything goes nice, then it switches to 960 and it goes ok. But sometimes it gives 98% REJECT.

Is it possible to solve this? Or at least is it possible to patch stratum proxy to change stratum server if it gets lots of rejects?

p.s. I run 30mh/s. All miners use same worker name (e.g. user.1:x)

Unhandled error in Deferred via stratum/protocol.py

I am getting the following error. Let me know what other information or debugging you want me to do.

Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 185, in dataReceived
self.lineReceived(line, request_counter)
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/stratum-0.2.12-py2.7.egg/stratum/protocol.py", line 264, in lineReceived
meta['defer'].callback(msg_result)
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/Twisted-12.2.0-py2.7-macosx-10.8-intel.egg/twisted/internet/defer.py", line 368, in callback
self._startRunCallbacks(result)
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/Twisted-12.2.0-py2.7-macosx-10.8-intel.egg/twisted/internet/defer.py", line 464, in _startRunCallbacks
self._runCallbacks()
--- ---
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/Twisted-12.2.0-py2.7-macosx-10.8-intel.egg/twisted/internet/defer.py", line 551, in _runCallbacks
current.result = callback(current.result, _args, *_kw)
File "/Users/trevor/git/stratum-mining-proxy/mining_libs/getwork_listener.py", line 107, in _on_failure
request.finish()
File "/Users/trevor/Library/Python/2.7/lib/python/site-packages/Twisted-12.2.0-py2.7-macosx-10.8-intel.egg/twisted/web/http.py", line 866, in finish
"Request.finish called on a request after its connection was lost; "
exceptions.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.

Extranonce slots are full, please disconnect some miners

Hello,
I have:
2013-04-23 15:51:26,901 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:27,149 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:27,602 INFO proxy stratum_listener.submit # [15ms] Share from 'pool' REJECTED: (21, u'Stale work', None)
2013-04-23 15:51:28,067 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' REJECTED: (21, u'Stale work', None)
2013-04-23 15:51:29,751 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' REJECTED: (21, u'Stale work', None)
2013-04-23 15:51:29,840 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:30,085 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' REJECTED: (21, u'Stale work', None)
2013-04-23 15:51:31,243 INFO proxy stratum_listener.submit # [15ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:32,745 INFO proxy getwork_listener._on_authorized # Worker 'pool' asks for new work
2013-04-23 15:51:33,539 INFO proxy getwork_listener._on_authorized # Worker 'pool' asks for new work
2013-04-23 15:51:35,481 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:38,814 INFO proxy stratum_listener.submit # [14ms] Share from 'pool' REJECTED: (21, u'Stale work', None)
2013-04-23 15:51:41,580 INFO proxy jobs.submit # Submitting d6642a20
2013-04-23 15:51:41,595 WARNING proxy getwork_listener._on_submit # [14ms] Share from 'pool' accepted, diff 1
2013-04-23 15:51:43,635 INFO proxy client_service.handle_event # New job 13d8-1a8 for prevhash a8e7003d, clean_jobs=False
2013-04-23 15:51:44,987 INFO proxy stratum_listener.submit # [14ms] Share from 'alphaonex86_ultracopier' accepted, diff 1
2013-04-23 15:51:47,896 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.Exception'>: Extranonce slots are full, please disconnect some miners!
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:81:call
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:137:maybeDeferred
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:78:_run
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1213:unwindGenerator
--- ---
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1070:_inlineCallbacks
/home/stratum-mining-proxy/mining_libs/stratum_listener.py:138:subscribe
/home/stratum-mining-proxy/mining_libs/stratum_listener.py:108:_get_unused_tail
]
None
2013-04-23 15:51:47,934 INFO stats stats.print_stats # 59 peers connected, state changed 3 times
2013-04-23 15:51:47,983 ERROR protocol protocol.process_failure # [Failure instance: Traceback: <type 'exceptions.Exception'>: Extranonce slots are full, please disconnect some miners!
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:81:call
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:137:maybeDeferred
/usr/lib64/python2.7/site-packages/stratum-0.2.12-py2.7.egg/stratum/services.py:78:_run
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1213:unwindGenerator
--- ---
/usr/lib64/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1070:_inlineCallbacks
/home/stratum-mining-proxy/mining_libs/stratum_listener.py:138:subscribe
/home/stratum-mining-proxy/mining_libs/stratum_listener.py:108:_get_unused_tail
How fix?
Cheer,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.