bip324 implementation #161
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[DISCLAIMER]
This proposal needs bitcoin version 0.32.5 to work. That is why I have created this PR: #160 containing all the needed changes.
My proposal is primarily located in the reactor component. This approach maintains a clear separation between the Bitcoin protocol and encryption functionality, placing the encryption responsibility entirely within the transport layer.
Encrypted communication between Nakamoto nodes can now be enabled using the --p2p-v2 flag:
$ cargo run --release -p nakamoto-node -- --testnet --p2p-v2
As recommended in BIP324, I've implemented a fallback mechanism that reverts to V1 protocol when the V2 handshake fails.
I've added a test case (test_full_sync_v2) to verify successful V2 communication. However, I cannot currently test the fallback functionality in the test environment due to a limitation in Nakamoto's current state (please correct me if I'm wrong) - V1 Responder nodes hang when receiving unrecognized messages (in this case, the 64-byte ElligatorSwift-encoded public key). Despite this testing limitation, the fallback mechanism works successfully in the testnet environment, allowing connections to V1 nodes.