Ethereum: Auto Adding Devices to BFGMiner

Ethereum: Automating Device Addition for BFGMiner

As a Bitcoin enthusiast, you are probably no stranger to manually adding devices to BFG Miner. The current method of entering device ports on every startup can be tedious and error-prone. Fortunately, we are exploring alternative solutions that allow you to automate this process.

Current Method: Simple Script

Your startup script is a good example of how manual input can work:

bfgminer -o stratum.bitcoin.cz:3333 -u ...

This sets the device port and username, but doesn’t actually add the devices yet. To automate this process, we need to implement an additional step.

Introducing the bfgminergen Script

The “bfgminergen” script is a tool specifically designed to create BFGMiner configurations and automatically add them to your device list. You can find more information about bfgminergen in the official GitHub repository: [

Here is an example of a “bfgminergen” script that you can use to create a configuration:

#!/bin/bash








Ethereum: Auto Adding Devices to BFGMiner

Specify device ports and usernames for each blockchain

stratum1=(

"192.168.0.100:3333" "stratum.bitcoin.cz"

"192.168.0.101:3333" "stratum.bitcoin.us"

)

stratum2=(

"192.168.0.102:3333" "stratum.bitcoin.co"

"192.168.0.103:3333" "stratum.bitcoin.at"

)


Specify devices and their corresponding ports

devices =(

"Block 1" "192.168.0.100:3333,192.168.0.101:3333"

"Block 2" "192.168.0.102:3333,192.168.0.103:3333"

)


Create BFGMiner configuration

cat > config.json 2> /dev/null <

{

"devices": {

"$("stratum1[0]" + "|$(stratum1[1])")" : true,

"$("stratum2[0]" + "|$(stratum2[1])")" : true

},

"port": "3333",

"username": "stratum.bitcoin.cz"

}

EOF


Save the configuration to a file and add it to your device list

cat config.json >> /dev/null > bfgminer.conf


Now you can add devices with the following script:

#!/bin/bash

echo "Enter device port:"

read devport

echo "Enter username:"

read devusername

echo "$bfgminer.conf"

bfgminer -o stratum.bitcoin.cz:$devport -u $devusername

Running bfgminergen

To run the bfgminergen program, save it to a file (e.g. bfgminer-gen.sh) and make the script executable:

chmod +x bfgminer-gen.sh

Then run the script as usual:

./bfgminer-gen.sh > bfgminer.conf

This will create a config.json file with your BFGMiner configuration. You can then add this file to your device list using the provided script.

Tips and Variations

  • To save time, you can also use the "bfgminergen" script to create multiple configurations for different blockchains.
  • If you are using a Linux system, make sure you have set the correct permissions (e.g.chmod +x bfgminer-gen.sh`) before running it.
  • You may want to consider adding error handling and input validation to ensure your device list is accurate.

By automating the process of adding devices to BFGMiner using the “bfgminergen” script, you will save time and reduce errors. Happy mining!

ETHEREUM SUPPLY CASH


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *