Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale P2P Network #6

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Scale P2P Network #6

wants to merge 13 commits into from

Conversation

hatmer
Copy link

@hatmer hatmer commented Feb 15, 2021

Non-breaking modification to P2P overlay that will allow the network to scale massively (still limited by hardware though).

@maybeast
Copy link
Contributor

Thanks for working on this.

Could you add a paragraph or two on how it achieves the scaling benefits?

@hatmer
Copy link
Author

hatmer commented Feb 18, 2021

P2P_Overlay_Stack

Overview
Bitcoin’s stochastic address manager is a well-tested gossip algorithm for a system running in the same domain (high-volume financial services) and environment (public internet with potentially hostile nodes) as the XUD network. It works well for Bitcoin and has changed very little in the past 10 years. It is not the cause of Bitcoin’s scalability/latency issues, those are due to the inefficiency of the PoW algorithm. The address manager is a modular part of the bitcoin daemon, i.e. it is involved in only the P2P aspects of the Bitcoin network.

Attack vectors this improvement protects against

  • Eclipse Attack: most (if not all) of your peers are malicious and they prevent you from being well-connected to the network
  • Sybil Attack: a malicious actor spams the network with nodes that they control in order to subvert the network

How it works
Addresses are organized into buckets.

  • Addresses that have not yet been tried go into 1024 "new" buckets.
  • Addresses of nodes that are known to be accessible go into 256 "tried" buckets.
  • Bucket selection is based on cryptographic hashing, using a randomly-generated 256-bit key, which should not be observable by adversaries.

How it integrates into opendexd's existing P2P network
It replaces the nodes map in NodeList.ts with an instance of the AddrMan datastructure.

Copy link
Contributor

@maybeast maybeast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be an awesome feature to get in once we have confirmed it works reliably. Needs extensive manual testing.

Please fix the CI builds and clean up the code from comments and unnecessary console logs. I'll start manual testing afterwards.

@hatmer hatmer marked this pull request as draft February 21, 2021 17:56
@maybeast
Copy link
Contributor

@hatmer looking at the build failure some of the P2P networking tests did not pass. They'll probably need some refactoring to be compatible with your changes.

@hatmer
Copy link
Author

hatmer commented Feb 24, 2021

Yes, I am still trying to figure out why the tests fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants