Recently, I saw a kind of mining using web JavaScript, and I would like to introduce it to you. Java is embedded in the web page, and once the user opens the website, the browser will turn into a Monero miner according to the script's instructions. This additional mining code usually takes up a lot of CPU, causing the user's computer to freeze or even fail to use normally.
Such a website will embed the Coinhive Java Miner code. The code is based on the CryptoNight mining algorithm, which can produce CryptoNote network currencies such as Monero, Dashcoin, DarkNetCoin, etc. The embedded Coinhive Java Miner only supports Monero mining.
So how do you get JS scripts to mine? There are a few more steps in between. I personally don't approve of this practice of sacrificing user experience to mine websites without user consent. It is very interesting to understand the implementation method and develop ideas. The following is an introduction to the specific operation.
(Note: 30% of the income you get from mining with the following js will be given to the developer, so you can only get 70% of the profit)
1. Register a Monero wallet and obtain the wallet address
Wallet download URL: https://getmonero.org/downloads/
Just download the corresponding program according to your system. I'm using Mac OS X, 64-bit
Software size: 157.9M
1. Create a new wallet
Just follow the prompts step by step
2. The final setting is successful
3. The final application interface is as follows:
Pay attention to your payee address, which will be used later
2. Register a mining platform
Registration link: https://coinhive.com/account/signup
1. Register an account
2. Go to Settings - > set the payment information
The address here is your wallet address
3. Set API Keys
This key will be used later to obtain the mining code
3. Get the mining code
Get code address: https://coinhive.com/documentation/miner
The resulting JS code looks like this:
I wrote a very simple html page that you can download and run or refer to,
Download address: http://oyim09vvu.bkt.clouddn.com/xmr.html
4. Operation effect You can see that the CPU has skyrocketed significantly, and when the web page is closed, it immediately drops
At this point, you can check the mining progress on the Dashboard.
Visited at https://coinhive.com/dashboard
The current price of Monero is around ¥579
Finally, that's all for the introduction. This idea of using JS mining is quite interesting as a web developer. A piece of code can integrate a large number of online resources. However, this method does not inform users when browsing, reduces the user's experience, and cannot be widely promoted and used. The next time you open a web page, if the CPU fan is spinning wildly, maybe you can open the developer tools to see if the site is secretly using you to mine and understand the doorway.
|