11
As a developer or fascinating Ethereum, you are probably not a stranger to the excitement of mining in a variety of swimming pools. However, managing multiple pool identification data from different machines can be a problem, especially when you have 8 identical minor (Antiminer) management. In this article, we explore how the process is automated by Python and SSH.
Why automate?
Before diving into a solution, we explore why automation of this process is important:
* Competition
: No need to connect manually to each machine or update the pool identification information.
* Counted errors : minimize the chances of errors or forgotten parameters.
* Faster and tear configuration : quickly enable and quickly set the mining configuration.
Prerequisite
Before you start, make sure you have:
- Python installed on 8 machines (version 3.x recommended).
- SSH customer software (such as putty, paramiko) installed on each machine.
- Basic information on Linux or Unix commands and SSH protocols.
Configuration writing: Get_Pool_crentiaals.py
Create a new file called Get_Pool_creditals.py on the following code:
Python
That paramic
List of Pool's identification data to restore (replace with your real values)
Poolit = [
{
"Host": "Pool1.example.com",
"Username": "Your_username",
'Password': 'Your_Password'
},
{
"Host": "Pool2.example.com",
"Username": "Second_USername",
'Password': 'Second_Password'
}
]]]]
Ssh connections
ssh_client = paramiko.sshclient ()
ssh_client.Set_missing_host_key_policy (paramiko.autaadpolicy ())
Def Fetch_Creditals (swimming pools):
Swimming pool for swimming pool:
ssh_client.connect (pool ['host'], user name = Pool ['User Name'], password = Pool ['password'])
Print (F "{pool ['host']} ...") Restoring the identification data
Stdin, Stdout, Stderr = ssh_client.exec_command ('Get-Pool-crédentials-json')
Data = Studout.Read (). Decoded ()
Pool_creditals = JSON.LOADS (DATA)
Update Machine -specific variables
Machine_creditals = {}
For the machine [f'machine_ {i} 'i on the beach (1, 9)]:
User name = f'username_ {i} '
Password = F'Password_ {i} '
Machine_creditals [f'machine_ {i} '] = {
'host': swimming pool ['host'],
"Username": Username,
'Password': Password
}
Type updated identification information in the script data file
Open ('Machine_creditals.json', 'W') Like f:
JSON.
Print ("All Identification Information has been returned and written in Conech_creditals.json")
If __nimi__ == '__Main__':
Fetch_creditals (swimming pools)
'
This script:
- Connect to each swimming pool with SSH.
- Fill in the references of the swimming pool in JSON format.
3.
- Type the updated details of the JSON file calledConche_creditals.json
.
To complete the script
- Save the scriptGet_pool_crentials.py.
- Install the required packages:
PIP Install Paramiko
on all machines.
- Run a script with python (for example,
Python get_pool_creditals.py
).
This restores and updates the 8 variables characteristic of the machine with the identification of the right pools.
Troubleshooting
- If ssh connections fail, check network problems or non -light identification information.
- Be sure to update the pool identification data to regularly avoid obsolete data.
- Consider implementing error management in a production environment.
By automating the Python and SSH in this process, you save time, reduce errors, and utilize multiple swimming pool identification data to control 8 identical mining machines.