@@ -11,3 +11,48 @@ python3 asmap-tool.py decode /path/to/input.file /path/to/output.file
11
11
python3 asmap-tool.py diff /path/to/first.file /path/to/second.file
12
12
python3 asmap-tool.py diff-addrs /path/to/first.file /path/to/second.file addrs.file
13
13
```
14
+ These commands may take a few minutes to run with ` python3 ` ,
15
+ depending on the amount of data involved and your machine specs.
16
+ Consider using ` pypy3 ` for a faster run time.
17
+
18
+ ### Comparing ASmaps
19
+
20
+ AS control of IP networks changes frequently, therefore it can be useful to get
21
+ the changes between to ASmaps via the ` diff ` and ` diff_addrs ` commands.
22
+
23
+ ` diff ` takes two ASmap files, and returns a file detailing the changes
24
+ in the state of a network's AS assignment between the first and the second file.
25
+ This command may take a few minutes to run, depending on your machine.
26
+
27
+ The example below shows the three possible output states:
28
+ - reassigned to a new AS (` AS26496 # was AS20738 ` ),
29
+ - present in the first but not the second (` # 220.157.65.0/24 was AS9723 ` ),
30
+ - or present in the second but not the first (` # was unassigned ` ).
31
+
32
+ ```
33
+ 217.199.160.0/19 AS26496 # was AS20738
34
+ # 220.157.65.0/24 was AS9723
35
+ 216.151.172.0/23 AS400080 # was unassigned
36
+ 2001:470:49::/48 AS20205 # was AS6939
37
+ # 2001:678:bd0::/48 was AS207631
38
+ 2001:67c:308::/48 AS26496 # was unassigned
39
+ ```
40
+ ` diff ` accepts a ` --ignore-unassigned ` /` -i ` flag
41
+ which ignores networks present in the second but not the first.
42
+
43
+ ` diff_addrs ` is intended to provide changes between two ASmaps and
44
+ a node's known peers.
45
+ The command takes two ASmap files, and a file of IP addresses as output by
46
+ the ` bitcoin-cli getnodeaddresses ` command.
47
+ It returns the changes between the two ASmaps for the peer IPs provided in
48
+ the ` getnodeaddresses ` output.
49
+ The resulting file is in the same format as the ` diff ` command shown above.
50
+
51
+ You can output address data to a file:
52
+ ```
53
+ bitcoin-cli getnodeaddresses 0 > addrs.json
54
+ ```
55
+ and pass in the address file as the third argument:
56
+ ```
57
+ python3 asmap-tool.py diff_addrs path/to/first.file path/to/second.file addrs.json
58
+ ```
0 commit comments