Parent PR #29432. Followed by #30315.
This is the first part of the Stratum v2 Template Provider change that can be a standalone pull request.
It introduces a CMake build flag -DWITH_SV2 that is OFF by default (but ON for CI).
The Noise Protocol Framework is defined here: https://noiseprotocol.org/noise.html
It's quite similar to BIP324. The main differences are explained here, including why Stratum v2 can't use BIP234 (yet): https://delvingbitcoin.org/t/stratum-v2-noise-protocol-bip324-nuggets/413
The implementation is based on revision 38, 2018-07-11 (most recent at the time of writing).
The Stratum v2 spec defines the specific choice of ciphers: https://github.com/stratum-mining/sv2-spec/blob/main/04-Protocol-Security.md
This protocol has been implemented in the Stratum Reference Implementation (SRI, using rust-bitcoin). https://github.com/stratum-mining/stratum
It has also been (independently) implemented in BraiinsOS. This part is currently not open source, and it's behind on some recent changes.
The classes in sv2_noise.h attempt to stay close to the paper, whereas the test and fuzzer code borrow heavily from BIP324.
It's ready for review, but not for merge:
- The parent PR may need more conceptual review (and perhaps the entire spec, but that would really slow things down)
- We could decide to not support Noise encryption at all and require users to install separate software for that. Code review of this PR could help inform that decision.