en
Back to the list

Why Bitcoin Mining Needs Stratum V2

source-logo  bitcoinmagazine.com 06 March 2023 13:35, UTC

This is an opinion editorial by Federico Rivi, author of the Bitcoin Train newsletter.

Bitcoin mining within everyone's reach: household appliances, wearable devices such as smartwatches and smart glasses, all capable of mining with specialized microchips. This is the future that many Bitcoiners hope for.

While such a scenario might not be so far from the reality that awaits us, today we are still in Bitcoin’s genesis chapter and the reality is not yet as Antonopoulos predicted. In fact, mining is centralizing.

Last month, Foundry USA coordinated 34% of the hash rate alone. If we add Antpool, whose share is 18.2% of total hash rate, we have 52% of Bitcoin's global computational power in the hands of just two mining pools.

Pointing out the problem with this centralization recently was the well-known Bitcoin developer Peter Todd:

“Bitcoin is dead.” “Mining is over.” “They will regulate Bitcoin.” “Censorship will come.”

I can hear you already, but we should remain calm. To understand what the implications are — and what the solutions are — we need to take a step back and review the concept of “pool mining.”

The Evolution Of Pool Mining

Would you rather receive $100,000 once every five years or $20,000 once a year? The answer to this question by most explains the emergence of mining pools.

In the long run, the payout is the same, what changes is the frequency with which the payment is received. In a highly-competitive environment like mining, this is crucial. It can determine the survival or bankruptcy of mining farms that — regardless of the change in the price of bitcoin — must keep machines running by paying for electricity, as well as any loans taken out to purchase hardware or other expenses.

A mining pool is a server, usually run by a company, that unites mining farms and individual miners located in different areas, pooling their computing resources and combining them as the product of a single team, participating in the competition that is bitcoin mining. The high computing power that is coordinated by the pools makes it possible, compared to the slim chances of the individual miner, to win the proof-of-work competition more frequently and to redistribute the reward to all of its members in proportion to the computing power they have provided.

Let's take an example: Running a mining farm that produces 0.025% of the global hash rate — an activity that today entails a multi-million-dollar investment — probabilistically allows the miner to write one block of the Bitcoin blockchain in every 4,000. Considering the average rate of one block produced every 10 minutes, this means one block reward earned per month, currently worth 6.25 bitcoin.

With the same computing power available, however, one can choose to join a mining pool that controls, say, 25% of the global hash rate. Statistically, the pool is likely to mine one block in every four, i.e., one every 40 minutes. The mining farm that has decided to join is remunerated in proportion to the computing power it provides, so it will always bring in the equivalent of one block per month, but being paid on average once every 40 minutes (more commonly, pools pay the rewards once per day to reduce fees).

Joining a pool makes the future more predictable as the payouts, though not necessarily being any higher than in solitary mining, are more frequent. The first pool came into being in 2010 under the name Slush Pool, now known as Braiins Pool, and since then, the model has depopulated.

As described above, much of the computational power of the network is now in the hands of the pools, which inevitably constitute centralization points.

So, what is the current state of mining and what are the risks?

The Rise Of Foundry USA

On February 15, 2021, Foundry USA Pool coordinated 0.98% of the hash rate. Two years later, the figure has risen to 34%. What has happened in the interim?

Foundry is a New York-based company wholly owned by Digital Currency Group (DCG), one of the world's largest “crypto” investment funds. Among Foundry's various activities is mining, which is carried out by its Foundry USA Pool business, which has become the de facto benchmark for U.S. institutional miners.

It is no coincidence that Foundry's growth coincides in part with the Chinese mining ban of May 2021. As widely reported at the time, many of the miners fleeing China flocked to Kazakhstan as well as the United States. One of the favored destinations has been Texas, which is now considered one of the most favorable areas in the world for mining, not least because of the friendly regulations.

In a recent interview, Gabriele Vernetti, a mining researcher and Stratum V2 developer, told Bitcoin Magazine that “most of the miners located in Texas are under Foundry.”

There could then be another reason behind the American pool's ride: the massive investment in new ASICs at a time (the bull market between late 2020 and early 2021) when many competitors could be more focused on profit taking. In September 2020, for example, Foundry had signed a partnership with ASIC manufacturer MicroBT to provide priority access to new M30S ASICs to its institutional miners.

Several months can pass from the purchase of an ASIC to the start of its operation, particularly at a time when chips are unavailable. So, when the new hardware is ready to be put into operation at the end of 2021, what happens is that Foundry USA gains a large share of the market. It goes from 8.5% in October 2021 to 19% in January 2022, for instance.

What Are The Dangers Of Mining Centralization?

