apiminer package

Release

0.1.1


Submodules

apiminer.ClaymoreRPC module

Implementation of ClaymoreRPC get_minerstats1 protocol

This is compatable with both Claymore and Ethminer

class apiminer.ClaymoreRPC.ClaymoreRPC(ip, port)[source]

Bases: object

Class that interacts with a ClaymoreRPC protocol listener

Parameters
  • ip (str) – IP address of the api host

  • port (int) – The port on which the api is listening

response

Private storage of formatted response. set by ClaymoreRPC.update()

Type

dict

authorize(password)[source]

Authenticate connection. Used for APIs that have –api-password set.

This will send the password in plaintext. Blame Ethminer

Parameters

password (str) – The password. Again, cleartext.

auto_update = None

DEPRECATED. Update every time the response attribute is read.

Type

bool

format_getstat1()[source]

Applies a nice formatting to getstat1

Returns

Formatted API response. Check code for keys.

Return type

dict

getstat1()[source]

Implementation of the getstats1 method.

read()[source]

Read data from API

Returns

deserialized JSON response.

Return type

dict

reboot()[source]

Runs a script named reboot.sh (Linux) or reboot.bat (Windows)

This method will only work if the API is in write mode. There is no guarantee that script will succeed.

Returns

Returns True if script was found and the miner tried to start it.

Return type

bool

property response

Deprecated. Returns a dictionary of the response, in a nice format

restart()[source]

Sends the miner (API Host) the restart command.

The miner API must be set in write mode. Also, note that if the miner is non-responsive, it is very unlikely that this command will be effective. If effective, this will cause the miner to stop mining, unload DAGs, reset GPUs, regenerate DAGs, and then start mining. The connection to the pool will be maintained.

Returns

Restart succesful.

Return type

bool

restart_miner()[source]

Deprecated. Renamed to restart.

This will be removed in the next version

socket = None

socket.socket Object. This communicates with the API Host

unified_data(return_dual_mining=False)[source]

Returns a generic formatted response.

Uses get_stat1 under the hood

update()[source]

DEPRECATION WARNING. This will be removed in the next release

write(method='miner_getstats1', password=None)[source]

Send message to the miner. Connects if not connected

Parameters
class apiminer.ClaymoreRPC.EthminerRPC(ip, port)[source]

Bases: apiminer.ClaymoreRPC.ClaymoreRPC

Class that uses the Ethminer superset of ClaymoreRPC protocol listener to interact with an Ethminer client.

Parameters
  • ip (str) – IP address of the api host

  • port (int) – The port on which the api is listening

response

Private storage of formatted response. set by ClaymoreRPC.update()

Type

dict

getstatdetail()[source]

Returns dict of detailed statistical data

Returns

API response

Return type

dict

getstathr()[source]

Ethminer’s noncompliant, but much better formatted extension to getstat1

Returns

Response

Return type

dict

ping()[source]

Check if the server is still alive :returns: Response received. :rtype: bool

apiminer.XMRStakAPI module

Reads data from the XMRStak JSON API

class apiminer.XMRStakAPI.XMRStakAPI(ip, port)[source]

Bases: object

accepted_shares = None

Total Accepted Shares

Type

int

getdict(update=False)[source]

Returns a dictionary of the class attributes, in a nice format

invalid_shares = None

a copy of XMRStak.rejected_shares

Type

int

percard_hashrate = None

Current Hashrate per card. 10s rolling average.

Type

list of float

pool = None

Pool with which the miner is currently connected

Type

str

runtime = None

Uptime in minutes

Type

int

total_hashrate = None

Current Total Hashrate. 10 second rolling average.

Type

float

unified_data(return_dual_mining=None)[source]

Returns a generic formatted response.

Yes, XMRStak API does have a completely different implementation compared to Claymore RPC. Although, Claymore used to be closer to this before adding a the new ethminer methods. This will just use XMRStakAPI.getdict() under the hood

Returns

Unified API dictionary

Return type

dict

update()[source]

apiminer.SGMinerRPC module

class apiminer.SGMinerRPC.SGMiner(ip: str, port: int)[source]

Bases: apiminer.SGMinerRPC._SGBase

pga(number: int)[source]
pgacount() → int[source]
apiminer.SGMinerRPC.TeamRedMiner

alias of apiminer.SGMinerRPC._SGBase

Module contents