https://github.com/osoianmarcel/claymore-go
Claymore Client written in Go
https://github.com/osoianmarcel/claymore-go
claymore client golang mining stats
Last synced: about 1 year ago
JSON representation
Claymore Client written in Go
- Host: GitHub
- URL: https://github.com/osoianmarcel/claymore-go
- Owner: OsoianMarcel
- License: mit
- Created: 2018-01-22T18:57:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T09:01:54.000Z (about 7 years ago)
- Last Synced: 2025-04-12T10:07:16.725Z (about 1 year ago)
- Topics: claymore, client, golang, mining, stats
- Language: Go
- Size: 10.7 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# claymore-go
Go library used to get claymore stats in human readable model
[](https://github.com/OsoianMarcel/claymore-go/blob/master/LICENSE)
## Example of simple web server using this library
```go
package main
import (
"github.com/OsoianMarcel/claymore-go"
"net/http"
"encoding/json"
)
type ErrorResponse struct {
Error string `json:"error"`
}
type DataResponse struct {
Data interface{} `json:"data"`
}
type ExtraResponse struct {
HighestTemp claymore.TempAndFanReport `json:"highest_temp"`
}
type StatsResponse struct {
Stats claymore.StatsModel `json:"stats"`
Extra ExtraResponse `json:"extra"`
}
func main() {
cc := claymore.NewClient("localhost:3333")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
stats, err := cc.GetStats()
if err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
json.NewEncoder(w).Encode(ErrorResponse{err.Error()})
return
}
extraResp := ExtraResponse{}
if ht, err := stats.GetHighestTemp(); err == nil {
extraResp.HighestTemp = ht
}
statsResp := StatsResponse{stats, extraResp}
json.NewEncoder(w).Encode(DataResponse{statsResp})
})
http.ListenAndServe(":8080", nil)
}
```
## Server output
```json
{
"data": {
"stats": {
"miner_version": "10.5 - ETH",
"running_minutes": 1409,
"eth_report": {
"total_mhs": 80941,
"shares": 1640,
"rejected_shares": 1,
"invalid_shares": 37,
"pool_switches": 1,
"mhs_per_gpu": [
{
"mhs": 13344,
"gpu": 0
},
{
"mhs": 13352,
"gpu": 1
},
{
"mhs": 13398,
"gpu": 2
},
{
"mhs": 14151,
"gpu": 3
},
{
"mhs": 13352,
"gpu": 4
},
{
"mhs": 13342,
"gpu": 5
}
]
},
"alt_report": {
"total_mhs": 0,
"shares": 0,
"rejected_shares": 0,
"invalid_shares": 0,
"pool_switches": 0,
"mhs_per_gpu": [
{
"mhs": 0,
"gpu": 0
},
{
"mhs": 0,
"gpu": 1
},
{
"mhs": 0,
"gpu": 2
},
{
"mhs": 0,
"gpu": 3
},
{
"mhs": 0,
"gpu": 4
},
{
"mhs": 0,
"gpu": 5
}
]
},
"temp_and_fan_reports": [
{
"temp": 66,
"fan": 40,
"gpu": 0
},
{
"temp": 66,
"fan": 40,
"gpu": 1
},
{
"temp": 67,
"fan": 41,
"gpu": 2
},
{
"temp": 67,
"fan": 40,
"gpu": 3
},
{
"temp": 67,
"fan": 40,
"gpu": 4
},
{
"temp": 63,
"fan": 80,
"gpu": 5
}
],
"pools": [
"eu1.ethermine.org:4444"
]
},
"extra": {
"highest_temp": {
"temp": 67,
"fan": 41,
"gpu": 2
}
}
}
}
```
## Contribute
Contributions to the package are always welcome!
* Report any bugs or issues you find on the [issue tracker].
* You can grab the source code at the package's [Git repository].
## Donation
Give me a Star if you like it!
## License
All contents of this package are licensed under the [MIT license].
[issue tracker]: https://github.com/OsoianMarcel/claymore-go/issues
[Git repository]: https://github.com/OsoianMarcel/claymore-go
[MIT license]: LICENSE