This is T-Rex NVIDIA GPU miner.

We hope you enjoy our miner.
We promise to do our best to make it as	fast as possible.

However, in order to maximise the hashrate our software utilises all
available GPU resources, so it is important that you review your overclock
settings before you start mining. Our general recommendation is to start
from GPU stock settings	(no overclock, default power limit), and then after
making sure it is stable, slowly increase your overclock to find the
"sweet spot" where the miner performs at its best and still does not crash.
		

Usage of command line options
Options:
    -a, --algo                     Specify the hash algorithm to use.
                                    astralhash
                                    balloon
                                    bcd
                                    bitcore
                                    c11
                                    dedal
                                    geek
                                    hmq1725
                                    honeycomb
                                    jeonghash
                                    lyra2z
                                    mtp
                                    padihash
                                    pawelhash
                                    phi
                                    polytimos
                                    sha256q
                                    sha256t
                                    skunk
                                    sonoa
                                    tensority
                                    timetravel
                                    tribus
                                    x16r
                                    x16rt
                                    x16rv2
                                    x16s
                                    x17
                                    x21s
                                    x22i
                                    x25x
    -d, --devices                  Comma separated list of CUDA devices to use.
                                   Device IDs start counting from 0.
        --ab-indexing              Afterburner indexing (Sort devices by bus ID. First device starts with 1).
    -i, --intensity                GPU intensity 8-25 (default: auto).

    -o, --url                      URL of mining server.
    -u, --user                     Username for mining server.
    -p, --pass                     Password for mining server.
    -r, --retries                  Number of times to retry if a network call fails.
    -R, --retry-pause              Pause in seconds between retries.
    -T, --timeout                  Network timeout, in seconds (default: 300)
        --time-limit               Miner shutdown interval in seconds. (default: 0 - disabled)

        --temperature-color        Set temperature color for GPUs stat. Example: 55,65 - it means that
                                   temperatures above 55 will have yellow color, above 65 - red color. (default: 67,77)
        --temperature-limit        GPU shutdown temperature. (default: 0 - disabled)
        --temperature-start        GPU temperature to enable card after disable. (default: 0 - disabled)

    -b, --api-bind-telnet          IP:port for the miner API via telnet (default: 0.0.0.0:4068). Set to 0 to disable.
        --api-bind-http            IP:port for the miner API via HTTP (default: 0.0.0.0:4067). Set to 0 to disable.
    -J  --json-response            Telnet API server will make json responses.

    -N, --hashrate-avr             Sliding window length in seconds used to compute average hashrate (default: 60).
        --sharerate-avr            Sliding window length in seconds used to compute sharerate (default: 600).
        --gpu-report-interval      GPU stats report frequency. (default: 5. every 5th share)
    -q, --quiet                    Quiet mode. No GPU stats at all.
        --hide-date                Don't show date in console.
        --no-color                 Disable color output for console.
        --no-nvml                  Disable NVML GPU stats.
        --no-watchdog              Disable built-in watchdog.
    
    -B, --benchmark                Benchmark mode.
    -P, --protocol-dump            User protocol logging.
    -c, --config                   Load a JSON-format configuration file.
    -l, --log-path                 Full path of the log file.
        --cpu-priority             Set process priority (default: 2) 0 idle, 2 normal to 5 highest.

        --autoupdate               Perform auto update whenever a newer version of the miner is available.
        --back-to-main-pool-sec    Forces miner to switch back to main pool in case working with failover pool.
                                   Parameter is set in seconds. (default: 600)
        --exit-on-cuda-error       Forces miner to immediately exit on CUDA error.
        --exit-on-connection-lost  Forces miner to immediately exit on connection lost.
        --reconnect-on-fail-shares Forces miner to immediately reconnect to pool on N successively failed shares (default: 10).

        --fork-at                  Forces miner to change algorithm on predefined condition. 
                                   Time condition: algo_name=YYYY-MM-DDTHH:MM:SS (eg: --fork-at x16rv2=2019-10-01T16:00:00).
                                   Time must be set in UTC+0.
                                   Block condition: algo_name=integer_block_number (eg: --fork-at x16rv2=6526421).
                                   To change main pool port you must write it right after algo: algo_name:integer_port_number 
                                   (eg: --fork-at x16rv2:4081=2019-10-01T16:00:00).
                                   
        --version                  Display version information and exit.
    -h, --help                     Display this help text and exit.

