Right now, we have no way to quantify the “degradation” of an ASMap over time in the context of Bitcoin’s P2P network in a meaningful way. However, such data would be useful for:
- Making sure the minimum shelf life of ASMaps is compatible with the release cycle (we wouldn’t want to start shipping ASMaps with releases before making sure ASMaps typically do not become obsolete before the time of the next release)
- Node operators eager to keep their ASMaps up-to-date between releases.
While asmap-tool.py
has a diff
command to perform a prefix-based comparison of two ASMaps, it is hard to reason about whether an old ASMap still is “good enough” or should be replaced with a newer one based on a prefix-based diff such as the following:
0$ ./asmap-tool.py diff 1704463200_asmap.dat 1710770400_asmap.dat
1[...]
2# 2c0f:fc98::/32 was AS37282
3# 2c0f:fcb8::/32 was AS37323
42c0f:ff18::/32 AS37044 # was unassigned
52c0f:ff98::/32 AS37113 # was unassigned
62c0f:ffa0::/32 AS37273 # was unassigned
7# 76082350 (2^26.18) IPv4 addresses changed; 834271985742505274886878979424260 (2^109.36) IPv6 addresses changed
One option for a more Bitcoin-centric ASMap comparison comprises comparing ASNs for the addresses of Bitcoin nodes and reporting on the number/share of addresses of nodes with disagreeing ASNs. By applying this approach to a node’s set of known peers, a node operator can estimate how many of the node’s peers are mapped to out-of-date AS when using the currently deployed and an up-to-date ASMap as input.
This PR adds this functionality to asmap-tool.py
by introducing a diff_addrs
subcommand. In addition to two ASMaps, the subcommand reads addresses from a (getnodeaddresses
-compatible) file, and computes statistics for those addresses:
0$ ./asmap-tool.py diff_addrs 1704463200_asmap.dat 1710770400_asmap.dat <(bitcoin-cli getnodeaddresses 0)
1275 address(es) reassigned from unassigned to AS51167
284 address(es) reassigned from AS198949 to AS15557
366 address(es) reassigned from AS45758 to AS45629
433 address(es) reassigned from AS174 to AS212238
5[...]
61 address(es) reassigned from unassigned to AS399619
7Summary: 919 (1.67%) of 54,901 addresses were reassigned.
When the -s / --show-addresses
flag is used, addresses subject to reassignment are included in the output.