阶层协议V2(Stratum V2)使用带关联数据的认证加密 (AEAD)，AEAD能确保敏感数据的加密性和完整性，从而让矿工的算力不能被窃取。BetterHash则针对中间人攻击的向量，提出了使用消息前签名(Pre-message signing)方法，尽管不如AEAD那样彻底。
An implementation of Stratum V2 is part of BOSminer, which is a free and open-source project developed by Braiins. This means that miners can download BOSminer and easily begin benefiting from V2 in their operations.
Miners need to interact with the Bitcoin protocol to submit their work and be rewarded. To standardize the communication between miners and Bitcoin protocol, an open-source “getwork” protocol was developed. It acted as a quick and easy solution for standalone miners to start mining. But by 2012, getwork’s inefficiencies had grown very problematic as mining underwent radical changes and network hashrate grew exponentially.
Mining profitability decreased and rewards were being paid out on a less frequent basis as more miners joined the network. It became apparent that miners needed to combine their hashrate to remain profitable. This led to the introduction of mining pools: services which enabled miners to earn rewards on a more consistent basis by combining (i.e. “pooling” together) the hashrate from many individual miners.
The first ever mining pool was developed by Marek “Slush” Platinus in 2010 and was called Bitcoin.cz. It was later renamed to Slush Pool and operations were handed over to Braiins, who continue running the pool to this day.
As data transfer requirements for pools grew exponentially, the limitations of the getwork protocol became even more apparent. This led Slush to develop the stratum protocol (Stratum V1) for communication between miners and mining pools in 2012.
During the Stratum V1 development, other members of the mining community had spent months developing an open-source protocol called “getblocktemplate“(BIP22) that would supersede the “getwork” protocol. With Stratum V1 being released near the same time, direct adoption for the getblocktemplate protocol suffered. However, Stratum V1 had shared a lot of the getblocktemplate mechanisms under the surface.
Over recent years, total network hashrate has grown exponentially and physical hashrate distribution has also improved. However, the fact that a majority of hashrate is ultimately concentrated in just a few mining pools leaves the network vulnerable to a (albeit very unlikely) 51% attack from a powerful state actor such as the US or China.
Taking control over mining pools within their jurisdictions would be essentially free for governments, whereas taking over physical mining operations or setting up their own physical mining operations would be complex and incredibly costly. Therefore, shutting off this attack vector is an important way to ensure Bitcoin’s long-term resilience to possible state attacks.
Today, miners depend on mining pools to assign them blocks to work on. If miners were empowered to construct their own block templates again — as all miners used to do in the early days of CPU mining — it would make a pool attack far more difficult to pull off.