=========================================== JSON CONFIG USAGE ==========================================

To start T-Rex with config file "config.txt" type in console: t-rex -c config.txt

Use "config_example" file as a starting point to create your own config.

============================================ WATCHDOG ==================================================

Watchdog is intended to observe miner state and restart T-Rex if it crashes or hungs for any reason.
Also, watchdog can optionally perform auto updates if a newer version is available.
We recommend using the watchdog to avoid any downtime in mining and make sure your GPUs are busy 24/7.

============================================ HTTP API USAGE ============================================

For HTTP API there are a few handlers available.

By default HTTP API server binds to 0.0.0.0:4067. It means that you can access your miner via both external and internal network interfaces.
Common example of request structure: http://your_ip:your_port/handler_name

==[ TREX ]==

Handler "trex" is intended to show miner control monitoring page in your web browser. You can see miner stats realtime and also change miner parameters and config on the fly. Also here you will see updates in case it appears.
To activate the handler navigate to http://127.0.0.1:4067/trex using a web browser.

==[ LOG ]==
Displays the contents of the log file (if configured).
To activate the handler navigate to http://127.0.0.1:4067/log using a web browser.

==[ CONFIG ]==

Handler "config" is intended to change your config on HDD and also change some miner parameters on the fly.
You can change multiple parameters with one request. GET and POST requests supported.
If you use config (started miner like this: t-rex.exe -c config_file) then any action with handler "config" will be saved into selected config_file.
You can use this handler for automatization purposes like changing config at runtime, shutting down the miner via API and then restarting it with new parameters applied.

GET usage examples:
1) http://127.0.0.1:4067/config?protocol-dump=true   
Will enable protocol dump on the fly and write it into config_file.

2) http://127.0.0.1:4067/config?algo=x16r&devices=0,1&intensity=20,21  
If you use config it will write the following config settings into it:
algo=x16r
devices=0,1
intensity=20,21 

3) http://127.0.0.1:4067/config?algo=x16r&devices=0,1&intensity=20,21&config=test.conf
Will save settings into the file "test.conf" which will be created in the folder where the miner resides.
algo=x16r
devices=0,1
intensity=20,21 

4) http://127.0.0.1:4067/config?config=test.conf
Will save your current miner settings into "test.conf" file.

5) http://127.0.0.1:4067/config
Will show you the current config state

6) http://127.0.0.1:4067/config?hashrate_avr=10&temperature-limit=70&temperature-start=40
Will set following parameters on the fly:
hashrate_avr=10
temperature-limit=70
temperature-start=40

POST usage examples:
For POST requests you must use correct json object with parameters you want to change.
http://127.0.0.1:4067/config
POST payload:
{
"hashrate_avr": 10,
"temperature-limit": 70,
"temperature-start": 40
}
Parameters names and types in json are identical to config json you use.


==[ SUMMARY ]==

Handler "summary" is intended to show you all information about current mining process.
To activate the handler navigate to http://127.0.0.1:4067/summary using a web browser.

Response example with comments:

