anselal / antminer-monitor

Cryptocurrency ASIC mining hardware monitor using a simple web interface
GNU General Public License v3.0
228 stars 145 forks source link

Add support for newer versions of miners #195

Open UpstreamData opened 2 years ago

UpstreamData commented 2 years ago

Hey, just looking at the project and you only have support for older, possibly outdated types of miners. I am working on a similar project in python, and figured you would possibly want to implement some of the same miner versions that I have supported, such as X19/X17 models, Canaan 841 and 1066, and Whatsminer M30 and M20 series. Most of these have fairly standard API's across the board. In addition to this, I would be happy to provide outputs from every known command for a bunch of miner models if you would like to implement them into your project.

Link to my miner handler is here: https://github.com/UpstreamData/minerInterface

API implementations are under .API, and implementations for per-miner models are under .miners and sorted by miner type (antminer, whatsminer, avalonminer).

Hopefully this helps you :)

anselal commented 2 years ago

Hey. Thnx. Will definitely take a look at your code

anselal commented 1 year ago

Hey, just looking at the project and you only have support for older, possibly outdated types of miners. I am working on a similar project in python, and figured you would possibly want to implement some of the same miner versions that I have supported, such as X19/X17 models, Canaan 841 and 1066, and Whatsminer M30 and M20 series. Most of these have fairly standard API's across the board. In addition to this, I would be happy to provide outputs from every known command for a bunch of miner models if you would like to implement them into your project.

Link to my miner handler is here: https://github.com/UpstreamData/minerInterface

API implementations are under .API, and implementations for per-miner models are under .miners and sorted by miner type (antminer, whatsminer, avalonminer).

Hopefully this helps you :)

Hi there, I took a long break from this project cause I didn't have, and still don't have, access to any of my miners so I couldn't test some of the features I wanted to add. I saw that your project is still active. I have some working examples for the Dragonmints. Do all of the other brands use cgminer/bbminer for their apis ? Can you perhaps send me links to their docs, if available, and sample outputs from their apis ?

UpstreamData commented 1 year ago

There have been many many updates to the project since I posted this, it is now published to PyPI under pyasic, and actually has some documentation.

I have a list of supported miners here - https://pyasic.readthedocs.io/en/latest/miners/supported_types/, and these miners use 4 different API backends, CGMiner, BMMiner, BOSMiner, and BTMiner (what Whatsminer/MicroBT calls their api).

I have links to the base documentation for all the types of APIs supported in the documentation here - https://pyasic.readthedocs.io/en/latest/API/api/ if you're interested in them, except BTMiner, which is on whatsminers official website as Whatsminer.com under the support tab. I would recommend against trying to implement their privileged API without looking at some code, as it's not super straightforward and all the implementations I've seen for it use deprecated cryptography methods. If you want to set the up you may want to have a look at pyasic/API/BTMiner.py.

I am happy to provide API outputs if you want them, but if you want just the implementations to get things, check out the functions for data gathering in the files in pyasic/miners/_backends/*.py. That being said the sad part is the API is not the end all be all, as most miners nowadays use some form of web commands.

Let me know if you have any questions or any specific API outputs you want and I can try to send them.

UpstreamData commented 1 year ago

I realize I probably should have linked to the files I'm talking about, so here's the backend implementations folder - https://github.com/UpstreamData/pyasic/tree/master/pyasic/miners/_backends

And here's the BTMiner implementation - https://github.com/UpstreamData/pyasic/blob/master/pyasic/API/btminer.py

anselal commented 1 year ago

Thnx for the quick reply, I appreciate it. I am aware of the web commands, the Dragonmint uses a web api too. I will browse your code and see if I can get the logic. Have you tested your API with many miners to see how it behaves ? I have used it with couple thousands of miners and it worked flawlessly :man_shrugging:

UpstreamData commented 1 year ago

I haven't been able to test at quite that scale, but I would be concerned about the select.select loop on windows since it tends to crash if you put too many asynchronous operations into it, so it's very possible that I don't have enough semaphores in the code. Let me know if you find any crashes and I can try to fix them, I'm happily open to contributions and comments as well if you have them.

anselal commented 1 year ago

I was thinking also to refactor the code and transform it to async but I am not sure it would work as expected. If I find another person with so many miners I will let you know so we can test your software as well

UpstreamData commented 1 year ago

That would be awesome. I know some people that may have access to that many miners who are testing pyasic, and may be able to test them at scale soon, but I will fix issues as I find them. Feel free to reach out if you have any questions on the async side of things.