Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6d6bfe73d | ||
|
|
f159e9ccb4 | ||
|
|
8ae2932274 | ||
|
|
52786ba954 |
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyasic.API import APIError, BaseMinerAPI
|
from pyasic.API import APIError, BaseMinerAPI
|
||||||
|
|||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
from pyasic.API.bmminer import BMMinerAPI
|
from pyasic.API.bmminer import BMMinerAPI
|
||||||
from pyasic.API.bosminer import BOSMinerAPI
|
from pyasic.API.bosminer import BOSMinerAPI
|
||||||
from pyasic.API.btminer import BTMinerAPI
|
from pyasic.API.btminer import BTMinerAPI
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from pyasic.miners._backends import BMMiner # noqa - Ignore access to _module
|
|||||||
from pyasic.settings import PyasicSettings
|
from pyasic.settings import PyasicSettings
|
||||||
|
|
||||||
|
|
||||||
class BMMinerX19(BMMiner):
|
class X19(BMMiner):
|
||||||
def __init__(self, ip: str, api_ver: str = "0.0.0") -> None:
|
def __init__(self, ip: str, api_ver: str = "0.0.0") -> None:
|
||||||
super().__init__(ip, api_ver=api_ver)
|
super().__init__(ip, api_ver=api_ver)
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
@@ -126,6 +126,13 @@ class BMMinerX19(BMMiner):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = await self.send_web_command("get_network_info")
|
||||||
|
if data:
|
||||||
|
return data["macaddr"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
async def get_errors(self) -> List[MinerErrorData]:
|
async def get_errors(self) -> List[MinerErrorData]:
|
||||||
errors = []
|
errors = []
|
||||||
data = await self.send_web_command("summary")
|
data = await self.send_web_command("summary")
|
||||||
@@ -20,3 +20,5 @@ from .btminer import BTMiner
|
|||||||
from .cgminer import CGMiner
|
from .cgminer import CGMiner
|
||||||
from .cgminer_avalon import CGMinerAvalon
|
from .cgminer_avalon import CGMinerAvalon
|
||||||
from .hiveon import Hiveon
|
from .hiveon import Hiveon
|
||||||
|
from .vnish import VNish
|
||||||
|
from .X19 import X19
|
||||||
|
|||||||
218
pyasic/miners/_backends/vnish.py
Normal file
218
pyasic/miners/_backends/vnish.py
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import warnings
|
||||||
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from pyasic.errors import APIError
|
||||||
|
from pyasic.miners._backends.bmminer import BMMiner
|
||||||
|
from pyasic.settings import PyasicSettings
|
||||||
|
|
||||||
|
|
||||||
|
class VNish(BMMiner):
|
||||||
|
def __init__(self, ip: str, api_ver: str = "0.0.0") -> None:
|
||||||
|
super().__init__(ip, api_ver)
|
||||||
|
self.api_type = "VNish"
|
||||||
|
self.uname = "root"
|
||||||
|
self.pwd = PyasicSettings().global_vnish_password
|
||||||
|
self.jwt = None
|
||||||
|
|
||||||
|
async def auth(self):
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
try:
|
||||||
|
auth = await client.post(
|
||||||
|
f"http://{self.ip}/api/v1/unlock",
|
||||||
|
json={"pw": self.pwd},
|
||||||
|
)
|
||||||
|
except httpx.HTTPError:
|
||||||
|
warnings.warn(f"Could not authenticate web token with miner: {self}")
|
||||||
|
else:
|
||||||
|
if not auth.status_code == 200:
|
||||||
|
warnings.warn(
|
||||||
|
f"Could not authenticate web token with miner: {self}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
json_auth = auth.json()
|
||||||
|
self.jwt = json_auth["token"]
|
||||||
|
return self.jwt
|
||||||
|
|
||||||
|
async def send_web_command(
|
||||||
|
self, command: str, data: Union[dict, None] = None, method: str = "GET"
|
||||||
|
):
|
||||||
|
if not self.jwt:
|
||||||
|
await self.auth()
|
||||||
|
if not data:
|
||||||
|
data = {}
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
for i in range(PyasicSettings().miner_get_data_retries):
|
||||||
|
try:
|
||||||
|
auth = self.jwt
|
||||||
|
if command.startswith("system"):
|
||||||
|
auth = "Bearer " + self.jwt
|
||||||
|
if method == "GET":
|
||||||
|
response = await client.get(
|
||||||
|
f"http://{self.ip}/api/v1/{command}",
|
||||||
|
headers={"Authorization": auth},
|
||||||
|
timeout=5,
|
||||||
|
)
|
||||||
|
elif method == "POST":
|
||||||
|
if data:
|
||||||
|
response = await client.post(
|
||||||
|
f"http://{self.ip}/api/v1/{command}",
|
||||||
|
headers={"Authorization": auth},
|
||||||
|
timeout=5,
|
||||||
|
json=data,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
response = await client.post(
|
||||||
|
f"http://{self.ip}/api/v1/{command}",
|
||||||
|
headers={"Authorization": auth},
|
||||||
|
timeout=5,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise APIError("Bad method type.")
|
||||||
|
if not response.status_code == 200:
|
||||||
|
# refresh the token, retry
|
||||||
|
await self.auth()
|
||||||
|
continue
|
||||||
|
json_data = response.json()
|
||||||
|
if json_data:
|
||||||
|
return json_data
|
||||||
|
return True
|
||||||
|
except httpx.HTTPError:
|
||||||
|
pass
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_model(self, api_stats: dict = None) -> Optional[str]:
|
||||||
|
# check if model is cached
|
||||||
|
if self.model:
|
||||||
|
logging.debug(f"Found model for {self.ip}: {self.model} (VNish)")
|
||||||
|
return self.model + " (VNish)"
|
||||||
|
|
||||||
|
if not api_stats:
|
||||||
|
try:
|
||||||
|
api_stats = await self.api.stats()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if api_stats:
|
||||||
|
try:
|
||||||
|
m_type = api_stats["STATS"][0]["Type"]
|
||||||
|
self.model = m_type.split(" ")[1]
|
||||||
|
return self.model
|
||||||
|
except (KeyError, IndexError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def restart_backend(self) -> bool:
|
||||||
|
data = await self.send_web_command("mining/restart", method="POST")
|
||||||
|
return data
|
||||||
|
|
||||||
|
async def reboot(self) -> bool:
|
||||||
|
data = await self.send_web_command("system/reboot", method="POST")
|
||||||
|
return data
|
||||||
|
|
||||||
|
async def get_mac(self, web_summary: dict = None) -> str:
|
||||||
|
if not web_summary:
|
||||||
|
web_info = await self.send_web_command("info")
|
||||||
|
|
||||||
|
if web_info:
|
||||||
|
try:
|
||||||
|
mac = web_info["system"]["network_status"]["mac"]
|
||||||
|
return mac
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if web_summary:
|
||||||
|
try:
|
||||||
|
mac = web_summary["system"]["network_status"]["mac"]
|
||||||
|
return mac
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_hostname(self, web_summary: dict = None) -> str:
|
||||||
|
if not web_summary:
|
||||||
|
web_info = await self.send_web_command("info")
|
||||||
|
|
||||||
|
if web_info:
|
||||||
|
try:
|
||||||
|
hostname = web_info["system"]["network_status"]["hostname"]
|
||||||
|
return hostname
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if web_summary:
|
||||||
|
try:
|
||||||
|
hostname = web_summary["system"]["network_status"]["hostname"]
|
||||||
|
return hostname
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_wattage(self, web_summary: dict = None) -> Optional[int]:
|
||||||
|
if not web_summary:
|
||||||
|
web_summary = await self.send_web_command("summary")
|
||||||
|
|
||||||
|
if web_summary:
|
||||||
|
try:
|
||||||
|
wattage = web_summary["miner"]["power_usage"]
|
||||||
|
wattage = round(wattage * 1000)
|
||||||
|
return wattage
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_hashrate(self, api_summary: dict = None) -> Optional[float]:
|
||||||
|
# get hr from API
|
||||||
|
if not api_summary:
|
||||||
|
try:
|
||||||
|
api_summary = await self.api.summary()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if api_summary:
|
||||||
|
try:
|
||||||
|
return round(
|
||||||
|
float(float(api_summary["SUMMARY"][0]["GHS 5s"]) / 1000), 2
|
||||||
|
)
|
||||||
|
except (IndexError, KeyError, ValueError, TypeError) as e:
|
||||||
|
print(e)
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_wattage_limit(self, web_settings: dict = None) -> Optional[int]:
|
||||||
|
if not web_settings:
|
||||||
|
web_settings = await self.send_web_command("summary")
|
||||||
|
|
||||||
|
if web_settings:
|
||||||
|
try:
|
||||||
|
wattage_limit = web_settings["miner"]["overclock"]["preset"]
|
||||||
|
return int(wattage_limit)
|
||||||
|
except (KeyError, TypeError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def get_fw_ver(self, web_summary: dict = None) -> Optional[str]:
|
||||||
|
if not web_summary:
|
||||||
|
web_summary = await self.send_web_command("summary")
|
||||||
|
|
||||||
|
if web_summary:
|
||||||
|
try:
|
||||||
|
fw_ver = web_summary["miner"]["miner_type"]
|
||||||
|
fw_ver = fw_ver.split("(Vnish ")[1].replace(")", "")
|
||||||
|
return fw_ver
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
@@ -18,3 +18,4 @@ from .bmminer import *
|
|||||||
from .bosminer import *
|
from .bosminer import *
|
||||||
from .cgminer import *
|
from .cgminer import *
|
||||||
from .hiveon import *
|
from .hiveon import *
|
||||||
|
from .vnish import *
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19 # noqa - Ignore access to _module
|
from pyasic.miners._types import S19 # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19(BMMinerX19, S19):
|
class BMMinerS19(X19, S19):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19Pro # noqa - Ignore access to _module
|
from pyasic.miners._types import S19Pro # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19Pro(BMMinerX19, S19Pro):
|
class BMMinerS19Pro(X19, S19Pro):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19XP # noqa - Ignore access to _module
|
from pyasic.miners._types import S19XP # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19XP(BMMinerX19, S19XP):
|
class BMMinerS19XP(X19, S19XP):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19a # noqa - Ignore access to _module
|
from pyasic.miners._types import S19a # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19a(BMMinerX19, S19a):
|
class BMMinerS19a(X19, S19a):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19aPro # noqa - Ignore access to _module
|
from pyasic.miners._types import S19aPro # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19aPro(BMMinerX19, S19aPro):
|
class BMMinerS19aPro(X19, S19aPro):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19j # noqa - Ignore access to _module
|
from pyasic.miners._types import S19j # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19j(BMMinerX19, S19j):
|
class BMMinerS19j(X19, S19j):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import S19jPro # noqa - Ignore access to _module
|
from pyasic.miners._types import S19jPro # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerS19jPro(BMMinerX19, S19jPro):
|
class BMMinerS19jPro(X19, S19jPro):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import X19
|
||||||
from pyasic.miners._types import T19 # noqa - Ignore access to _module
|
from pyasic.miners._types import T19 # noqa - Ignore access to _module
|
||||||
|
|
||||||
from .X19 import BMMinerX19
|
# noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
class BMMinerT19(BMMinerX19, T19):
|
class BMMinerT19(X19, T19):
|
||||||
pass
|
pass
|
||||||
|
|||||||
22
pyasic/miners/antminer/vnish/X19/S19.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19 # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19(VNish, S19):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19_Pro.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19_Pro.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19Pro # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19Pro(VNish, S19Pro):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19_XP.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19_XP.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19XP # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19XP(VNish, S19XP):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19a.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19a.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19a # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19a(VNish, S19a):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19a_Pro.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19a_Pro.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19aPro # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19aPro(VNish, S19aPro):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19j.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19j.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19j # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19j(VNish, S19j):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/S19j_Pro.py
Normal file
22
pyasic/miners/antminer/vnish/X19/S19j_Pro.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import S19jPro # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishS19jPro(VNish, S19jPro):
|
||||||
|
pass
|
||||||
22
pyasic/miners/antminer/vnish/X19/T19.py
Normal file
22
pyasic/miners/antminer/vnish/X19/T19.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners._backends import VNish # noqa - Ignore access to _module
|
||||||
|
from pyasic.miners._types import T19 # noqa - Ignore access to _module
|
||||||
|
|
||||||
|
|
||||||
|
class VNishT19(VNish, T19):
|
||||||
|
pass
|
||||||
24
pyasic/miners/antminer/vnish/X19/__init__.py
Normal file
24
pyasic/miners/antminer/vnish/X19/__init__.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from .S19 import VNishS19
|
||||||
|
from .S19_Pro import VNishS19Pro
|
||||||
|
from .S19_XP import VNishS19XP
|
||||||
|
from .S19a import VNishS19a
|
||||||
|
from .S19a_Pro import VNishS19aPro
|
||||||
|
from .S19j import VNishS19j
|
||||||
|
from .S19j_Pro import VNishS19jPro
|
||||||
|
from .T19 import VNishT19
|
||||||
17
pyasic/miners/antminer/vnish/__init__.py
Normal file
17
pyasic/miners/antminer/vnish/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from .X19 import *
|
||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
|
|||||||
@@ -106,24 +106,28 @@ MINER_CLASSES = {
|
|||||||
"BOSMiner+": BOSMinerS19,
|
"BOSMiner+": BOSMinerS19,
|
||||||
"BMMiner": BMMinerS19,
|
"BMMiner": BMMinerS19,
|
||||||
"CGMiner": CGMinerS19,
|
"CGMiner": CGMinerS19,
|
||||||
|
"VNish": VNishS19,
|
||||||
},
|
},
|
||||||
"ANTMINER S19 PRO": {
|
"ANTMINER S19 PRO": {
|
||||||
"Default": BMMinerS19Pro,
|
"Default": BMMinerS19Pro,
|
||||||
"BOSMiner+": BOSMinerS19Pro,
|
"BOSMiner+": BOSMinerS19Pro,
|
||||||
"BMMiner": BMMinerS19Pro,
|
"BMMiner": BMMinerS19Pro,
|
||||||
"CGMiner": CGMinerS19Pro,
|
"CGMiner": CGMinerS19Pro,
|
||||||
|
"VNish": VNishS19Pro,
|
||||||
},
|
},
|
||||||
"ANTMINER S19J": {
|
"ANTMINER S19J": {
|
||||||
"Default": BMMinerS19j,
|
"Default": BMMinerS19j,
|
||||||
"BOSMiner+": BOSMinerS19j,
|
"BOSMiner+": BOSMinerS19j,
|
||||||
"BMMiner": BMMinerS19j,
|
"BMMiner": BMMinerS19j,
|
||||||
"CGMiner": CGMinerS19j,
|
"CGMiner": CGMinerS19j,
|
||||||
|
"VNish": VNishS19j,
|
||||||
},
|
},
|
||||||
"ANTMINER S19J PRO": {
|
"ANTMINER S19J PRO": {
|
||||||
"Default": BMMinerS19jPro,
|
"Default": BMMinerS19jPro,
|
||||||
"BOSMiner+": BOSMinerS19jPro,
|
"BOSMiner+": BOSMinerS19jPro,
|
||||||
"BMMiner": BMMinerS19jPro,
|
"BMMiner": BMMinerS19jPro,
|
||||||
"CGMiner": CGMinerS19jPro,
|
"CGMiner": CGMinerS19jPro,
|
||||||
|
"VNish": VNishS19jPro,
|
||||||
},
|
},
|
||||||
"ANTMINER S19 XP": {
|
"ANTMINER S19 XP": {
|
||||||
"Default": BMMinerS19XP,
|
"Default": BMMinerS19XP,
|
||||||
@@ -132,16 +136,19 @@ MINER_CLASSES = {
|
|||||||
"ANTMINER S19A": {
|
"ANTMINER S19A": {
|
||||||
"Default": BMMinerS19a,
|
"Default": BMMinerS19a,
|
||||||
"BMMiner": BMMinerS19a,
|
"BMMiner": BMMinerS19a,
|
||||||
|
"VNish": VNishS19a,
|
||||||
},
|
},
|
||||||
"ANTMINER S19A PRO": {
|
"ANTMINER S19A PRO": {
|
||||||
"Default": BMMinerS19aPro,
|
"Default": BMMinerS19aPro,
|
||||||
"BMMiner": BMMinerS19aPro,
|
"BMMiner": BMMinerS19aPro,
|
||||||
|
"VNish": VNishS19aPro,
|
||||||
},
|
},
|
||||||
"ANTMINER T19": {
|
"ANTMINER T19": {
|
||||||
"Default": BMMinerT19,
|
"Default": BMMinerT19,
|
||||||
"BOSMiner+": BOSMinerT19,
|
"BOSMiner+": BOSMinerT19,
|
||||||
"BMMiner": BMMinerT19,
|
"BMMiner": BMMinerT19,
|
||||||
"CGMiner": CGMinerT19,
|
"CGMiner": CGMinerT19,
|
||||||
|
"VNish": VNishT19,
|
||||||
},
|
},
|
||||||
"M20": {"Default": BTMinerM20V10, "BTMiner": BTMinerM20V10, "10": BTMinerM20V10},
|
"M20": {"Default": BTMinerM20V10, "BTMiner": BTMinerM20V10, "10": BTMinerM20V10},
|
||||||
"M20S": {
|
"M20S": {
|
||||||
@@ -781,6 +788,8 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if "VNISH" in _model:
|
||||||
|
api = "VNish"
|
||||||
for split_point in [" BB", " XILINX", " (VNISH"]:
|
for split_point in [" BB", " XILINX", " (VNISH"]:
|
||||||
if split_point in _model:
|
if split_point in _model:
|
||||||
_model = _model.split(split_point)[0]
|
_model = _model.split(split_point)[0]
|
||||||
|
|||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
from pyasic.API import APIError
|
from pyasic.API import APIError
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class PyasicSettings(metaclass=Singleton):
|
|||||||
global_innosilicon_password = "admin"
|
global_innosilicon_password = "admin"
|
||||||
global_x19_password = "root"
|
global_x19_password = "root"
|
||||||
global_x17_password = "root"
|
global_x17_password = "root"
|
||||||
|
global_vnish_password = "admin"
|
||||||
|
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
logfile: bool = False
|
logfile: bool = False
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pyasic"
|
name = "pyasic"
|
||||||
version = "0.27.7"
|
version = "0.28.1"
|
||||||
description = "A set of modules for interfacing with many common types of ASIC bitcoin miners, using both their API and SSH."
|
description = "A set of modules for interfacing with many common types of ASIC bitcoin miners, using both their API and SSH."
|
||||||
authors = ["UpstreamData <brett@upstreamdata.ca>"]
|
authors = ["UpstreamData <brett@upstreamdata.ca>"]
|
||||||
repository = "https://github.com/UpstreamData/pyasic"
|
repository = "https://github.com/UpstreamData/pyasic"
|
||||||
|
|||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from pyasic.config import MinerConfig, _Pool, _PoolGroup # noqa
|
from pyasic.config import MinerConfig, _Pool, _PoolGroup # noqa
|
||||||
|
|||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -13,18 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and -
|
# See the License for the specific language governing permissions and -
|
||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
bosminer_api_pools = {
|
bosminer_api_pools = {
|
||||||
"STATUS": [
|
"STATUS": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user