Documentation ¶
Overview ¶
Package miner implements various Stellite-compatible miners that can be used by the GUI
Index ¶
- Variables
- func DetermineMinerType(dir string) (string, string, error)
- func HumanizeHashrate(hashrate float64) string
- func HumanizeTime(seconds int) string
- type Base
- type Config
- type Miner
- type ProcessingConfig
- type Stats
- type XmrStak
- func (miner *XmrStak) GetLastHashrate() float64
- func (miner *XmrStak) GetName() string
- func (miner *XmrStak) GetProcessingConfig() ProcessingConfig
- func (miner *XmrStak) GetStats() (Stats, error)
- func (miner *XmrStak) WriteConfig(poolEndpoint string, walletAddress string, processingConfig ProcessingConfig) error
- type XmrStakResponse
- type Xmrig
- func (miner *Xmrig) GetLastHashrate() float64
- func (miner *Xmrig) GetName() string
- func (miner *Xmrig) GetProcessingConfig() ProcessingConfig
- func (miner *Xmrig) GetStats() (Stats, error)
- func (miner *Xmrig) WriteConfig(poolEndpoint string, walletAddress string, processingConfig ProcessingConfig) error
- type XmrigAPIConfig
- type XmrigConfig
- type XmrigGPUConfig
- type XmrigPoolConfig
- type XmrigResponse
Constants ¶
This section is empty.
Variables ¶
var SupportedMiners = []string{"xtc-stak", "xtcrig"}
SupportedMiners contains a list of the currently supported miners
Functions ¶
func DetermineMinerType ¶
DetermineMinerType checks the given path for supported miners and returns the type of miner and path to the executable
func HumanizeHashrate ¶
HumanizeHashrate returns the H/s, KH/s or MH/s representation of hashrate
func HumanizeTime ¶
HumanizeTime turns seconds into minutes, hours, etc
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base implements core functionality common to all miners
type Config ¶
type Config struct { // Type of miner Type string `json:"type"` // Path to the selected miner's executable Path string `json:"path"` // Endpoint of the miner's JSON API Endpoint string `json:"endpoint"` }
Config holds miner specific configuration information
type Miner ¶
type Miner interface { // Start the miner Start() error // Stop the miner Stop() error // WriteConfig writes the miner's configuration to the file format as // specified by the miner WriteConfig( poolEndpoint string, walletAddress string, processingConfig ProcessingConfig) error // GetProcessingConfig returns the current miner processing config // TODO: Currently only CPU threads, extend this to full CPU/GPU config GetProcessingConfig() ProcessingConfig // GetName returns the name of the miner GetName() string // GetLastHashrate returns the last reported hashrate GetLastHashrate() float64 // GetStats returns the current miner stats GetStats() (Stats, error) }
Miner defines the required behaviour to be implemented by a miner to work with the GUI
func CreateMiner ¶
CreateMiner creates a supported miner from the given configuration
type ProcessingConfig ¶
type ProcessingConfig struct { // Type of miner Type string `json:"type"` // Threads is the amount of CPU threads Threads uint16 `json:"threads"` // MaxThreads is the maximum threads as read by runtime.NumCPU MaxThreads uint16 `json:"max_threads"` // MaxUsage is the maximum CPU usage in percentage the miner should // attempt to use. // Currently only supported by xmrig CPU backend MaxUsage uint8 `json:"max_usage"` }
ProcessingConfig holds the config for the miner's processing setup TODO: Right now this is only for CPU threads and will be extended into full CPU/GPU config
type Stats ¶
type Stats struct { // Hashrate is the current miner hashrate Hashrate float64 `json:"hashrate"` // HashrateHuman is the H/s, KH/s or MH/s representation of hashrate HashrateHuman string `json:"hashrate_human"` // CurrentDifficulty as set by the pool CurrentDifficulty int `json:"current_difficulty"` SharesGood int `json:"shares_good"` SharesBad int `json:"shares_bad"` // Uptime for the miner in seconds Uptime int `json:"uptime"` // UptimeHuman is the human readable version of uptime, ex. 10 minutes UptimeHuman string `json:"uptime_human"` // Errors is a list of errors that have occurred Errors []string `json:"errors"` // UpdateGraph is set to true if the stats graph should be updated UpdateGraph bool `json:"update_graph"` // Address contains the Stellite address we are mining to // TODO: This should be somewhere else, it's not stats! Address string `json:"address"` }
Stats contains the miner statistics required by the front-end
type XmrStak ¶
type XmrStak struct { Base // contains filtered or unexported fields }
XmrStak implements the miner interface for the xmr-stak miner https://github.com/fireice-uk/xmr-stak
func NewXmrStak ¶
NewXmrStak creates a new xmr-stak miner instance
func (*XmrStak) GetLastHashrate ¶
GetLastHashrate returns the last reported hashrate
func (*XmrStak) GetProcessingConfig ¶
func (miner *XmrStak) GetProcessingConfig() ProcessingConfig
GetProcessingConfig returns the current miner processing config TODO: Currently only CPU threads, extend this to full CPU/GPU config
func (*XmrStak) WriteConfig ¶
func (miner *XmrStak) WriteConfig( poolEndpoint string, walletAddress string, processingConfig ProcessingConfig) error
WriteConfig writes the miner's configuration in the xmr-stak format
type XmrStakResponse ¶
type XmrStakResponse struct { Version string `json:"version"` Hashrate struct { Threads [][]interface{} `json:"threads"` Total []float64 `json:"total"` Highest float64 `json:"highest"` } `json:"hashrate"` Results struct { DiffCurrent int `json:"diff_current"` SharesGood int `json:"shares_good"` SharesTotal int `json:"shares_total"` AvgTime float64 `json:"avg_time"` HashesTotal int `json:"hashes_total"` Best []int `json:"best"` ErrorLog []struct { Count int `json:"count"` LastSeen int `json:"last_seen"` Text string `json:"text"` } `json:"error_log"` } `json:"results"` Connection struct { Pool string `json:"pool"` Uptime int `json:"uptime"` Ping int `json:"ping"` ErrorLog []struct { LastSeen int `json:"last_seen"` Text string `json:"text"` } `json:"error_log"` } `json:"connection"` }
XmrStakResponse contains the data from xmr-stak API Generated with https://mholt.github.io/json-to-go/
type Xmrig ¶
type Xmrig struct { Base // contains filtered or unexported fields }
Xmrig implements the miner interface for the xmrig miner, including xmrig-amd and xmrig-nvidia https://github.com/xmrig/xmrig https://github.com/xmrig/xmrig-amd https://github.com/xmrig/xmrig-nvidia
func (*Xmrig) GetLastHashrate ¶
GetLastHashrate returns the last reported hashrate
func (*Xmrig) GetProcessingConfig ¶
func (miner *Xmrig) GetProcessingConfig() ProcessingConfig
GetProcessingConfig returns the current miner processing config TODO: Currently only CPU threads, extend this to full CPU/GPU config
func (*Xmrig) WriteConfig ¶
func (miner *Xmrig) WriteConfig( poolEndpoint string, walletAddress string, processingConfig ProcessingConfig) error
WriteConfig writes the miner's configuration in the xmrig format
type XmrigAPIConfig ¶
type XmrigAPIConfig struct { Port int `json:"port"` AccessToken interface{} `json:"access-token"` WorkerID interface{} `json:"worker-id"` }
XmrigAPIConfig contains the Xmrig API config
type XmrigConfig ¶
type XmrigConfig struct { Algo string `json:"algo"` Av int `json:"av"` Background bool `json:"background"` Colors bool `json:"colors"` CPUAffinity interface{} `json:"cpu-affinity"` CPUPriority interface{} `json:"cpu-priority"` DonateLevel int `json:"donate-level"` LogFile interface{} `json:"log-file"` MaxCPUUsage uint8 `json:"max-cpu-usage"` PrintTime int `json:"print-time"` Retries int `json:"retries"` RetryPause int `json:"retry-pause"` Safe bool `json:"safe"` Syslog bool `json:"syslog"` Threads uint16 `json:"threads"` Pools []XmrigPoolConfig `json:"pools"` API XmrigAPIConfig `json:"api"` }
XmrigConfig is the config.json structure for Xmrig Generated with https://mholt.github.io/json-to-go/
type XmrigGPUConfig ¶
type XmrigGPUConfig struct { Algo string `json:"algo"` Av int `json:"av"` Background bool `json:"background"` Colors bool `json:"colors"` CPUAffinity interface{} `json:"cpu-affinity"` CPUPriority interface{} `json:"cpu-priority"` DonateLevel int `json:"donate-level"` LogFile interface{} `json:"log-file"` MaxCPUUsage uint8 `json:"max-cpu-usage"` PrintTime int `json:"print-time"` Retries int `json:"retries"` RetryPause int `json:"retry-pause"` Safe bool `json:"safe"` Syslog bool `json:"syslog"` // TODO: This is the only difference between GPU and CPU, the threads // structure in the config. I need to merge the the config structures into // one with an omitempty tag on each and only fill in the one needed Threads []struct{} `json:"threads"` Pools []XmrigPoolConfig `json:"pools"` API XmrigAPIConfig `json:"api"` }
XmrigGPUConfig is the config.json structure for Xmrig's GPU Generated with https://mholt.github.io/json-to-go/
type XmrigPoolConfig ¶
type XmrigPoolConfig struct { URL string `json:"url"` User string `json:"user"` Pass string `json:"pass"` Keepalive bool `json:"keepalive"` Nicehash bool `json:"nicehash"` Variant string `json:"variant"` }
XmrigPoolConfig contains the configuration for a pool in Xmrig
type XmrigResponse ¶
type XmrigResponse struct { ID string `json:"id"` WorkerID string `json:"worker_id"` Version string `json:"version"` Kind string `json:"kind"` Ua string `json:"ua"` CPU struct { Brand string `json:"brand"` Aes bool `json:"aes"` X64 bool `json:"x64"` Sockets int `json:"sockets"` } `json:"cpu"` Algo string `json:"algo"` Hugepages bool `json:"hugepages"` DonateLevel int `json:"donate_level"` Hashrate struct { Total []float64 `json:"total"` Highest float64 `json:"highest"` Threads [][]float64 `json:"threads"` } `json:"hashrate"` Results struct { DiffCurrent int `json:"diff_current"` SharesGood int `json:"shares_good"` SharesTotal int `json:"shares_total"` AvgTime int `json:"avg_time"` HashesTotal int `json:"hashes_total"` Best []int `json:"best"` ErrorLog []string `json:"error_log"` } `json:"results"` Connection struct { Pool string `json:"pool"` Uptime int `json:"uptime"` Ping int `json:"ping"` Failures int `json:"failures"` ErrorLog []string `json:"error_log"` } `json:"connection"` }
XmrigResponse contains the data from xmrig API Generated with https://mholt.github.io/json-to-go/