Hacker News new | past | comments | ask | show | jobs | submit login
XMR mining app, built with Vue.js, D3 and CoinHive (github.com/bradoyler)
133 points by bradoyler on Dec 18, 2017 | hide | past | favorite | 70 comments



This is really cool. I didn't know about CoinHive. It looks like it's a sort of profit sharing setup with CoinHive, who provides all the technical bits.

Another option is to build your own. I published one of the more unapproachable aspects, which is an Emscripten-compiled implementation of the Cryptonight hash function [0]. One could slap a basic WebSocket proxy on top of existing mining server, and the adding the coordination logic in Javascript in the client.

[0]: https://github.com/noahdesu/xmonarch


TY. Will take a look.


Does the value of XMR mined exceed the electricity consumed by the app?

There are already malicious websites using hidden windows to mine XMR, but to the benefit of the person in control of the site rather than the people who pay the electricity bills:

https://arstechnica.com/information-technology/2017/11/sneak...


In general, any PoW-cryptocoin quickly reaches an equilibrium with its costs. Changes in the difficulty, changes in the exchange rate (usually as a function of changing demand), changes in availability of current/next-generation mining hardware will destabilize this equilibrium temporarily.

The answer to the question "should I mine [coin x]" in order to make money is usually "no". You should mine that coin because you care about the network's security and decentralization or not at all. If you have access to next-generation mining hardware or cheaper-than-normal electricity, you might have a case for "yes". Or, as you indicate, if you have a malicious way to run the miner or mostly-malicious-"not-too-clearly-disclosed-to-end-user", that is almost certain to make money.


That's not necessarily true, assuming you believe the value of what you're mining will at some point in the future be worth more than it is now. I mined some Ethereum earlier in the year, and was making around $6 AUD a day.

I stopped as I was unhappy with the effects of proof of work on electricity supply and the wear on my GPU, but the amount I mined at current market price is worth around 3x that, making it quite a bit more profitable.

Of course, if you believe the value will increase at some future point you're most likely better off just buying the coin and hodling it :)


If the cost exceeds the value of what you're mining, you're always better off putting that money directly into purchasing the cryptocoin instead.

Option 1: Spend $10 to mine $5 worth of BTC

Option 2: Spend $10 to obtain $10 worth of BTC

If the market goes up, you are better served by the latter option.


If you care about privacy normally mining your own coins it's the best way to get 100% privacy.


More like spend $500 for a graphics card and end up with a graphics card and $2000 in bitcoin


Nevermind the hardware, the electricity to run the hardware costs more than the coin generated.


Maybe for XMR but not in general


And $2000 in electricity bills


Nah whattomine.com shows plenty of profitable coins to mine even if you assume California electricity costs and no price appreciation after mining.


> Of course, if you believe the value will increase at some future point you're most likely better off just buying the coin and hodling it :)

I think this is the key point. If it costs more in electricity than the current value it is cheaper and easier to just buy some.


I really wanted to get into mining BTC for awhile now and I see that ETH has a good reward rate relative to BTC. I pay no electricity so there probably is no reason not to, right? Does the GPU get worn down a lot? I have a 980 TI.


The 900 series is not really worth using but since you pay nothing for elect I City you might make a few bucks over the month. All depends on your hash rate and what pool you’re in. My gtx 1080 pulls about 20mhs and at the current price that’s close to 60-70 dollars a month.


Isn't that a bit low for a 1080? I'm only asking because I know for sure that a 1060 does 19MH/s. What pool are you in?


1080 isn't as good as the 1060/1070 due to the type of memory used. Excellent for gaming, not quite the best for mining. I can probably get it up a little more if I overclocked but I'd rather not.

Im using nanopool right now.


Oh that's cool! I did not know that.


There aren't enough altruistic people to make the blockchain trustworthy. Profit motive is the entire driving force behind the trust model of bitcoin, et al.


You've got that exactly backwards. The profit motive being predictable is what every market based economy heavily counts on. Which is to say, most of the world's economic activity relies upon the profit motive as the foundation of trust.

Hundreds of trillions in global wealth and $100 trillion in annual economic output are powered by very predictable self-interest. You can build trust networks around it and you can build regulations based on it, precisely because it's extraordinarily predictable and universal to the extent necessary for the whole system to function with billions of participants.


I think you're both partially right. Profit motive is what drives people, but profit margins will be shrunk so in an established mining ecosystem like bitcoin you probably aren't going to make any profit (after accounting for opportunity costs).


