Complete sources for a monero (aeon) webminer. Hard fork (v7) ready. Try it here:
The server is written in C#, optionally calling C-routines to check hashes calculated by the clients. It acts as a proxy server for common pools.
The SDK directory contains all client site mining scripts which allow mining in the browser.
<!DOCTYPE html> <html> <body> <script src="https://webminerpool.com/webmr.js"></script> <!-- for aeon use: https://webminerpool.com/aeon/webmr.js --> <script> startMining("minexmr.com","49kkH7rdoKyFsb1kYPKjCYiR2xy1XdnJNAY1e7XerwQFb57XQaRP7Npfk5xm1MezGn2yRBz6FWtGCFVKnzNTwSGJ3ZrLtHU"); </script> </body> </html>
In this example the webminerpool.com server is used. A dynamic fee (about 4%) is used to cover hosting costs. You can also connect to your own server by altering the server variable in the script itself or using for example
<script src="webmr.js"></script> <script> server = "ws://localhost:8181" startMining("minexmr.com","49kkH7rdoKyFsb1kYPKjCYiR2xy1XdnJNAY1e7XerwQFb57XQaRP7Npfk5xm1MezGn2yRBz6FWtGCFVKnzNTwSGJ3ZrLtHU"); </script> (...)
webmr.js can be found under SDK/xmr/miner_compressed (or for Aeon SDK/aeon/miner_compressed).
The startMining function can take additional arguments
startMining(pool, address, password, numThreads, userid);
To throttle the miner just use the global variable "throttleMiner", e.g.
startMining(..); throttleMiner = 20;
If you set this value to 20, the cpu workload will be approx. 80% (for 1 thread / CPU). Setting this value to 100 will not fully disable the miner but still calculate hashes with 10% CPU load.
If you do not want to show the user your address or even the password you have to create a "loginid". With the loginid you can start mining with
or with optional input parameters:
startMiningWithId(loginid, numThreads, userid)
Get a loginid by opening "register.html" in SDK/xmr/other. You also find a script which enumerates all available pools and a script which shows you the amount of hashes calculated by a userid. These files are quite self-explanatory.
SDK/xmr/miner_compressed/webmr.js simply combines
Where miner.js handles the server-client connection, worker.js are web workers calculating cryptonight hashes using cn.js -- a emscripten generated wrapped webassembly file. The webassembly file can also be compiled by you, see "hash_cn" below.
The C# server. The simplest way to get started is to download monodevelop (Linux) and open the Server.sln solution file. The solution should build server.exe out of the box, since no extern 3rd party libraries are needed.
should run the server. Additional information will follow soon.
The monero/aeon cryptonight hashing functions in C code. With simple Makefiles for use with gcc and emcc -- the emscripten webassembly compiler. libhash should be compiled so that the server can check hashes calculated by the user.
If you find the content of this repository helpful consider a one time donation, the addresses are as follows: