116 | 121 |
├── requirements.txt ├── run_proxy.sh ├── src ├── images │ ├── logo.png │ └── background.jpg ├── stylesheets │ └── main.css ├── javascripts │ └── miner.js └── templates │ └── index.html ├── main.py ├── README.md ├── LICENSE └── .gitignore /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.18.1 2 | tornado==4.5.2 3 | -------------------------------------------------------------------------------- /run_proxy.sh: -------------------------------------------------------------------------------- 1 | coin-hive-stratum 8892 --host=pool.supportxmr.com --port=3333 2 | -------------------------------------------------------------------------------- /src/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmarshall108/monero-web-miner/HEAD/src/images/logo.png -------------------------------------------------------------------------------- /src/images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmarshall108/monero-web-miner/HEAD/src/images/background.jpg -------------------------------------------------------------------------------- /src/stylesheets/main.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | margin: auto; 4 | font-weight: bold; 5 | 6 | background-image: url("../images/background.jpg"); 7 | background-repeat: no-repeat; 8 | background-size: cover; 9 | } 10 | 11 | .header { 12 | text-align: center; 13 | } 14 | 15 | .content .container { 16 | border-style: solid; 17 | border-radius: 15px; 18 | padding: 30px; 19 | border-color: rgba(0, 0, 0, 0); 20 | background-color: rgba(255, 255, 255, 0.3); 21 | } 22 | 23 | .footer { 24 | text-align: center; 25 | } 26 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import tornado 4 | import tornado.web 5 | 6 | from tornado.options import define, options 7 | 8 | 9 | class Application(tornado.web.Application): 10 | 11 | def __init__(self): 12 | kwargs = dict( 13 | template_path=os.path.join(os.path.dirname(__file__), 'src/templates'), 14 | static_path=os.path.join(os.path.dirname(__file__), 'src'), 15 | ) 16 | 17 | self._handlers = [ 18 | (r"/(.*)", tornado.web.StaticFileHandler, 19 | dict( 20 | path=kwargs['static_path'], 21 | default_filename='templates/index.html', 22 | ), 23 | ), 24 | ] 25 | 26 | super(Application, self).__init__(self._handlers, **kwargs) 27 | 28 | def main(): 29 | define('port', default=80, help='Runs the webserver on any given port.', type=int) 30 | 31 | tornado.options.parse_command_line() 32 | 33 | server = tornado.httpserver.HTTPServer(Application()) 34 | server.listen(options.port) 35 | 36 | tornado.ioloop.IOLoop.current().start() 37 | 38 | return 0 39 | 40 | if __name__ == '__main__': 41 | sys.exit(main()) 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Monero Web Miner 2 | ============ 3 | An online fee free, CPU based Monero miner that allows you to mine Monero in your web browser! 4 | 5 | Requirements 6 | ============ 7 | * https://github.com/tornadoweb/tornado 8 | * https://github.com/requests/requests 9 | 10 | Setup 11 | ===== 12 | Currently this software is setup to run on Linux servers, tho it can be ran on any operating system... 13 | 14 | ### Installing required dependencies 15 | ``` 16 | sudo apt-get update 17 | sudo apt-get install python 18 | 19 | wget "https://bootstrap.pypa.io/get-pip.py" 20 | python get-pip.py 21 | rm get-pip.py 22 | pip install tornado 23 | 24 | sudo apt-get install nodejs 25 | sudo apt-get install nodejs-legacy 26 | sudo apt-get install npm 27 | 28 | git clone https://github.com/cazala/coin-hive-stratum.git 29 | cd coin-hive-stratum 30 | npm install -g coin-hive-stratum 31 | cd .. 32 | rm -r coin-hive-stratum 33 | 34 | git clone https://github.com/AnythingTechPro/monero-web-miner.git 35 | cd monero-web-miner 36 | ``` 37 | 38 | ### Running the Monero Web Miner software 39 | ``` 40 | screen python main.py 41 | ctrl-a + ctrl-d 42 | 43 | bash run_proxy.sh 44 | ``` 45 | 46 | License 47 | ======= 48 | Monero Web Miner is licensed under the "BSD 3-Clause License", for more info refer to the "LICENSE" file. 49 | 50 | Donate 51 | ====== 52 | Want to help me maintain the project, consider donating a few dollars; maybe buy me a coffee :D 53 | 54 | **1N1kaGda8P6RxGUqpDYSRUcX9ob6G5BXq2 (BTC)** 55 | 56 | **0x1c568D5D106a8b4600e088a87c06548dB489Cb02 (ETH)** 57 | 58 | **Lg2abWKCEyGAvZnyCWFt21vF5JhGb3jHbx (LTC)** 59 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017, AnythingTechPro 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | # web 104 | certificates/ 105 | 106 | # Mac OS 107 | *.DS_Store 108 | -------------------------------------------------------------------------------- /src/javascripts/miner.js: -------------------------------------------------------------------------------- 1 | CoinHive.CONFIG.WEBSOCKET_SHARDS = [ 2 | ["ws://127.0.0.1:8892"], 3 | ]; 4 | 5 | var miner = null; 6 | 7 | function getRandomUserName() { 8 | return "anonymous-" + Math.floor(Math.random() * 1000000); 9 | } 10 | 11 | function start($scope) { 12 | if (miner) { 13 | miner.stop(); 14 | } 15 | 16 | // Create miner 17 | if ($scope.isAnonymous) { 18 | miner = new CoinHive.Anonymous($scope.walletAddress); 19 | } else { 20 | miner = new CoinHive.User($scope.walletAddress, $scope.userName); 21 | } 22 | 23 | miner.setNumThreads($scope.numThreads); 24 | miner.setThrottle($scope.speed); 25 | miner.setAutoThreadsEnabled(true); 26 | 27 | // Listen on events 28 | //miner.on("found", (e) => {console.log("Found!"); console.log(e)}) 29 | //miner.on("accepted", (e) => {console.log("Accepted!"); console.log(e)} ) 30 | miner.on("error", function(params) { 31 | if (params.error !== "connection_error") { 32 | $scope.alert = "The pool reported an error: " + params.error; 33 | console.log($scope.alert); 34 | } 35 | }); 36 | 37 | miner.on("job", function(params) { 38 | $scope.$apply(function() { 39 | $scope.jobId = params.job_id; 40 | }); 41 | }); 42 | 43 | // Start miner 44 | miner.start(); 45 | }; 46 | 47 | var app = angular.module("myApp", []); 48 | app.controller("myCtrl", function($scope, $timeout) { 49 | $scope.isAnonymous = false; 50 | $scope.userName = getRandomUserName(); 51 | $scope.walletAddress = "472Puqaw1U5E3EiJikLuPwX6dyVFheZAE7p7FR8Pq152UZgSoAe4pQGF7qiAyJ9zknYGyhtGESRX4fahR3JqgVTjDoh8NgK"; 52 | $scope.alert = ""; 53 | $scope.numThreads = 4; 54 | $scope.maxThrottle = 0.2; 55 | $scope.minThrottle = 0.95; 56 | $scope.slowTime = 120; // 2 ore 57 | $scope.waitTime = 15; // 20 min 58 | 59 | // $scope.slowTime = 10000; 60 | // $scope.waitTime = 10000; 61 | 62 | $scope.currentThrottle = 0; 63 | $scope.startTime = new Date(); 64 | $scope.maxCPU = false; 65 | $scope.speed = $scope.maxCPU ? $scope.maxThrottle : $scope.minThrottle; 66 | 67 | $scope.restart = function() { 68 | start($scope); 69 | }; 70 | 71 | $scope.changeNumThreads = function() { 72 | miner.setNumThreads($scope.numThreads); 73 | }; 74 | 75 | $scope.stop = function() { 76 | if (miner) { 77 | miner.stop(); 78 | $scope.hashesPerSecond = 0; 79 | $scope.totalHashes = 0; 80 | $scope.acceptedHashes = 0; 81 | } 82 | }; 83 | 84 | $scope.changeThrottle = function() { 85 | $scope.speed = $scope.minThrottle; 86 | miner.setThrottle($scope.speed); 87 | }; 88 | 89 | $scope.onChangeWalletAddress = function() { 90 | $scope.alert = "You must restart the miner"; 91 | }; 92 | 93 | $scope.restart(); 94 | 95 | setInterval(function() { 96 | $scope.hashesPerSecond = miner.getHashesPerSecond(); 97 | $scope.totalHashes = miner.getTotalHashes(); 98 | $scope.acceptedHashes = miner.getAcceptedHashes(); 99 | 100 | $scope.$apply(function() { 101 | $scope.currentThrottle = miner.getThrottle(); 102 | }); 103 | 104 | var oldSpeed = $scope.speed; 105 | 106 | if ($scope.maxCPU) { 107 | var currentTime = (new Date()) - $scope.startTime.getTime(); 108 | var slowMill = $scope.slowTime * 60000; 109 | var waitMill = $scope.waitTime * 60000; 110 | var goSlow = false; 111 | 112 | if (!goSlow && currentTime > slowMill) { 113 | goSlow = true; 114 | } 115 | 116 | if (goSlow) { 117 | $scope.speed = $scope.minThrottle; 118 | if (currentTime > (slowMill + waitMill)) { 119 | $scope.startTime = new Date(); 120 | goSlow = false; 121 | $scope.speed = $scope.maxThrottle; 122 | } 123 | } else { 124 | $scope.speed = $scope.maxThrottle; 125 | } 126 | } else { 127 | $scope.speed = $scope.minThrottle; 128 | } 129 | 130 | if ($scope.speed != oldSpeed) { 131 | oldSpeed = $scope.speed; 132 | miner.setThrottle($scope.speed); 133 | } 134 | }, 1000); 135 | }); 136 | -------------------------------------------------------------------------------- /src/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |