Are there any open source solutions for mining bitcoins using WebAssembly?

Viewed 2474

I'm a little late to the game, but I just learned about Web Assembly and am considering using this to mine bitcoin instead of serving ads (which tend to expose a user's identity/data). I have never mined bitcoin and haven't learned Web Assembly yet, so it would be convenient to have an open source solution for this to begin my learning. Does anyone know of an open-source project for this? (Preferably written in Java or C#)

I did find this: https://github.com/altermarkive/JavaScript-Emscripten-Bitcoin-Miner/blob/master/native/miner.c But honestly, I'm not sure if it's what I need and it doesn't seem to create a web assembly, but a javascript.

2 Answers

Contrary to what David Schwartz says, there are a significant number of people that think using WebAssembly to mine cryptocurrency on the web does make sense. A recent study found that 1 in 600 of the top 1,000,000 websites on the internet use WebAssembly. They estimated that approx. 50% of these sites were using it for cryptocurrency mining.

The paper points to CoinHive as the mining software often used for this purpose. It compiles to both WebAssembly and asm.js. However, I would strongly warn against going down this route. Hijacking a user's CPU cycles without consent is widely considered malicious.

Finally, there is anecdotal evidence that ventures of this type don't really make much money.

So - unless you've got an incredibly popular site, and you're willing to ask your users whether it's OK to mine on their hardware, I wouldn't even bother.

(and you're not going to find a Java or C# miner either, they require garbage collection so will be bloated and slow)

No, that wouldn't make any sense. Users aren't going to be browsing your web site using a bitcoin miner, they're going to be browsing using a general purpose computer. General purpose computers are so bad at mining bitcoins there's really no point in doing something like this. If you did go to all the trouble, you would likely materialize zero revenue because no machine would ever mine enough to even cover the fees associated with transferring the value of the mining to you.

Related