A healthy coin depends on a balanced ecosystem of miners and users. If mining becomes unprofitable then the ecosystem will collapse. But if its a coin that miners have significant interest or investment in and they see profitability decreasing due to energy costs, they will be incentivised to find cheaper sources of energy. This likely explains why so many bitcoin mines in china are located near renewable energy sources.


It doesn't collapse. Mining might become unprofitable for some miners. They will drop out and the difficulty will decrease. Other miners are still profitable. Once decreased they or other miners might become profitable and start mining thus increasing the difficulty.

It's an equilibrium.


Mining will be in an equilibrium, but the equilibrium might be at a point, where the network can not be protected from a 51% attack.

Currently, it will cost around $2bn to buy the hashing power to control Bitcoin - that's the price of one Stealth Bomber.


Any point could be the point it can not be protected from a 51% attack.

So what if the bitcoin hash rate drops to say even 10% of current levels. Yes, it'll be way easier for other actors to come back and control 51% but you made my point: that can be done right now for $2bn.

No one ever talks about the fallout effects if a 51% attack does occur.

First of all, we can detect double spends. We have the complete history and just because the head chain was changed doesn't mean the old chain was forgotten.

The mere act of performing a 51% attack becoming public knowledge will crash the price and now the attacker gets devalued coins. Might not even be worth it.

Secondly, 51% attacks are hard. I don't know where you got the $2bn number above but I'm guessing its the equivalent of the current network hash rate.

To double spend a transaction 6 blocks back that means you need to mine 7 blocks before the other 49% of the network mines 1 block.

I choose 6 blocks back as thats the number of blocks most software/people consider needed to consider a transaction confirmed. With bitcoin's target of 10mins/block that is one hour of transactions.

It seems that 51% attack really requires a 7/8 = 87.5% attack. *

* Technically this only needs to be sustained until caught up with the current head chain length and then you can resume 51%.


The network hash rate is roughly equivalent to 1M Antminer S9 rigs, which would cost something around $2bn, perhaps $3bn.

Your attack scenario assumes an attacker who wants to extract a financial gain from his advantage while keeping a long position.

However, there are scenarios where an attack might benefit from a crashing bitcoin or the ability to deliver a plausible threat to trigger that crash

