33Simple script to check the status of all Bitcoin Core DNS seeds.
44Seeds are available from https://github.com/bitcoin/bitcoin/blob/master/src/kernel/chainparams.cpp
55'''
6+ import argparse
67import subprocess
78from itertools import combinations
89
@@ -69,7 +70,7 @@ def get_combinations(services):
6970
7071def check_dns_support (combination_hex , provider ):
7172 """
72- Checks if a DNS provider supports a given combination of flags.
73+ Checks if a DNS provider supports a given combination of service flags.
7374 """
7475
7576 domain = f"x{ combination_hex } .{ provider } "
@@ -82,6 +83,11 @@ def check_dns_support(combination_hex, provider):
8283 return False
8384
8485if __name__ == "__main__" :
86+ parser = argparse .ArgumentParser (description = 'Bitcoin Core Filter DNS Seeds' )
87+ parser .add_argument ('--filter-services' , action = 'store_true' , help = 'Scan which filters are in use' )
88+ args = parser .parse_args ()
89+
90+
8591 print ("\n Bitcoin Core DNS Seed Status Check:\n " )
8692
8793 for (network , seeds ) in SEEDS_PER_NETWORK .items ():
@@ -93,23 +99,24 @@ def check_dns_support(combination_hex, provider):
9399 print ()
94100
95101 print ("\n " )
96- combinations = get_combinations ({
97- "NODE_NONE" : NODE_NONE ,
98- "NODE_NETWORK" : NODE_NETWORK ,
99- "NODE_BLOOM" : NODE_BLOOM ,
100- "NODE_WITNESS" : NODE_WITNESS ,
101- "NODE_COMPACT_FILTERS" : NODE_COMPACT_FILTERS ,
102- "NODE_NETWORK_LIMITED" : NODE_NETWORK_LIMITED ,
103- "NODE_P2P_V2" : NODE_P2P_V2 ,
104- })
105-
106- print ("All possible combinations of node services and their bit flags in hexadecimal:" )
107- for combination_hex , service_names in combinations :
108- print (f" Bit flag (hex): { combination_hex } - Service: { ', ' .join (service_names )} " )
109-
110- for (network , seeds ) in SEEDS_PER_NETWORK .items ():
111- for hostname in seeds :
112- supports_combination = check_dns_support (combination_hex , hostname )
113- print (f" Network: { network } , Provider: { hostname } - Supports Service: { supports_combination } " )
114-
115-
102+
103+ if args .filter_services :
104+ combinations = get_combinations ({
105+ "NODE_NONE" : NODE_NONE ,
106+ "NODE_NETWORK" : NODE_NETWORK ,
107+ "NODE_BLOOM" : NODE_BLOOM ,
108+ "NODE_WITNESS" : NODE_WITNESS ,
109+ "NODE_COMPACT_FILTERS" : NODE_COMPACT_FILTERS ,
110+ "NODE_NETWORK_LIMITED" : NODE_NETWORK_LIMITED ,
111+ "NODE_P2P_V2" : NODE_P2P_V2 ,
112+ })
113+
114+ print ("All possible combinations of node services and their bit flags in hexadecimal:" )
115+ for combination_hex , service_names in combinations :
116+ print (f" Bit flag (hex): { combination_hex } - Service: { ', ' .join (service_names )} " )
117+
118+ for (network , seeds ) in SEEDS_PER_NETWORK .items ():
119+ for hostname in seeds :
120+ supports_combination = check_dns_support (combination_hex , hostname )
121+ print (f" Network: { network } , Provider: { hostname } - Supports Service: { supports_combination } " )
122+
0 commit comments