bitcoin/contrib
Ava Chow 5fdbc8b4ee
Merge bitcoin/bitcoin#30246: contrib: asmap-tool - Compare ASMaps with respect to specific addresses
5215c925d1 Compare ASMaps with respect to specific addresses (virtu)

Pull request description:

  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:
  1. 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)
  2. 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:

  ```shell
  $ ./asmap-tool.py diff 1704463200_asmap.dat 1710770400_asmap.dat
  [...]
  # 2c0f:fc98::/32 was AS37282
  # 2c0f:fcb8::/32 was AS37323
  2c0f:ff18::/32 AS37044 # was unassigned
  2c0f:ff98::/32 AS37113 # was unassigned
  2c0f:ffa0::/32 AS37273 # was unassigned
  # 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:

  ```bash
  $ ./asmap-tool.py diff_addrs 1704463200_asmap.dat 1710770400_asmap.dat <(bitcoin-cli getnodeaddresses 0)
  275 address(es) reassigned from unassigned to AS51167
  84 address(es) reassigned from AS198949 to AS15557
  66 address(es) reassigned from AS45758 to AS45629
  33 address(es) reassigned from AS174 to AS212238
  [...]
  1 address(es) reassigned from unassigned to AS399619
  Summary: 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.

ACKs for top commit:
  fjahr:
    tACK 5215c925d1
  achow101:
    ACK 5215c925d1
  brunoerg:
    reACK 5215c925d1

Tree-SHA512: ebcf47754bce92794fad9f4c3bfc1c5e9daf077db5975f444c5135092eb6a26ecaa1eca6748a03ae0c87d9e45532426966fe8f3c17249b17f9dcad490d6dd3bf
2024-08-12 16:17:42 -04:00
..
asmap Compare ASMaps with respect to specific addresses 2024-06-27 16:35:15 +02:00
completions testnet: Introduce Testnet4 2024-08-06 01:38:10 +02:00
debian doc: upgrade Bitcoin Core license to 2024 2024-01-10 16:29:01 -06:00
devtools refactor: use c++20 std::views::reverse instead of reverse_iterator.h 2024-08-06 00:23:38 +01:00
guix Merge bitcoin/bitcoin#29999: guix: fix suggested fake date for openssl-1.1.1l 2024-08-12 15:22:58 -04:00
init
linearize contrib: support reading XORed blocks in linearize-data.py script 2024-08-07 23:53:39 +02:00
macdeploy Merge bitcoin/bitcoin#30287: macOS: rewrite some docs & swap mmacosx-version-min for mmacos-version-min 2024-06-18 10:55:46 +01:00
message-capture
qos
seeds testnet: Introduce Testnet4 2024-08-06 01:38:10 +02:00
shell
signet refactor: Rename CTransaction::nVersion to version 2024-06-07 13:55:23 -04:00
testgen
tracing
verify-binaries contrib: Fixup verify-binaries OS platform parsing 2024-06-25 11:32:56 -05:00
verify-commits
windeploy windeploy: Renew certificate 2024-05-21 23:19:51 -04:00
zmq
filter-lcov.py
README.md
valgrind.supp ci: use clang-16 for Valgrind 2024-04-14 10:39:14 +01:00

Repository Tools

Developer tools

Specific tools for developers working on this repository. Additional tools, including the github-merge.py script, are available in the maintainer-tools repository.

Verify-Commits

Tool to verify that every merge commit was signed by a developer using the github-merge.py script.

Linearize

Construct a linear, no-fork, best version of the blockchain.

Qos

A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Bitcoin network. This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it.

Seeds

Utility to generate the pnSeed[] array that is compiled into the client.

Build Tools and Keys

Packaging

The Debian subfolder contains the copyright file.

All other packaging related files can be found in the bitcoin-core/packaging repository.

MacDeploy

Scripts and notes for Mac builds.

Test and Verify Tools

TestGen

Utilities to generate test vectors for the data-driven Bitcoin tests.

Verify-Binaries

This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org.

Command Line Tools

Completions

Shell completions for bash and fish.