It’s been many years since I’ve worked on this blog. This is my first post after converting from b2evolution to WordPress. Hi!
I just got my first ASIC miner in the mail this weekend. After an update, brown out, and passing out on the keyboard and causing a crash, I decided that it would be safer and financially smarter to have my miner run as a service. Blah blah blah, here’s the steps:
1. Download and install nssm.
You can find nssm at http://nssm.cc/download/?page=download. It is a zip that contains a 32 bit and 64 bit version. Find the nssm.exe that matches your version of windows and copy it to C:\Windows\System32 or any directory in your PATH environment variable.
2. Download and install bfgminer
bfgminer supports multile pools on the command line. This is important. You could probably substitute any command line miner here, but this is what I’m sticking to until I hear better.
bfgminer can be downloaded at https://github.com/luke-jr/bfgminer/archive/bfgminer.zip. Just unzip that to anywhere. Let’s say C:\bfgminer.
3. Setup your miner as a service!
Open a command prompt with Windows Key + R then enter cmd into the input box. This will open a command prompt. Then, in the command prompt enter something like:
nssm install "Bitcoin Mining Service"
You may call your service whatever you want. Just use quotes if it’s more than one word.
Installing Bitcoin Miner Service in Windows
If it works, you should get the below window. Point it to your install of bfgminer.exe and use options like:
--api-listen --api-network -o http://api.bitcoin.cz:8332 -u d3k4y.worker1 -p xrhW8WBb -o http://us1.eclipsemc.com:8337 -u dkubica83_BFL30 -p xrhW8WBb -o http://us2.eclipsemc.com:8337 -u dkubica83_BFL30 -p xrhW8WBb
*Note: The first 2 switches are optional, but needed for the BONUS! step. You may specify -o, -u, and -p as little or many times as you want. These are just your pools. The api switches let you use the miner.php file that comes with bfgminer for some control and insight. Use XAMPP or something to host it.
*Note: If you are using an ASIC miner and don’t want to use your GPU at all, add
to the front of the options.
Installing a Bitcoin Miner as a Windows Service
If all goes well, you will get the message:
Bitcoin Miner as a Windows Service Success
4. Start the service!
Hit Windows Key + R then enter:
You should see your newly created service. Right click it and select “Start”. You should now hear your GPU or ASIC hardware star making a lot more noise. That means you are golden. Double check with your mining pool to be sure.
Now, everytime you reboot, you will automatically start mining in the background. As long as your computer starts, you will be mining. If you want to stop for some reason simply stop the service. Want to quit mining for a while? Disable the service.
I DO accept tips BTW
Sure, running your miner as a service won’t let you stare at the command prompt, but this will give you lots of cool stuff to stare at as you dream of Bitcoin riches. Here’s one way to use the miner.php file to watch per processor speed, temperature, shares, per pool difficulty, speed, stratum status, and a bunch of network info.
The first thing you need is a way to compile/execute miner.php. That means a web server that speaks PHP. XAMPP will do the trick. You can download XAMPP at http://sourceforge.net/projects/xampp/files/latest/download.
1. Install XAMPP
Once the XAMPP installer is downloaded, disable your antivirus so some false positives don’t mess everything up. Web servers listen on port 80. To some AVs, this can look like a backdoor or trojan or whatever sex related term scares you the most. All you really need is Apache and PHP. The rest of the stuff is optional for this project. If you know PHP or plan to learn it, then maybe install MySQL for later adventures. FileZilla, Mercury, and Tomcat is up to you. Click “Next”, “Agree”, whatever.
Just try to remember where you installed XAMPP to for the next step.
2. Put miner.php on your local web
Navigate to the directory that you unzipped bfgminer. “miner.php” is in the same directory as your bfgminer executable. Copy miner.php and then navigate to your XAMPP directory. In there is a folder called “htdocs”. This is your web root. Paste miner.php into htdocs.
3. Start Apache
Start > All Programs > XAMPP > XAMPP Control Panel. You should now see the XAMPP Control Panel. Before you start Apache, click config. Set the Apache ports to 80, and 443 for SSL unless you know a reason not to. If you have extra RAM and CPU to spare, or only use this computer for mining, click the red X on the left of Apache and make it run as a service. This way, Apache starts automatically when you boot. Just like the miner in the top steps. Now, click “Start” next to Apache.
4. View miner.php!
Open a web browser, Chrome seems to work best at the moment, to http://127.0.0.1/miner.php. If yo weren’t aware, that’s your computer. You should see a pretty ugly table of stats and some fun buttons. Now you can see all the info about your Bitcoin mining service.
Just another reminder:
I accept tips in BTC: