Code Monkey home page Code Monkey logo

js_ltc_miner's Introduction

js_ltc_miner

A proof-of-concept LTC miner in javascript.

This proof of concept uses poolers JMiner codebase (https://github.com/pooler/JMiner) and ports it to Javascript. For demonstration purposes the data is hard coded in the 'work.js' file but by uncommenting the ajax call and adjusting the proxy.php file to point to your stratum server it can be run live. I did this to quickly overcome the cross-domain scripting issues - i.e. port 3333 is different from port 80 so javascript will throw a cross-domain exception if you try to make an ajax call to it.

Copy all the files into a web accessible directory and load the 'index.html' file then click on start to start hashing. It will update the hashrate, total hashes and display the latest hash every 200 hashes. I haven't run it long enough to actually find a share but I did confirm that the hashes match those of JMiner when the same data is fed so it seems to be working fine. The code to submit shares was not tested simply because I never ran the application long enough to find a share but it's there.

On my old laptop with an AMD Athod X2 processor I get about 40 hashes a second in Chrome and 30 hashes a second in Firefox! I used google CryptoJS (http://code.google.com/p/crypto-js/) library for the hashing functions and the JSON library from http://www.json.org/js.html for the JSON. I didn't bother with a library for the AJAX calls and I actually made the synchronous to make it simpler.

I didn't port over every function from the JMiner codebase only those enough to get is hashing - for example I didn't do anything with longpolling or multiple threads or cpu throttling. I think they are all possible there just wasn't a need.

For those interested I made use of HTML5 workers to get the code hashing in the background and it communicates with the main javascript through messages. The only problem I ran into is that the worker threads hogs all the CPU resources and doesn't yield when a request is made - for example stop. My only attempt to get the worker to yield was to replace the while(running) { } loop with a setTimeout(work(), xxxx) but that hurt the hashrate alot.

Take it easy on me re: code style / coding etc...just a quick hack to get it hashing so I can see what could be expected.

If you find this useful please feel free to donate:

LTC: LRt1KkirdbiBf3vPQR3tEQZQrVxPAA9Bb4

js_ltc_miner's People

Contributors

esenminer 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js_ltc_miner's Issues

Stratum host/port autodetection failed

Do I need to worry about this error?
It occurs on start up.

2013-10-15 21:30:00,653 ERROR proxy mining_proxy.main # Stratum host/port autodetection failed
Traceback (most recent call last):
  File "/usr/local/stratumproxy/mining_proxy.py", line 155, in main
    new_host = (yield utils.detect_stratum(args.host, args.port))
AttributeError: 'module' object has no attribute '_parse'

How configure?

Hello
I use the hashfaster.com but I don't know how be exactly to fill.
So I gave it a in proxy.php:

So wrong?
Thank you in advance for your help.

Share from 'xxxxxx' REJECTED: Odd-length string

I am getting an error when a share gets submitted:

2013-10-15 21:21:02,185 WARNING proxy getwork_listener._on_submit_failure # [0ms] Share from 'xxxxxxx' REJECTED: Odd-length string
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/twisted/web/resource.py", line 250, in render
    return m(request)
  File "/usr/local/stratumproxy/mining_libs/getwork_listener.py", line 166, in render_POST
    d.addCallback(self._on_authorized, request, worker_name)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 304, in addCallback
    callbackKeywords=kw)
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 293, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 575, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/stratumproxy/mining_libs/getwork_listener.py", line 68, in _on_authorized
    data = json.loads(request.content.read())
  File "/usr/local/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
exceptions.ValueError: No JSON object could be decoded

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.