BetterHash Protocol Lets Pool Miners Regain Control Over Their Hash Power
One problem that concerns many is the centralization of mining within the Bitcoin ecosystem. Fortunately, there are talented developers working to solve this problem and Matt Corallo, full-time Bitcoin developer at Chaincode Labs, is one of them. His BetterHash Mining Protocol is intended to significantly decrease the problems associated with mining pool centralization.
What Are Mining Pools?
First, it is important to understand there are different types of miners on the network. For the purpose of this article, we’ll refer to a “solo miner” as someone who mines alone, a “hasher” is someone who mines in a mining pool, and a “pool operator” controls the mining pool.
Solo mining is risky, as there is only a relatively small share of hash power contributing to the generation of the block. When a solo miner finds a block the reward may be larger, but the payouts will be less frequent. For this reason, many miners join pools so that they can receive frequent payouts of smaller amounts. Pooling is when a number of miners (hashers) join together and pay their block rewards into a single pot. When any of them finds a block, instead of getting the entire block reward, the amount gets distributed to all of the hashers in the pool proportionate to the amount of hash rate they contribute to the network (minus a fee for the pool operator). This way, a smaller hasher receives consistent payouts on a daily — and, in some cases, hourly — basis.
Overall, the primary function of a mining pool is to provide consistent payouts to miners so that they can reduce their risk. Mining pools also serve important secondary functions that improve the overall network. For instance, a smaller and less technical miner may not want to deal with the complexities a pool operator faces such as block propagation, block creation and other highly technical matters. Joining a mining pool gives less-technical miners a simple way to access the network so they can focus on their strengths, such as running an efficient mining business or locating cheap power.
However, because of this, currently only a few, large mining pools dominate the network, which results in a high degree of centralization within the system.
What Is Stratum?
Stratum is the protocol layer between mining pools, clients and mining hardware. Users connect and communicate with the pool through the Stratum protocol. On a mining hardware device such as an ASIC, there is a control board which runs a variant of software, such as CG Miner, which then “speaks” Stratum and connects to the pool. The pool tells the ASIC what to work on, and the ASIC responds by submitting back shares to the pool. A share is work that an ASIC has done, essentially not-quite valid blocks, but enough to prove that the miner has contributed work for the pool.
“Difficult to implement and poorly documented, the design of the Stratum protocol requires pool operators to build and distribute block templates to their clients. Without a diverse body of miners constructing block templates, the network’s censorship resistance is jeopardized (e.g. pool operators may use their position of power to restrict the flow of protocol upgrades).”
With Stratum, a pool operator confirms that each miner has contributed work for the pool. The pool operator is also responsible for creating a block template which handles transaction selection. With the inability to create a block template, miners have no control over what they are mining. A pool operator controls the entire pool’s hash rate.
This is problematic because a pool operator, or a small group of pool operators, could potentially collude by using this hash power to perform malicious attacks on the network. A bad actor with this amount of hash power could initiate a 51% attack and perform double spends or censorship on the network. Alternatively, if a malicious actor were to hijack a pool’s DNS server or IP space, an attacker could steal hash rate until all the miners power cycled their ASIC hardware.
BetterHash vs. Stratum
BetterHash is intended to prevent these kinds of attack vectors because it is designed to allow users to run their own full node and build their own block template. Building your own block template means you can select your own transactions; for example, transactions which may have otherwise been censored. Additionally, miners can select which blocks they are mining on in order to prevent double-spend attacks.
Although block templates are customizable, pools will continue to act as they normally would, redistributing block rewards relative to hash power with the same business properties and payout frequency.
Corallo commented in an interview with Bitcoin developer Jimmy Song:
“We could have just one pool for the entire network, and it wouldn’t really be a big deal.”
BetterHash Protocol Overview and the Advantages of Weak Blocks
BetterHash is comprised of a set of protocols which, when combined, are intended to provide more documentation, efficiency, security and decentralization to mining pools. In Matt Corallo’s BIP, he describes the two main protocols in “BetterHash: Work and Pool.”
“The work-carrying protocol replaces both getblocktemplate and Stratum when passed directly to mining hardware, while the payout protocol manages all pool<->client communication. The segregation of these functions provide pool participants with the ability to construct block templates with transactions they (or another pool of their choice) have selected while the pool oversees the distribution of payouts.”
These protocols provide hashers with the information on how they should build a coinbase transaction (the block reward) as well as where to send the mining reward. Additionally, they provide users with the information on how to upload shares to the pool so miners can prove they have contributed work for the pool. Overall, the separation of these two protocols enables hashers to create custom block templates while still receiving the economic benefits a mining pool offers.
An additional feature of the pool protocol is the ability to send weak blocks, which helps pools optimize block propagation. Corallo describes this protocol in his proposal:
“The Pool Protocol has an optional additional feature for pools which wish to optimize block propagation, whereby clients send WEAK_BLOCKs to the pool server so that uploads of full blocks are efficient.”
Weak blocks are not a new idea, but they can be beneficial when implemented successfully. Weak blocks are shares that users frequently submit to a pool. Remember, a share is work that has been performed by mining hardware but is not enough for a full block. Every time the pool finds a new block with the same difficulty as an old weak block, the pool can send a compressed version of the weak block and compare it with the new block. Users of the pool submit valid shares via WINNING_NONCE or SHARE/WEAK_BLOCK messages. This comparison allows the pool to upload full blocks faster and ultimately increase mining efficiency.
Although BetterHash is intended to give back power to the miners, it takes technical knowledge to create a block template. Not all miners want to deal with these complexities. For this reason, Corallo explained that he is not expecting less technical miners to switch to BetterHash overnight:
“Pools optimize software on behalf of their users. For this reason, I don’t think a lot of pools (hashers) have interest in adopting a protocol (BetterHash) like this when it requires them effort such as managing and running a full node.”
Criticisms of BetterHash
While many are optimistic about BetterHash’s potential to decrease mining centralization, Corallo’s proposal has received some criticism. One of the most prominent criticisms of BetterHash came from Eric Voskuil, Libbitcoin developer and founder of Bitware Co. Voskuil’s primary argument is that BetterHash does not meaningfully decrease decentralization. He described his perspective on GitHub as well as in a Twitter discussion:
“This proposal [BetterHash] does not increase the security of #bitcoin through increased decentralization, it merely shifts the point of centralization. This is essentially the same flaw that he [Matt Corallo] produced in his work on relays.”
The reason BetterHash is criticized for “merely shifting the point of centralization” is because pool operators still maintain a large amount of control as they could force hashers to censor certain transactions at the threat of not receiving payouts.
In response to this argument, Corallo told Bitcoin Magazine:
“While it is true that pools could still exert influence over their clients by telling them to run certain rules or they will refuse payouts, this requires active action on the part of both the pool and the client. Today, a pool could simply switch without telling their users and it would require some significant effort on the part of the clients to even discover this, let alone inform other users of the same pool and switch to a competitor. With Betterhash, a pool would need to inform their users, at which point it would be easier for users to switch pools than to switch out their nodes.”
Although the software to build a mining pool and use BetterHash is currently available, no large mining pools are using it. Today, Corallo continues to work on (among other things) increasing the adoption of BetterHash so miners will have additional options in the future.