# Javascript miner

**URL:** <https://forum.zcashcommunity.com/t/javascript-miner/8955>\
**Category:** Mining\
**Created:** [November 23, 2016, 2:24pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955 "2016-11-23T14:24:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 2:24pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/1 "2016-11-23T14:24:23Z")

</div>

I’ve made concept javascript ZEC miner, that works around ten times slower then native CPU miner, let’s say 0.1 Sol/s on average machine.

It’s build with emscripten and powered by asm.js (“use asm”), working more or less fine in Firefox, but requires manual setting of #enable-asm-webassembly and #enable-webassembly flags in fresh Chrome. It uses the same memory size as native. It could communicate thru websocket with proxy module on your side, verifying solutions and sending them to one of the pools under your credentials.

If you can attract 1000 users mining simultaneously for you, for example while sitting on your site and running it knowingly or implicitly, you can get up to $50 per month with current net hashrate and market prices.

Now I wonder should I publish it, or all hell will break loose with new generation of ads and spam in web?

---

<div class="post-metadata">

**Author:** ![Zcash.Trading](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/zcash.trading/32/2740_2.png) [@Zcash.Trading](https://forum.zcashcommunity.com/u/Zcash.Trading)\
**Post date:** [November 23, 2016, 2:26pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/2 "2016-11-23T14:26:31Z")

</div>

Test it out for a few weeks see what happens. No harm in safely detonating an atom bomb in the desert Mr.Oppenheimer.

---

<div class="post-metadata">

**Author:** ![sdmr94](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sdmr94](https://forum.zcashcommunity.com/u/sdmr94)\
**Post date:** [November 23, 2016, 3:29pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/3 "2016-11-23T15:29:59Z")

</div>

Have you used it with node JS yet?

---

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 3:32pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/4 "2016-11-23T15:32:56Z")

</div>

nope, i guess performance will be the same.

---

<div class="post-metadata">

**Author:** ![tromp](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/tromp/32/522_2.png) [@tromp](https://forum.zcashcommunity.com/u/tromp)\
**Post date:** [November 23, 2016, 3:34pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/5 "2016-11-23T15:34:55Z")

</div>

Thanks for making this!

This is something I’ve always planned to do for Cuckoo Cycle, but have been putting off until I can get 64-bit support, which is crucial for decent performance, and planned for future versions of web assembly.

Did you have to implement blake2b yourself? Any idea what percentage of your runtime is taken up by the blake2b computations?

---

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 3:45pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/6 "2016-11-23T15:45:18Z")

</div>

Hello John, nice to hear you!

It definitely should be done for Cuckoo too, together with new coin for it etc.

There is no 64 bit neither in asm.js nor in webassembly, which is really pity. BLAKE2b is indeed painfully slow and takes presumably 3/4 of all time. I’ve used reference implementation with \_compress optimized for second update of zcash block (all zeroes except the number of hash, assuming all nonce will live in first part of powheader, and with less movement of bytes after calculation), but it improves only by 20%.

---

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 3:59pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/7 "2016-11-23T15:59:27Z")

</div>

More precise: 10 nonces that gives 20 solutions are calculated in 139 seconds, and if I calculate only digit0 (without following steps 1…WK) it takes 120 secods, so BLAKE2b takes more than 80% of all time.

---

<div class="post-metadata">

**Author:** ![sdmr94](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sdmr94](https://forum.zcashcommunity.com/u/sdmr94)\
**Post date:** [November 23, 2016, 5:07pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/8 "2016-11-23T17:07:06Z")

</div>

once you’ve released it, could you let me know so i can test it with node.js.

---

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 5:50pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/9 "2016-11-23T17:50:26Z")

</div>

please see [https://gist.github.com/mtve/af9393144d45d89a606832d2bf58ba5f](https://gist.github.com/mtve/af9393144d45d89a606832d2bf58ba5f)

---

<div class="post-metadata">

**Author:** ![individual-it](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/individual-it/32/1871_2.png) [@individual-it](https://forum.zcashcommunity.com/u/individual-it)\
**Post date:** [November 23, 2016, 8:06pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/10 "2016-11-23T20:06:59Z")

</div>

There are simmilar projects for bitcoins.  
People could try to use it as an alternative to ads. And if the guest is shown a message somewhere like: “You are mining xxx coins to support this site” and has the possibility to stop it I would think its alright.

---

<div class="post-metadata">

**Author:** ![mtve](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mtve](https://forum.zcashcommunity.com/u/mtve)\
**Post date:** [November 23, 2016, 8:43pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/11 "2016-11-23T20:43:03Z")

</div>

I guess if you have 1000 simultaneous visitors on average on your site (that in fact is a lot), you could do much more then $50/month with ads. So unless some WebGL gives any practical boost, this picture does not look good for me.

---

<div class="post-metadata">

**Author:** ![kings](https://avatars.discourse-cdn.com/v4/letter/k/90ced4/32.png) [@kings](https://forum.zcashcommunity.com/u/kings)\
**Post date:** [November 23, 2016, 9:00pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/12 "2016-11-23T21:00:19Z")

</div>

since you posted about it - publish it 😉

---

<div class="post-metadata">

**Author:** ![individual-it](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/individual-it/32/1871_2.png) [@individual-it](https://forum.zcashcommunity.com/u/individual-it)\
**Post date:** [November 24, 2016, 8:22am UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/13 "2016-11-24T08:22:10Z")

</div>

The question would be what does annoy users more. Ads or a hot CPU.

It would need to optimized

- so that you still could use the browser
- output is generated about how much is mined
- ideally would not stop if you switch between pages of the same site

---

<div class="post-metadata">

**Author:** ![sdmr94](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sdmr94](https://forum.zcashcommunity.com/u/sdmr94)\
**Post date:** [November 25, 2016, 3:10pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/14 "2016-11-25T15:10:48Z")

</div>

I agree, i would like to use this, I’m an IT Tech so i’ve got access to 600 machines but i can’t install software on them so a browser would be perfect to run every night. I had a look but i don’t exactly understand how to use it has i can run it but unsure where i put my wallet information etc

---

<div class="post-metadata">

**Author:** ![maztheman](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maztheman](https://forum.zcashcommunity.com/u/maztheman)\
**Post date:** [November 25, 2016, 3:42pm UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/15 "2016-11-25T15:42:33Z")

</div>

OpenGL ES 3.1 Compute Shaders to the rescue.

[http://malideveloper.arm.com/resources/sample-code/introduction-compute-shaders-2/](http://malideveloper.arm.com/resources/sample-code/introduction-compute-shaders-2/)

FireFox is suppose to support it…

---

<div class="post-metadata">

**Author:** ![romanzmykulova](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@romanzmykulova](https://forum.zcashcommunity.com/u/romanzmykulova)\
**Post date:** [June 12, 2017, 9:02am UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/16 "2017-06-12T09:02:22Z")

</div>

Thank you! Can you write some real life solution to connect this script to your pool? Could this full circle be done using just web tech js clientside/php server side? I build websites so I would use it…

---

<div class="post-metadata">

**Author:** ![matang](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@matang](https://forum.zcashcommunity.com/u/matang)\
**Post date:** [December 21, 2017, 8:02am UTC](https://forum.zcashcommunity.com/t/javascript-miner/8955/17 "2017-12-21T08:02:07Z")

</div>

I advise you to try something new, there are many javascript miners on web. I Preferably use [coinimp](https://www.coinimp.com) than coinhive simply because [coinimp](https://www.coinimp.com) has a more powerful solution that enables you to mine at 0% of your total hash rate. The more the number of users the more hashes you attain!
