Documentation
¶
Overview ¶
Package ethermine is an unofficial golang client for ethpool, ethermine and flypool, using their generic pool API. View https://api.ethermine.org/docs for detailed documentation of their API.
Index ¶
- Variables
- type Miner
- func (m *Miner) History() (res *MinerHistoryResponse, err error)
- func (m *Miner) Payouts() (res *MinerPayoutsResponse, err error)
- func (m *Miner) Rounds() (res *MinerRoundsResponse, err error)
- func (m *Miner) Settings() (res *MinerSettingsResponse, err error)
- func (m *Miner) Stats() (res *MinerStatisticsResponse, err error)
- func (m *Miner) Worker(worker string) *Worker
- func (m *Miner) WorkersMonitor() (res []*WorkerStatsResponse, err error)
- func (m *Miner) WorkersStats() (res []*WorkerStatsResponse, err error)
- type MinerHistoryResponse
- type MinerPayoutsResponse
- type MinerRoundsResponse
- type MinerSettingsResponse
- type MinerStatisticsResponse
- type Pool
- func (p *Pool) MinedBlocks() (pRes *PoolMinedBlocksResponse, err error)
- func (p *Pool) Miner(address string) *Miner
- func (p *Pool) NetworkStats() (pRes *PoolNetworkStatsResponse, err error)
- func (p *Pool) ServerHashrate() (pRes *PoolServerHashrateResponse, err error)
- func (p *Pool) Stats() (pRes *PoolStatsResponse, err error)
- type PoolMinedBlocksResponse
- type PoolNetworkStatsResponse
- type PoolServerHashrateResponse
- type PoolStatsResponse
- type Worker
- type WorkerStatsResponse
Constants ¶
This section is empty.
Variables ¶
var ( // Ethermine default client for Ethermine Ethermine = &Pool{"https://api.ethermine.org"} // EthermineETC default client for ETC ethermine EthermineETC = &Pool{"https://api-etc.ethermine.org"} // Flypool default client for flypool Flypool = &Pool{"https://api.flypool.org"} // Ethpool default client for Ethpool Ethpool = &Pool{"https://api.ethpool.org"} )
Functions ¶
This section is empty.
Types ¶
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
Miner is a convenience struct that embeds a Pool alongside a miners address.
func (*Miner) History ¶
func (m *Miner) History() (res *MinerHistoryResponse, err error)
History returns a historic record of the miners performance, ordered by time ascending.
func (*Miner) Payouts ¶
func (m *Miner) Payouts() (res *MinerPayoutsResponse, err error)
Payouts returns a historic record of the miners payouts, ordered by time ascending.
func (*Miner) Rounds ¶
func (m *Miner) Rounds() (res *MinerRoundsResponse, err error)
Rounds returns a historic record of the miners rounds and the base units allocated to them, ordered by block number descending.
func (*Miner) Settings ¶
func (m *Miner) Settings() (res *MinerSettingsResponse, err error)
Settings returns the miners current settings. Both the email and ip fields will be masked.
func (*Miner) Stats ¶
func (m *Miner) Stats() (res *MinerStatisticsResponse, err error)
Stats returns a historic record of the miners stats, ordered by time ascending.
func (*Miner) Worker ¶
Worker is a convenience function for accessing workers. All it does is return a Worker embedded with the recieving miner and the workers name.
func (*Miner) WorkersMonitor ¶
func (m *Miner) WorkersMonitor() (res []*WorkerStatsResponse, err error)
WorkersMonitor returns a list of the workers currently active under the miner. Note this is for monitoring purposes only and does not provide historical data. Dead workers will be displayed for up to 7 days.
func (*Miner) WorkersStats ¶
func (m *Miner) WorkersStats() (res []*WorkerStatsResponse, err error)
WorkersStats returns all of the miners workers current statistics, ordered by name ascending.
type MinerHistoryResponse ¶
type MinerHistoryResponse []struct { Time int `json:"time"` ReportedHashrate int `json:"reportedHashrate"` CurrentHashrate float64 `json:"currentHashrate"` ValidShares int `json:"validShares"` InvalidShares int `json:"invalidShares"` StaleShares int `json:"staleShares"` AverageHashrate float64 `json:"averageHashrate"` ActiveWorkers int `json:"activeWorkers"` }
MinerHistoryResponse is the json response returned by the /miner/:miner/history endpoint.
type MinerPayoutsResponse ¶
type MinerPayoutsResponse []struct { Start int `json:"start"` End int `json:"end"` Amount int64 `json:"amount"` TxHash string `json:"txHash"` PaidOn int `json:"paidOn"` }
MinerPayoutsResponse is the json response returned by the /miner/:miner/payouts endpoint.
type MinerRoundsResponse ¶
MinerRoundsResponse is the json response returned by the /miner/:miner/rounds endpoint.
type MinerSettingsResponse ¶
type MinerSettingsResponse struct { Monitor int `json:"monitor"` MinPayout int64 `json:"minPayout"` Email string `json:"email"` IP string `json:"ip"` }
MinerSettingsResponse is the json response returned by the /miner/:miner/settings endpoint.
type MinerStatisticsResponse ¶
type MinerStatisticsResponse struct { Time int `json:"time"` LastSeen int `json:"lastSeen"` ReportedHashrate int `json:"reportedHashrate"` CurrentHashrate float64 `json:"currentHashrate"` AverageHashrate float64 `json:"averageHashrate"` ActiveWorkers int `json:"activeWorkers"` Unpaid int64 `json:"unpaid"` Unconfirmed float64 `json:"unconfirmed"` CoinsPerMin float64 `json:"coinsPerMin"` UsdPerMin float64 `json:"usdPerMin"` BtcPerMin float64 `json:"btcPerMin"` }
MinerStatisticsResponse is the json response returned by the /miner/:miner/currentStats.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is the base client used for sending requests to the generic API.
func (*Pool) MinedBlocks ¶
func (p *Pool) MinedBlocks() (pRes *PoolMinedBlocksResponse, err error)
MinedBlocks returns a list of blocks mined by the pool, ordered by time ascending.
func (*Pool) NetworkStats ¶
func (p *Pool) NetworkStats() (pRes *PoolNetworkStatsResponse, err error)
NetworkStats returns current network stats, including hashrate and difficulty.
func (*Pool) ServerHashrate ¶
func (p *Pool) ServerHashrate() (pRes *PoolServerHashrateResponse, err error)
ServerHashrate returns a historic record of the pools hashrate, ordered by time ascending.
func (*Pool) Stats ¶
func (p *Pool) Stats() (pRes *PoolStatsResponse, err error)
Stats returns basic pool stats such as recently mined blocks, current pricing information, hashrate and more.
type PoolMinedBlocksResponse ¶
type PoolMinedBlocksResponse []struct { Time int `json:"time"` NbrBlocks int `json:"nbrBlocks"` Difficulty int64 `json:"difficulty"` }
PoolMinedBlocksResponse is the json response returned by the /blocks/history endpoint.
type PoolNetworkStatsResponse ¶
type PoolNetworkStatsResponse struct { Time int `json:"time"` BlockTime float64 `json:"blockTime"` Difficulty int64 `json:"difficulty"` Hashrate int64 `json:"hashrate"` USD float64 `json:"usd"` BTC float64 `json:"btc"` }
PoolNetworkStatsResponse is the json response returned by the /networkStats endpoint.
type PoolServerHashrateResponse ¶
type PoolServerHashrateResponse []struct { Time int `json:"time"` Server string `json:"server"` Hashrate float64 `json:"hashrate"` }
PoolServerHashrateResponse is the json response returned by the /servers/history endpoint.
type PoolStatsResponse ¶
type PoolStatsResponse struct { TopMiners []interface{} `json:"topMiners"` MinedBlocks []struct { Number int `json:"number"` Miner string `json:"miner"` Time int `json:"time"` } `json:"minedBlocks"` PoolStats struct { HashRate float64 `json:"hashRate"` Miners int `json:"miners"` Workers int `json:"workers"` BlocksPerHour float64 `json:"blocksPerHour"` } `json:"poolStats"` Price struct { USD float64 `json:"usd"` BTC float64 `json:"btc"` } `json:"price"` }
PoolStatsResponse is the json response returned by the /poolStats endpoint.
type Worker ¶
type Worker struct { *Miner // contains filtered or unexported fields }
Worker is a convenience struct that embeds a Miner alongside a workers name, this allows for easy access to per-worker endpoints.
func (*Worker) History ¶
func (w *Worker) History() (res []*WorkerStatsResponse, err error)
History returns a historic record of the workers statistics, ordered by time ascending.
func (*Worker) Stats ¶
func (w *Worker) Stats() (res *WorkerStatsResponse, err error)
Stats returns the workers current statistics.
type WorkerStatsResponse ¶
type WorkerStatsResponse struct { Worker string `json:"worker"` Time int `json:"time"` LastSeen int `json:"lastSeen"` ReportedHashrate int `json:"reportedHashrate"` CurrentHashrate float64 `json:"currentHashrate"` AverageHashrate float64 `json:"averageHashrate"` }
WorkersStatsResponse is the json response returned by the various worker endpoints. TODO split?