Skip to content

ASN-based bucketing of the network nodes #16599

@naumenkogs

Description

@naumenkogs

Currently we bucket peers (or potential peers) based on /16 network groups which directly correlate to the IP-addresses. This is done to diversify connections every node maintains, for example to avoid connecting to the nodes all belonging to the same region/provider.

Currently peers.dat (serialized version of addrman) does not store ip->bucket mappings explicitly, and all the known ips from peers.dat are re-hashed and re-bucketed at every restart (although it's very cheap).

Idea

It was recently suggested by @TheBlueMatt to use ASN-based bucketing instead. This is strictly better because if the goal is to diversify connections: the distribution of IPs among the ASNs is not uniform, and because of that netgroup-based bucketing may result in having 8 peers from just 2 large ASNs.
If we allow connecting to each ASN at most once, this would increase the security of the network.

We have @sipa's script to create a compressed representation of mapping (ip->ASN), which is less than 2 megabytes.

However, there are integration-related design questions.

Distribution of the .map file

During the meeting there was a rough consensus (not unanimous though, @jnewbery ) that mapping file should be distributed along with the release, instead of becoming part of the binary.

If you want to question these, feel free to comment below.

Legacy /16 bucketing

There was a suggestion of having an old method as well. I think we should do it.

Loading the map

Maybe there will be concerns here, I have an understanding for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions