From 5346e7ae01970f776905595fb4aba08b70a52b9f Mon Sep 17 00:00:00 2001 From: nicehashdev Date: Fri, 19 May 2017 14:44:25 +0200 Subject: [PATCH] to v1.2.1a --- LICENSE_BOOST.txt | 24 ++ README.md | 38 ++- amd/start-admin.bat | 71 ++++ ..._example.json => default_command_file.json | 0 excavator+web+restart_script.bat | 28 ++ excavator-man-API.txt | 2 +- web/index.html | 312 ++++++++++++++++++ 7 files changed, 465 insertions(+), 10 deletions(-) create mode 100644 LICENSE_BOOST.txt create mode 100644 amd/start-admin.bat rename command_file_example.json => default_command_file.json (100%) create mode 100644 excavator+web+restart_script.bat create mode 100644 web/index.html diff --git a/LICENSE_BOOST.txt b/LICENSE_BOOST.txt new file mode 100644 index 0000000..7925d62 --- /dev/null +++ b/LICENSE_BOOST.txt @@ -0,0 +1,24 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md index bc72606..7dda102 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,23 @@ # NiceHash Excavator -Excavator is GPU miner by NiceHash for mining various altcoins on NiceHash.com. Excavator is being actively developed by djeZo and zawawa. Miner is using custom built code base with modern approach and supporting modern video cards - NVIDIA and AMD. For AMD support, please see [AMD readme](amd/README.md) for important details. +Excavator is GPU miner by NiceHash for mining various altcoins on [NiceHash.com](https://www.nicehash.com). Excavator is being actively developed by djeZo and zawawa. Miner is using custom built code base with modern approach and supporting modern video cards - NVIDIA and AMD. For AMD support, please see [AMD readme](amd/README.md) for important details. Download from here: https://github.com/nicehash/excavator/releases + # How to use Excavator? -Simple: No simple usage; Excavator can be only used by mining experts! +**ADVANCED** There are two methods to use Excavator. Both rely on API commands you can find in file [excavator-man-API.txt](excavator-man-API.txt). Do note that API manuals are still being created and that is just an incomplete draft so far. -Advanced: There are two methods to use Excavator. Both rely on API commands you can find in file [excavator-man-API.txt](excavator-man-API.txt). Do note that API manuals are still being created and that is just an incomplete draft so far. +1. Using API port or HTTP API; for that, you need an application that will pass commands to the Excavator. We do not provide any such application (except [web example](/web)), nor there is any public source code available (yet). -1. Using API port; for that, you need an application that will pass commands to the Excavator. We do not provide any such application, nor there is any public source code available (yet). The API works over standard TCP port and is JSON-message based with '\n' terminated messages. Do note that once you build up such application, you virtually have no limits anymore. You can truly optimize your mining to the max; you can launch various algorithms (at the same time), you can randomly assign workers (turn devices on off), do dual/triple mining, algorithm switching, adjusting TDPs, core or memory clock and fan speeds. Additionally to that, you can also read various GPU parameters and algorithm speeds reached by GPUs. + The API works over standard TCP port and is JSON-message based with '\n' terminated messages. Do note that once you build up such application, you virtually have no limits anymore. You can truly optimize your mining to the max; you can launch various algorithms (at the same time), you can randomly assign workers (turn devices on off), do dual/triple mining, algorithm switching, adjusting TDPs, core or memory clock and fan speeds. Additionally to that, you can also read various GPU parameters and algorithm speeds reached by GPUs. Default API bind port is 3456, but you can change it with '-p' command line parameter. -2. Using start-up commanding file. See example [command_file_example.json](command_file_example.json). + HTTP API is disabled by default. You can enable it by configuring [command line parameters](#cmdline). + +2. Using start-up commanding file. See example [default_command_file.json](default_command_file.json). File contains a JSON array of all actions that would happen during runtime of Excavator. Each array item has two mandatory fields and one optional. Mandatory is 'time' which tells you after how many seconds since start of Excavator commands should execute and 'commands' which is a JSON array of commands you can find in [excavator-man-API.txt](excavator-man-API.txt). @@ -26,23 +29,30 @@ Advanced: There are two methods to use Excavator. Both rely on API commands you to retreive all available devices and their IDs. After you have your commanding file ready, use '-c' command line switch to provide file name when starting Excavator. + + We suggest using [excavator+web+restart_script.bat](excavator+web+restart_script.bat) that automatically launches web browser displaying status and has a restart script to put Excavator back on if it crashes. Excavator also supports configuring console logging level and file logging level. Level '0' means full detail logging, level '6' means no logging. By default console logging is set to '2', file logging set to '6'. You can change file logging with '-f' and console logging with '-d' command line parameters. To get details about specific algorithms that are available in Excavator, check [AMD information](/amd) or [NVIDIA information](/nvidia). -Excavator needs [Microsoft Visual C++ 2013 redistributable (x64)](https://www.microsoft.com/en-us/download/details.aspx?id=40784). +Excavator contains HTTP server. Currently, it can serve API commands and is by default disabled. You can enable it by configuring HTTP bind port ('-wp'). API is available at URL: -# Command line parameters +> http://bind-ip:bind-port/api?command={JSON-command-here} + + +# Command line parameters Parameter | Range | Description | Default -----------------|----------|----------|--------- -h | none | Displays help; details about all supported command line parameters | --p | 1-65535 | API bind port | 3456 +-p | 0-65535 | API bind port; set to 0 to disable API | 3456 -i | local IP | API bind IP | 127.0.0.1 +-wp | 0-65535 | HTTP API bind port | 0 +-wi | local IP | HTTP API bind IP | 127.0.0.1 -d | 0-6 | Console log level | 2 -f | 0-6 | File log level | 6 --c | file name | Use commanding file; no API is available | +-c | file name | Use commanding file | # Additional notices @@ -52,6 +62,16 @@ WARNING! Excavator supports overclocking. Use overclocking at your own risk. OVE # Changelog +v1.2.1a +- support for API and commanding file at the same time +- added commanding file event: on_quit +- fixed connection bug +- added HTTP server for API commands +- fixed a bug in phymem.sys +- optimized equihash OpenCL kernel +- added API method: info +- general fixes and improvements + v1.2.0a - changed commanding interface to JSON based messages over startup file or API - CUDA: added decred diff --git a/amd/start-admin.bat b/amd/start-admin.bat new file mode 100644 index 0000000..db95ddd --- /dev/null +++ b/amd/start-admin.bat @@ -0,0 +1,71 @@ +:::::::::::::::::::::::::::::::::::::::::::: +:: Elevate.cmd - Version 4 +:: Automatically check & get admin rights +:: Obtained from: http://stackoverflow.com/questions/7044985 +:: Licensed under: https://creativecommons.org/licenses/by-sa/3.0/ +:::::::::::::::::::::::::::::::::::::::::::: + @echo off + CLS + ECHO. + ECHO ============================= + ECHO Running Admin shell + ECHO ============================= + +:init + setlocal DisableDelayedExpansion + set cmdInvoke=1 + set winSysFolder=System32 + set "batchPath=%~0" + for %%k in (%0) do set batchName=%%~nk + set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" + setlocal EnableDelayedExpansion + +:checkPrivileges + NET FILE 1>NUL 2>NUL + if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) + +:getPrivileges + if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) + ECHO. + ECHO ************************************** + ECHO Invoking UAC for Privilege Escalation + ECHO ************************************** + + ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" + ECHO args = "ELEV " >> "%vbsGetPrivileges%" + ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" + ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" + ECHO Next >> "%vbsGetPrivileges%" + + if '%cmdInvoke%'=='1' goto InvokeCmd + + ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" + goto ExecElevation + +:InvokeCmd + ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%" + ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%" + +:ExecElevation + "%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %* + exit /B + +:gotPrivileges + setlocal & cd /d %~dp0 + if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) + + :::::::::::::::::::::::::::: + ::START + :::::::::::::::::::::::::::: + + setx GPU_FORCE_64BIT_PTR 1 + setx GPU_MAX_HEAP_SIZE 100 + setx GPU_USE_SYNC_OBJECTS 1 + setx GPU_MAX_ALLOC_PERCENT 100 + setx GPU_SINGLE_ALLOC_PERCENT 100 + if exist ..\excavator.exe ( + ..\excavator -c ..\default_command_file.json + ) else ( + excavator -c default_command_file.json + ) + pause diff --git a/command_file_example.json b/default_command_file.json similarity index 100% rename from command_file_example.json rename to default_command_file.json diff --git a/excavator+web+restart_script.bat b/excavator+web+restart_script.bat new file mode 100644 index 0000000..edb5f2a --- /dev/null +++ b/excavator+web+restart_script.bat @@ -0,0 +1,28 @@ +@echo off +:: CONFIG STARTS +SET COMMAND_FILE=default_command_file.json +SET CONSOLE_LOG_LEVEL=2 +SET FILE_LOG_LEVEL=6 +SET WEB_PORT=38080 +SET WEB_HOST=127.0.0.1 +SET WEB_LAUNCH_DELAY=5 +SET RESTART_DELAY=10 +:: CONFIG ENDS + +:: AMD SPECIFIC SETTERS (DO NOT MODIFY!) +SET GPU_FORCE_64BIT_PTR=1 +SET GPU_MAX_HEAP_SIZE=100 +SET GPU_USE_SYNC_OBJECTS=1 +SET GPU_MAX_ALLOC_PERCENT=100 +SET GPU_SINGLE_ALLOC_PERCENT=100 + +echo Welcome to NiceHash Excavator +echo Opening website +start cmd /c "@echo off & echo Please, wait %WEB_LAUNCH_DELAY% seconds for Excavator status page to open... & ping 127.0.0.1 -n %WEB_LAUNCH_DELAY% > nul & if "%WEB_HOST%"=="0.0.0.0" (explorer http://127.0.0.1:%WEB_PORT%) else (explorer http://%WEB_HOST%:%WEB_PORT%) & exit" + +:start +echo Starting Excavator... +excavator.exe -c %COMMAND_FILE% -d %CONSOLE_LOG_LEVEL% -f %FILE_LOG_LEVEL% -p 0 -wp %WEB_PORT% -wi %WEB_HOST% +echo Excavator has crashed... restarting in %RESTART_DELAY% seconds... +ping 127.0.0.1 -n %RESTART_DELAY% > nul +goto start \ No newline at end of file diff --git a/excavator-man-API.txt b/excavator-man-API.txt index d023f82..a5e8e53 100644 --- a/excavator-man-API.txt +++ b/excavator-man-API.txt @@ -41,7 +41,7 @@ Description: Sets TDP for certain device. Provided TDP is in % of default TDP. D Param 1: Device ID Param 2: TDP in % -Example send: {"id":2,"method":"device.set.power_limit","params":["0","80"]} +Example send: {"id":2,"method":"device.set.tdp","params":["0","80"]} diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..ef89162 --- /dev/null +++ b/web/index.html @@ -0,0 +1,312 @@ + + + +Excavator by NiceHash + + + + + + + + + +
+
+

Excavator

+

by NiceHash

+
+
+ + + + + + \ No newline at end of file