Why is it a problem that Foundry USA coordinates 34% of the global hash rate? Because to date, although the pool's computing power is provided by a vast number of different mining farms, the candidate blocks are built by the pool. It is the pool that decides which transactions to include in the block. This introduces a point of vulnerability that could lead to two problems: censorship of transactions or addresses and a 51% attack. The latter can have two purposes:

  1. Denial of service: An intentional mining of empty blocks that slows down the network by preventing transactions from being approved. With 34% of computing power, this would probably be every third empty block.
  2. Double spending: Cancellation of a transaction made by the attacker and placed in a recently-approved block via a blockchain fork.

The threat is made possible by the current protocol that is used by miners and mining pools to communicate with each other: Stratum V1.

However, we know what the solution is and its name is Stratum V2 (detailed below). At the moment, Braiins Pool, Foundry USA itself and a team of independent, open-source developers are working on it. The latter group includes Vernetti.

Is there a possibility that, under a hypothetical U.S. obligation, Foundry USA could start censoring specific transactions?

“On a technical level, it could happen,” said Vernetti. “But for how long? The longer the censorship lasts, the more time miners have to realize this and start shifting their activity to other pools. This is because censoring implies the loss of commissions, so a miner has an economic incentive to move to a pool that collects those commissions instead by avoiding censoring transactions.”

The MARA Pool Precedent

A relevant precedent in this regard dates back to May 2021. The pool controlled by Marathon, MARA Pool, had decided at the beginning of the month to only mine blocks with OFAC-compliant transactions, thus censoring addresses blacklisted by the U.S. Treasury Department. The uprising of the Bitcoin community and the fact that no other miner followed suit caused MARA Pool to turn around in less than a month. At the end of May, Marathon wrote in a press release that it would no longer filter transactions.

The danger of censorship, therefore, seems to be minimal and, in any case, easily resolved in a short time. So, how likely is a 51% attack led by Foundry USA instead?

“The moment a denial-of-service attack was launched, i.e., mining of empty blocks to slow down the transaction approval process, everything would be visible on the blockchain,” Vernetti said. “Then, immediately, the miners would redirect their hash rate to other pools. This is because, with no transaction fees, each miner would receive less money for their work. The miners would have a direct incentive to provide the hash rate to another pool, an operation that takes only a minute. If Foundry USA started mining empty blocks, in my opinion it would lose half of the hash rate it coordinates within an hour.”

“Perhaps a 51% attack aimed at double spending is more worrying,” Vernetti continued. “On a technical level, one could attempt to double spend even with a lower hash rate, but again, what would the reason be? Because it is true that Foundry USA is seen as a U.S.-controlled, institutional pool, but it is still a business. Its economic interest is to make the network work as well as possible. A double spend would undermine Bitcoin's status as an immutable network and I imagine that it could cause its price to collapse immediately. The counter-incentive would consist of perhaps $1 trillion paid by the U.S. to carry out such an attack.”

The Solution: Stratum V2

The risk of censorship and the risk of a 51% attack by mining pools will be eliminated once a new communication protocol between miners and pools is extensively used: Stratum V2.

The protocol allows each individual miner to build its own candidate block, removing this power from the pool. The pool will therefore not be able to exclude blacklisted transactions from a block, nor will it be able to write empty blocks or attempt double-spending transactions. The responsibility for writing the block is shifted from the hands of the pool to those of all its miners.

Stratum V2 is already implemented by Braiins Pool and is periodically tested by Foundry USA itself, but the vast majority of the hash rate is still coordinated by pools using Stratum V1.

What are the incentives that will lead pools to adopt Stratum V2? What will lead them to voluntarily choose to lose control over block construction?

“The other two fundamental characteristics of the Stratum V2 protocol: security and performance,” answered Vernetti.

“Security: unlike Stratum V1, Stratum V2 is an encrypted protocol. It does not allow the hash-rate-hijacking attacks that are possible today. In these attacks, the hacker gets in the way of communication between the miner and the mining pool, takes the proof of work that the miner produces and pretends to be the author of those proofs, instructing the pool to send the reward to him. This cannot happen with Stratum V2 because the communication is encrypted and therefore the proof of work provided by the miner to the pool is not visible to outside observers. This is the first incentive: with such security, the pool can attract more miners than those that do not offer this guarantee.

“Performance: the communication between miner and mining pool in Stratum V1 is human readable, it is in ASCII code. In Stratum V2, on the other hand, communication is completely in binary code. This small factor increases performance because the conversion time from human readable character to binary is saved, so more packets of information can be transmitted in a given time frame than in Stratum V1. This is important because being able to provide more proof of work can be decisive in winning the race to write the block. Improved performance is a competitive advantage.”

This is a guest post by Federico Rivi. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.

bitcoinmagazine.com