{
	"accepted_count": 6,                       ----- Number of accepted shares count.
	
	"active_pool": {                           ----- Information about the pool your miner is currently connected to.
		"difficulty": 5,                       ----- Current pool difficulty.
		"ping": 97,                            ----- Pool latency.
		"retries": 0,                          ----- Number of connection attempts in case of connection loss.
		"url": "stratum+tcp://...",            ----- Pool connection string.
		"user": "..."                          ----- Usually your wallet address.
	},
	
	"algorithm": "x16r",                       ----- Algorithm which was set in config.    
	"api": "1.2",                              ----- HTTP API protocol version.
	"cuda": "9.10",                            ----- CUDA library version used.
	"description": "T-Rex NVIDIA GPU miner",
	"difficulty": 31968.245093004043,          ----- Current network difficulty.
	"gpu_total": 1,                            ----- Total number of GPUs installed in your system.
	
	"gpus": [{                                 ----- List of all currently working GPUs in your system with its stats.
		"device_id": 0,                        ----- Internal device id, useful for devs.
		"fan_speed": 66,                       ----- Fan blades rotation speed in % of the max speed.
		"gpu_id": 0,                           ----- User defined device id in config.
		"hashrate": 4529054,                   ----- Average hashrate per N sec defined in config.
		"hashrate_day": 5023728,               ----- Average hashrate per day.
		"hashrate_hour": 0,                    ----- Average hashrate per hour.
		"hashrate_minute": 4671930,            ----- Average hashrate per minute.
		"intensity": 21.5,                     ----- User defined intensity.
		"name": "GeForce GTX 1050",            ----- Current device name.
		"temperature": 80,                     ----- Current device temperature.
		"vendor": "Gigabyte"                   ----- Current device vendor.
		"disabled":true,                       ----- Device state. Might appear if device reached heat limit. (set by --temperature-limit)
		"disabled_at_temperature": 77          ----- Device temperature at disable. Might appear if device reached heat limit.
	}],
	
	"hashrate": 4529054,                       ----- Total average sum of hashrates for all active devices per N sec defined in config.
	"hashrate_day": 5023728,                   ----- Total average sum of hashrates for a day.
	"hashrate_hour": 0,                        ----- Total average sum of hashrates for an hour.
	"hashrate_minute": 4671930,                ----- Total average sum of hashrates for a minute.
	"name": "t-rex",
	"os": "linux",
	"rejected_count": 0,                       ----- This is number of rejected shares count.
	"solved_count": 0,                         ----- This is number of found blocks.
	"ts": 1537095257,                          ----- Current time in sec from the beginning of the epoch. (ref: https://www.epochconverter.com)
	"uptime": 108,                             ----- Uptime in sec. This shows how long the miner has been running for.
	"version": "0.6.5",                        ----- Miner version.

	"updates":{                                ----- Information about available update. Appears in case update is available.
		"url": "https://fileurl",              ----- Url of file archive to download.
		"md5sum": "md5...",                    ----- Signature of update pack (md5).
		"version": "0.8.0",                    ----- T-Rex version in update.
		"notes": "short update info",          ----- Short info about changes in update.
		"notes_full": "full update info",      ----- Whole info about changes in update.

		"download_status": {                   ----- Information about current update download.
			"downloaded_bytes": 1775165,       ----- Total bytes downloaded.
			"total_bytes": 5245345,            ----- Total bytes to download.
			"last_error":"",                   ----- Last error if download failed.
			"time_elapsed_sec": 2.887111,      ----- Time elapsed since first byte downloaded.
			"update_in_progress": true,        ----- Download service state.
			"update_state": "downloading",     ----- Download service named state. ("started", "downloading", "finished", "error", "idle")
			"url": "https://fileurl"},         ----- Url of file in operation.
    }
}

==[ DO-UPDATE ]==

Handler "do-update" is intended to activate download update service.
To start T-Rex update type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/do-update

To stop update type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/do-update?stop=true

==[ CONTROL ]==

Handler "control" is needed for real time configuration of T-Rex miner.
As of API 1.3 version there are following commands supported.

--- shutdown ---

To shutdown your miner with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?command=shutdown

If you prefer POST set the request body to {"command": "shutdown"}.


--- hashrate-avr ---

To change sliding window size in real time with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?hashrate-avr=1
It will set sliding window of size 1 sec.

If you prefer POST set the request body to {"hashrate-avr": 1}.


--- gpu-report-interval ---

To change frequency of GPUs reports appearance in log with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?gpu-report-interval=10
Now you will see GPUs stats every 10th share.

If you prefer POST set the request body to {"gpu-report-interval": 10}.

Btw, you can disable stats (enter quiet mode) by setting gpu-report-interval to 0.


--- no-color ---

To disable color output to console with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?no-color=true
To enable:
http://127.0.0.1:4067/control?no-color=false

If you prefer POST set the request body to {"no-color": true}.


--- protocol-dump ---

To enable user protocol dump into console/log with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?protocol-dump=true
To disable:
http://127.0.0.1:4067/control?protocol-dump=false

If you prefer POST set the request body to {"protocol-dump": true}.


--- time-limit ---

To set time limit in seconds for miner (it will shutdown after timeout) with GET request type in the following into your browser address bar and hit Enter:
http://127.0.0.1:4067/control?time-limit=120
It will shutdown your miner 120 seconds after this request.
To disable:
http://127.0.0.1:4067/control?time-limit=0

If you prefer POST set the request body to {"time-limit": 120}.

==[ FILE ]==

You can create a file in directory with the miner. This may be useful for external monitoring utilities or scripts which can take commands from this file and do some sort of useful stuff like overclock or system reconfiguration.

http://127.0.0.1:4067/file?name=test.txt&data=some sort of text data

If you prefer POST set the request body to 
{
"name": "test.txt",
"data": "some sort of text data"
}
