Proof of Work
Specialized tooling is an underappreciated but critical component of the Bitcoin ecosystem. As the base layer in the ecosystem’s technology stack, Bitcoin’s core protocol does not include all the functionality necessary for every type of user to easily participate in the network. In response, a wide range of tools have emerged to facilitate certain forms of participation, including light clients to simplify payments, mixers like JoinMarket to help anonymize coins, and several services and protocols to streamline mining operations.
The Stratum protocol is arguably the most important tool in the latter category. It provides a standardized way for mining pools to communicate with their miners, and has been adopted by every major pool on the network. Stratum’s design choices have profoundly impacted the evolution of Bitcoin and facilitated the proliferation of pooled mining.
In its current form, pooled mining divides the task of mining between two groups: pool operators, who order transactions and assign block templates to miners; and miners, who attest to them by creating the actual proofs of work.
Put differently, the current pooled mining model depends on a transaction sequencer orchestrating a group of workers. This division of labor introduces a principal-agent problem into Bitcoin mining, with the miners bearing the brunt of the operational risks while the pool operators have little skin in the game.
The protocol’s architecture also makes other tradeoffs, some of which are detrimental to the network’s decentralization, transparency, and security.
However, the Stratum developers are building a second version of the protocol called Stratum V2. Its modified architecture would shift the responsibility of transaction ordering to miners to avoid the conflict of interest implicit in the first version of the protocol. As a result, Stratum V2 would protect miners from dishonest pools and strengthen the network against other attacks.
In this article, we’ll discuss Stratum V1’s deficiencies and how Stratum V2 remedies them. We’ll also assess the challenges and impacts of a successful migration, and the relationship between Stratum V2 and out-of-band payments.
A Brief History of Mining
In Bitcoin’s Proof of Work consensus model, miners compete to append new blocks to the blockchain by solving a computationally hard problem. Each block, the first miner to solve this puzzle is rewarded with newly issued coins and the transaction fees of the transactions included in the block. Mining therefore also serves to initially distribute new coins in a fair way, and is the only method by which new coins can be minted.
While Bitcoin mining in the network’s very early days was dominated by solo miners, pooled mining quickly emerged as an alternative. The first mining pool, Slush Pool, began mining in December 2010, less than two years after the Genesis Block.
To add a new block to the blockchain, miners must find and present a block header hash below the network’s current target, which is determined by its difficulty. They do this by repeatedly hashing said block header with a different kicker, called a nonce. The difficulty parameter adjusts roughly every two weeks depending on the frequency with which blocks have been found.
As finding blocks at all, let alone consistently so, has become progressively more difficult for individual miners, pooled mining has become the predominant way in which miners interact with the network. By coordinating and sharing revenue with other miners in a pool, an individual miner can dramatically reduce the volatility of their payouts. In exchange for this reduction in variance, the miner pays a low-single-digit percent-revenue fee to the pool’s operator.
Most pools today also provide financial services that eliminate block-finding variance for miners and can improve their operations. In the short run, these services also align incentives somewhat by exposing pool operators to chain-level risks, giving them a vested stake in the network’s success.
Virtually all mining pools communicate with their miners through Stratum, a protocol originally developed in 2012 by Marek “Slush” Palatinus, the founder of Slush Pool. Like Slush Pool, the protocol’s reference implementation is currently maintained by Braiins. The version of Stratum in use today, Stratum V1, relies on communication between two parties: servers run by the mining pool, and proxies run by miners.
Servers coordinate miners by selecting and ordering transactions into a block template and assigning miners to create proof-of-work attestations for this template. Servers are also responsible for paying out miners in proportion to the amount of work submitted.
Meanwhile, miners who attempt to solve the proof of work for the assigned template can submit partial proofs of work in exchange for shares. Partial proofs of work are solutions to a higher target than the one specified by the network—in essence, answers to an easier puzzle that prove that some work was performed while not actually solving a block—and shares entitle the recipient to a proportionate payout from the pool. This allows miners to get paid based on the actual work they did, not merely their luck in the hash lottery.
Life Imitates ArchitectureMost pools
rely on the Stratum protocol to coordinate tasks and communicate with miners, but Stratum V1 has several structural issues and is in need of an upgrade. These deficiencies in the protocol’s architecture stem from incompatibilities with the economics of Bitcoin mining.
The mining pool industry is oligopolistic—the number of pools with substantial hashrate is not particularly large, and the number of colluding pools needed to perform a 51% attack on the network is even smaller.
In and of itself, this fact is both unsurprising and unconcerning, as several factors ensure that the mining pool industry trends toward concentration.
The first of these factors is an industry-specific trait: the variance inherent in finding blocks favors large players. Firms with a low cost of capital are better-able to overcome dry spells, allowing them to avoid passing mining variance risk to miners without charging a high rate. Running a mining pool is also operationally capital-intensive, entailing significant infrastructural costs. These factors favor entrenched players and incumbents in neighboring industries with easy access to capital.
The mining pool industry is highly horizontally-integrated, with several companies from neighboring industries operating pools for both financial and strategic reasons. These well-capitalized players include hardware manufacturers like Bitmain, as well as exchanges like Binance and Huobi. The mining pool vertical’s presence at the crossroads of several larger industries makes running an upstart operation difficult.
Running a mining pool is a commodity industry, with few opportunities for differentiation beyond reducing fees. While some differentiation is possible—pools can compete by mining on multiple chains to maximize revenue, or by engineering creative payout mechanisms to absorb mining variance—mining pools are ultimately caught in a race to the bottom.
Bitcoin will continue to function with few mining pools: blocks will continue to be produced and the network’s incentives are still largely aligned. That said, a more centralized network is significantly less robust to attacks at both the technical and social layers than a more decentralized one. All else equal, having a greater number of competing transaction sequencers is better for the network than having fewer. And because of the industry’s underlying economics, any attempt at decentralizing mining must accept that the number of competing pools is likely to remain small.
Under Stratum V1, pools are responsible for ordering transactions. This is dangerous because it grants a pool operator sufficient hashpower to perform double-spends or censor transactions without owning the necessary hardware. In strengthening pools, which are few in number, at the expense of miners, which are numerous, this architecture ultimately hurts decentralization.
Stratum V2 addresses concerns over decentralization by allowing miners, rather than pool operators, to order transactions through an optional feature called job negotiation. By granting miners this ability, Stratum V2 can help keep Bitcoin decentralized in the face of oligopolistic competition between pools.
In addition to increasing network centralization, the current pooled mining model also reduces transparency in mining.
The concentration of power in the hands of pools has led to the emergence of out-of-band payments, in which a pool receives compensation for including a transaction in a block outside of Bitcoin’s protocol-specified fees.
To give a simple example, a user can “bribe” a pool with an off-chain payment method like PayPal or credit card to include a single transaction in a block. This feature, colloquially known as transaction acceleration, has been implemented by several pools, including BTC.com, Poolin, and ViaBTC, and can be useful if the original network fee was set too low.
But an out-of-band agreement could also take the form of a long-term contract between a pool and a frequent transactor like an exchange. Both parties would reduce their exposure to volatile fee rates: the exchange would be able to guarantee prompt withdrawals for its users without incurring unforeseen costs, and the mining pool would ensure a steady stream of income.
Out-of-band payments are difficult to audit, and provide a potential avenue for mining pools to avoid sharing fees with miners. Due to fee volatility, it’s nontrivial for miners to attribute systematically low fees in blocks mined by a pool to anything other than chance. To catch a malicious pool, a miner would instead need to compare the transactions in their own mempool to those in the block template. This process would need to be performed in real time, since there isn’t any canonical historical mempool. What’s more, any discrepancies couldn’t necessarily be attributed to bribery as opposed to differences in node placement.
The controversial practice brings to light the misalignment of incentives between the pools, which are capable of receiving unshared extra-protocol payment, and miners, who actually perform the work necessary for the transaction to be included on-chain.
Stratum V2 limits the threat posed by out-of-band payments in the same way it fights centralization: by enabling job negotiation and allowing miners to order transactions themselves. In giving miners this responsibility, Stratum V2 enables greater decentralization at the network level with only a small number of competing pools, and makes it more difficult for pools to short-change miners.
The current Stratum architecture has several other features that negatively impact miners. These disadvantages provide reason for miners to demand V2 support from pools.
Stratum V1 messages are unencrypted, opening up the possibility of hashrate hijacking attacks, in which an eavesdropper steals a miner’s work submission and takes credit for it. While hashrate hijacking has not been verifiably observed on a significant scale, it represents a substantial theoretical attack vector. This issue is addressed in Stratum V2 by encrypting communications between the server and the proxy.
Stratum V1 inadvertently incentivizes miners to mine on an empty template for the brief period after which a new block is mined. By separating out the transactions in a block from the previous block’s hash, Stratum V2 allows pools to select which transactions will be included in a block in advance, disincentivizing empty-block mining. This optimization will ultimately lead to a reduction in wasted block space and an increase in revenue from fees if adopted.
Stratum V2 also implements several minor efficiency-improving updates. These improvements include the addition of header-only mining, which reduces the amount of work required for miners to process templates, a migration from JSON-encoded messaging to a lighter-weight binary-encoded format, and the adoption of zero-time backend switching, which allows miners to switch between pools and networks more efficiently.
The successful adoption of Stratum V2 would have enormous implications for Bitcoin’s decentralization. There are also several tailwinds facilitating its adoption, including the option for pools to add support for the protocol one-by-one.
That said, there are also several hurdles to a successful migration. Stratum V2 requires miners to run compatible firmware, and while Stratum V2 is supported by Braiins OS, manufacturer firmware adoption will likely be required in order to reach the majority of the market.
For pools, the increase in efficiency may not be sufficient to justify the cost of switching, despite the availability of a translation proxy facilitating migration. Hashrate hijacking does not affect pools’ bottom line, only that of miners, and the revenue lost to inadvertent empty block mining is small. Competing protocols like Poolin’s BUMP also threaten to balkanize the mining software landscape, increasing pool-switching costs and weakening Bitcoin’s security model.
The most potent first-order disincentive for pools to adopt Stratum V2, though, comes from the change in dynamic between pools and miners that job negotiation entails. By moving the responsibility of fee optimization to miners, miner-side transaction selection fundamentally alters the relationship between these two parties.
Where pools were previously the primary recipients of out-of-band payments, Stratum V2 enables large mining farms to extract the surplus from these agreements, reducing the on-chain fees processed by these miners.
Stratum V2 accounts for fee variability across templates by issuing shares to miners based on the block reward they process. This countermeasure obviates the negative effects of the behavior on other miners in the pool. While operators offering variance-reducing payout schemes may accordingly need to absorb some additional risk, this risk will likely be negligible compared to the existing luck involved in finding a block.
Even with this feature, though, pools would find themselves unable to negotiate contracts for out-of-band payments in a world with widespread job negotiation adoption. Counterintuitively, eliminating this revenue stream could be good for some pools, namely those that do not accept out-of-band payments, whether on principle or due to practical limitations.
In other words, adopting miner-side transaction ordering serves as a sort of proof of honesty for pools, not unlike an exchange performing a Proof of Reserves attestation. Miners could come to demand this, and mining pools that are not dependent on out-of-band payments could step in to meet this demand by adopting Stratum V2 with job negotiation. In combination with miners’ demand for Stratum V2 adoption for its improvements to operational efficiency, this could prove sufficient to convince pools to adopt the protocol.
Against the backdrop of the mining pool industry’s race to the bottom on fees, then, provable honesty represents another dimension along which pools could compete: adopting Stratum V2 could be one way for pools to attract and retain miners in an ever-more-competitive industry. While Stratum V2 faces significant hurdles to adoption, its success would be good for Bitcoin.