An example could be a nation state who would like to remind its negotiating partner, how easily they could establish control over a network that holds a substantial amount of foreign wealth. China obviously. Another one would be an investor who wants to short bitcoin in a massive scale (This has been done before, think of George Soro's 10bn GBP bet against the Bank of England)

Crashing seems a lot easier that trying to double spend. A majority hasher could simply ignore all blocks that are generated from the minority and mine only their own blocks, containing nothing but dummy transactions between the attackers wallets. The minority miners would at a 50% chance mine a new "honest" block and at 50% mine an attackers block, giving the attackers blockchain an 75 over 25 advantage. Since there are no real transactions in the attackers blocks, there would be no way to move bitcoins around anymore, holding them literally hostage.

If there is a way to make a profit from a large scale attack, then that large scale attack will be made some day.


Several profitable altcoins are attackable right now if you count a pool controlling 51%. It's not like they're going to flex that power, or even know how to.

Difficulty curves and such cause great opportunity for smart miners, especially now that Nicehash is offline.


This is true about non-memory hard coins, as almost all the first gen coins were. This might not be true about memory hard coins like XMR, especially when HBM2 chips cannot be manufactured quickly enough and raw compute power does very little as a mining power multiplier.


>Does the value of XMR mined exceed the electricity consumed by the app?

Yes: https://whattomine.com/coins

Actually, I'm using a computer mining Moneros at 2000H/s in a closed room to help dry a damp wall. The rig converts 250W Power to heat (for the wall) and produces Moneros worth $200/m - leaving me $100 after paying for electricity the computer and the air dehumidifier consumed.


>Moneros worth $200/m

Assuming m = Monero I think you will be in for a good surprise.

https://www.tradingview.com/symbols/XMRUSD/


I think he means per month.


> Does the value of XMR mined exceed the electricity consumed by the app?

Extremely unlikely. Even GPU mining with good hardware cuts it close with energy consumption depending on your energy costs.


Actually both GPU and CPU mining is generally profitable compared to the energy costs, of course depending on your rate.

But then there's the cost of the hardware which may be difficult to recoupe.


This is just not true for basically all of 2017 with the rate at which the value of all the coins has been rising. Especially if it is your desktop on off hours so the hardware is essentially a sunk cost.


> Extremely unlikely. Even GPU mining with good hardware cuts it close with energy consumption depending on your energy costs.

What? This is seriously wrong. ROI fluctuates between 200-600% for XMR and its derivatives.


I don’t currently mine, but everything I’ve been reading has roughly 2/3rds of your profit going towards electricity.

Regardless, I find it hard to believe CPU mining using JavaScript in a browser is even remotely energy efficient.


At 12c/kwh with a Radeon RX Vega56 consuming 200W and a hashrate of 2000 h/s, mining XMR currently yields has a 61% profit margin; it's 79% ROI if you are getting free power.

This is not the most power efficient setup (as I said, there are far, far more efficient cards, especially when run in tandem) but it is the most sought-after card due to density. Regardless, it's exceptionally profitable to mine if you already own the card.

JS mining only takes a slight performance hit compared to native, actually; asm.js and others provide very good results since the problem is memory-hard, not computationally bound. It is definitely energy efficient and worth doing if all you care about is ROI vs. marginal utility rates in most American cities (perhaps not some of California). Nicehash built their business model around exactly that, which is the real reason people like libraries like the OP's - it's a distributed way to get people mining, not for the individual person themselves.


In that case, thanks for the correction. I suppose I made my original comment with a lot of assumptions that may be less true than I would have thought.


No problem, thanks for being open minded. It won't last forever... probably. However, this is a lot different than BTC mining due to memory hardness.


Radeon Vega64 is insane. Sold out everywhere I’ve seen.


The 64s are occasionally available, the 56s, no shot. Glad I got 7 close to MSRP when I did. There are actually more power efficient alternatives that hash better per dollar assuming that the price of a Vega is $600+, which it easily is. Just requires some heavy lifting.


> Does the value of XMR mined exceed the electricity consumed by the app?

There seems to be a bit of disagreement over this.

Let me ask it another way, would it be worthwhile for someone too lazy to replace the dead battery in their thermostat to mine some coins to add a little heat to their apartment and make a couple bucks in the process?


It is not a 'mining app' but a front-end nobody needs.

Is there any coinhive alternative? That would be a progress.


Are there any that let me specify what percentage to give to the devs?



https://monad.network/ Coming up pretty nicely, been working with them for some time.


Sadly, like all the other clones, they just "stole" the Cryptonight WASM implementation from Coinhive.

Think about it: they're hosting a WASM blob on their site for which they don't have the source code and can't tell with certainty what exactly it's doing.

With so many faces on their team page (and a dog!), you'd think they'd have the resources and competence to build something of their own.


And they aren't saying a single word about what fees they take and they offer no easy way to ask for user's permissions.


Isn't that IP theft?


http://xmr.cpufan.club/

It should take only 1% of profit instead of CoinHives 30%.


Wouldn't a user mining for themselves use a desktop program miner? Coinhive has the overhead of running in a browser and takes 30% of the haul.


There are ways to connect the miner to other pools, a desktop miner would be more effective.

https://github.com/cazala/coin-hive-stratum


Thx y'all. Im getting about 500 H/s right now.


hn hug on its best


hardware?


It's from folks visiting his site. (Linked.)


This is giving me major idle/incremental game vibes. This could so easily be converted into an interesting incremental experience.


So this is how paperclips makes their moolah... ^_^



Agree that some sort of game theory is the next step.


Funny side question. Is there any crypto currency that it’s worth mining as a non consortium these days? I used to do bitcoin way back in the day but I’m curious if any of the other currencies are worth enough to make it worthwhile.


monero is where it's at imho


... especially if Coinbase decides to add XMR as their 4th menu item


BCH expected to be 4th since they made written commitment about letting people get at their forked BCH. Adding an order book along with it is common sense.


Seems like an odd choice. It's specifically a privacy coin, not meant to be centralized.


Adding a fiat on/off ramp doesn't make a coin centralized.

As for privacy, that's okay too. Once you send Monero to your own wallet, Coinbase has no idea what you do with it afterwards, just like withdrawing cash from a bank.


Agreed. ASIC resistance + anonymity are killer features for any alt-coin, rn.


I hope at your day job, if you are a programmer at all, you don't write commit messages like the ones in the repo.


Yes, i do. And we’re hiring!


Nothing wrong with them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: