A version of this article was originally published on Medium.
In light of some recent awesome events in the Bitcoin mining sphere, I was inspired to set up my own small, four million hashes per second (MH/s) solo mining operation and see how I could improve it. A couple of the aspects that I thought could use some work are related to connectivity and in making my setup the most “pure” in the sense of decentralization and trustlessness.
So, I initially began digging into how exactly one solo mines in today’s exceedingly industrialized mining world. I’m not interested in pay-per-share pooled mining, since that drains any of the fun of solo mining, and introduces some trust. I want to directly contribute unadulterated hash rate security to the Bitcoin network.
Note: I am assuming the reader knows that solo mining is incredibly difficult and you are more than likely to never actually generate a block. Just full disclosure here. Having said that…
Years ago, solo mining required setting up a full, industrial-grade pool that was designed for thousands of remote individual miners pooling their hash rates together. I remember trying to set one up either using the Eligius code or one of the other not-as-well-known pool projects on GitHub and it was difficult to get all of the individual software components working. Knowing this, let’s just say I wasn’t getting my hopes up that mining solo was any easier today.
CK Pool has its own “solo” counterpart (which, I honestly love that this exists), and it’s a sort of pseudo-solo mining pool where individual miners get 98% of the block reward (paying a 2% pool fee) when they generate a block and the other pool participants get 0%. Contrast this with typical pooled mining where all hash rate contributors get a piece of the block reward. The Solo CK Pool is great, but ultimately using the pool introduces some trust that shouldn’t exist in a pure solo mining setup. There is some incompatibility with the latest Bitcoin Core version and the most recent CK Pool code as well, based upon my attempt at using it for this mining setup.
After scouring DuckDuckGo and GitHub issues, I stumbled upon BFGMiner’s ability to communicate with a local bitcoind for the purposes of solo mining(!). I had no idea this functionality existed since BFGMiner was typically used for interfacing with GPUs or ASIC hardware while mining.
Note: CGMiner also has this functionality. Thanks Con!
So, with this new BFGMiner knowledge, we can eliminate any difficult-to-set-up pool software, or any trusted pool, and only rely on BFGMiner and a Bitcoin Core full node. This fits the bill for my purist solo mining configuration.
This leaves the improvements to connectivity. How this can be bolstered is by using Blockstream Satellite to supplement the set of peers my node uses while my ISP is functioning, and as a failover in the event my ISP gets flaky and drops my connection. This way, my mining hardware can know what block is the latest block to build on and no effort is wasted.
An area of research is block egress, however. Options do exist like Starlink or Iridium that can be used for broadcasting a newly-found block. Starlink is probably overkill cost-wise due to the likelihood of actually solo mining a block, and blocks themselves being relatively small in size. But it is a good option. SMS is another option that I will explore in future blog posts.
How To Solo Mine Like A Boss
Guide assumes Ubuntu 20.04. Warning: some compiling is necessary.
It’s actually really easy now. There isn’t any need to set up a full-blown mining pool anymore. BFGMiner can handle everything we need. So let’s get everything set up.
Set Up Blockstream Satellite
Follow Blockstream’s excellent guide for putting together a satellite antenna, aligning it and installing all of the necessary software to start receiving Bitcoin data via geosynchronous satellite.
Install blocksat-cli and Bitcoin Satellite, the patched Bitcoin Core node that Blockstream maintains for satellite connectivity.
Set Up BFGMiner
BFGMiner is GPU/ASIC mining software that also supports solo mining using a local bitcoind!
This software will bridge our mining hardware to our local satellite Bitcoin node.
$ git clone https://github.com/luke-jr/bfgminer && cd bfgminer
For Ubuntu, all you need to do is install the dependencies and then build normally.
$ sudo apt install automake autoconf libtool pkg-config libcurl4-gnutls-dev libjansson-dev uthash-dev
Then build it.
With your bitcoind synced and receiving data via satellite (debug.log should output bitrate data if successfully receiving), point BFGMiner to your local node. Make sure to set server=1 and rpcuser=user rpcpassword=pass in bitcoin.conf
$ ./bfgminer -T -D -P -o ‘127.0.0.1:8332’ -O user:pass –stratum-port 3334 –generate-to <your address>
This will tell BFGMiner to pull data from your node and which port to listen on for stratum miners (basically all modern ASICs use stratum).
Once BFGminer is running, simply point your ASIC hardware to the IP address your bitcoind and BFGMiner are running on (port 3334) instead of a normal mining pool like Slush Pool. You should begin to start seeing low difficulty shares being submitted by the mining hardware in the BFGminer console output. That’s it! You’re solo mining like a boss and have a backup blockchain data source via geosynchronous satellite. How awesome is that? Good luck with the mining!
Learn more about Blockstream Satellite here:
This is a guest post by Grubles. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.