Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: gigabytecoin on March 24, 2011, 04:19:26 AM



Title: Is A Javascript Based Miner At All Possible?
Post by: gigabytecoin on March 24, 2011, 04:19:26 AM
Check this out: http://www.webtoolkit.info/javascript-sha256.html (http://www.webtoolkit.info/javascript-sha256.html)

Apparantly you can create sha256 hashes through javascript in your browser.

So, can you mine with it?

Maybe with some node.js on the server?


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: doublec on March 24, 2011, 04:29:06 AM
It'll be more interesting when WebCL becomes available in browsers:

http://www.conceivablytech.com/5978/products/webcl-to-enablegpu-accelerated-web-apps


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: gigabytecoin on March 26, 2011, 08:45:22 PM
It'll be more interesting when WebCL becomes available in browsers:

http://www.conceivablytech.com/5978/products/webcl-to-enablegpu-accelerated-web-apps

Whoaaaaa nelly, thanks for the link.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: snedie on March 29, 2011, 11:46:19 PM
Isn't this what ATI is designing for their new 6000 series architecture?

I would link to the youtube videos but the "Subcription" feature is getting updates right now so I cant access their channel, however here is a caveat to look at: http://blogs.amd.com/developer/2010/09/15/hardware-accelerated-web-with-amd-and-internet-explorer-9-beta/ (http://blogs.amd.com/developer/2010/09/15/hardware-accelerated-web-with-amd-and-internet-explorer-9-beta/)


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: ryepdx on March 31, 2011, 09:25:29 PM
Slush made a Javascript miner a while ago. Never released it as he made it for his own test purposes. But here's the thread:
http://bitcointalk.org/index.php?topic=1925.msg24236#msg24236 (http://bitcointalk.org/index.php?topic=1925.msg24236#msg24236)


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: randomproof on April 04, 2011, 05:18:25 PM
Most browsers have a limit for how long a script can run when you load a page.  I think about 30 seconds.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: bittersweet on April 04, 2011, 05:51:12 PM
The limit doesn't matter unless a single mining operation (hashing I suppose?) would take longer. You can just make the mining function call itself in some time intervals.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: gigabytecoin on April 05, 2011, 05:55:05 AM
Slush made a Javascript miner a while ago. Never released it as he made it for his own test purposes. But here's the thread:
http://bitcointalk.org/index.php?topic=1925.msg24236#msg24236 (http://bitcointalk.org/index.php?topic=1925.msg24236#msg24236)

Thanks for that, I have just PM'ed him for the basic code. Just want a basic understanding of how a bitcoin is generated, and I believe javascript could show this in the simplest format.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: fpgaminer on April 07, 2011, 06:04:40 AM
I took a break from my FPGA miner to throw together a JavaScript miner, mostly for educational purposes. It's on GitHub:
Bitcoin-JavaScript-Miner (https://github.com/progranism/Bitcoin-JavaScript-Miner)

If you upload it to a server, it functions. My system gets about 8khash/s, which is just cute  :P but that's actually a bit more than I expected.
It hasn't been tested for accuracy, so for all I know there's a bunch of bugs in the hashing code.
It doesn't do a real getwork, nor does it submit work (if it ever actually finds a share ...)

But I commented the code, and tried to make it as clear as possible. The real grunt work is in miner.js, so look there if you want to know how Bitcoins are mined.
work-manager.js is where miner.js is called from. Since a real getwork isn't actually used, there isn't much to see there. Normally it would talk to a mining pool server, and do a "getwork" request, which gives you the information you need to execute the code in miner.js. Once a valid hash is found, that would be returned to the mining pool server.


Enjoy! If I have the motivation and time I'll see what I can do to A) make sure it's bug free, and B) make it work with an actual mining pool ... just for giggles.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: Comepradz on May 07, 2011, 01:09:16 AM
Hey fpgaminer, I just tested your javascript miner and it didn't work at all, I mean it didn't return any hash/s value. I try to manually execute 'begin_mining()' with console in Google Chrome's developer tool and got this:

Quote
begin_mining()
Error: SECURITY_ERR: DOM Exception 18

I'm no good programmer, so I don't know what exactly it means. Do you have any ideas about this issue? Thanks :)


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: fpgaminer on May 07, 2011, 04:39:07 AM
Hmm ... did you run it locally or on a server? It might need to be run on an actual webserver, but I don't remember for sure. Google Chrome in particular gets cranky when JavaScript is run off the filesystem.


Title: Re: Is A Javascript Based Miner At All Possible?
Post by: Comepradz on May 07, 2011, 12:07:18 PM
I ran it locally, and yea it works after I place it on webserver. thanks a lot.