Browse Source

Merge #9736: Pre-0.14.0 hardcoded seeds update

a60677e Pre-0.14.0 hardcoded seeds update (Wladimir J. van der Laan)
bfa9393 contrib/seeds: Update PATTERN_AGENT (Wladimir J. van der Laan)
4dfac2c Update seeds tooling to Python 3 (Wladimir J. van der Laan)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
d978c41e1e
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 14
      contrib/seeds/README.md
  2. 6
      contrib/seeds/generate-seeds.py
  3. 16
      contrib/seeds/makeseeds.py
  4. 1831
      contrib/seeds/nodes_main.txt
  5. 1831
      src/chainparamsseeds.h

14
contrib/seeds/README.md

@ -1,11 +1,19 @@
### Seeds ### # Seeds
Utility to generate the seeds.txt list that is compiled into the client Utility to generate the seeds.txt list that is compiled into the client
(see [src/chainparamsseeds.h](/src/chainparamsseeds.h) and other utilities in [contrib/seeds](/contrib/seeds)). (see [src/chainparamsseeds.h](/src/chainparamsseeds.h) and other utilities in [contrib/seeds](/contrib/seeds)).
Be sure to update `PATTERN_AGENT` in `makeseeds.py` to include the current version,
and remove old versions as necessary.
The seeds compiled into the release are created from sipa's DNS seed data, like this: The seeds compiled into the release are created from sipa's DNS seed data, like this:
curl -s http://bitcoin.sipa.be/seeds.txt > seeds_main.txt curl -s http://bitcoin.sipa.be/seeds.txt > seeds_main.txt
python makeseeds.py < seeds_main.txt > nodes_main.txt python3 makeseeds.py < seeds_main.txt > nodes_main.txt
python generate-seeds.py . > ../../src/chainparamsseeds.h python3 generate-seeds.py . > ../../src/chainparamsseeds.h
## Dependencies
Ubuntu:
sudo apt-get install python3-dnspython

6
contrib/seeds/generate-seeds.py

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (c) 2014 Wladimir J. van der Laan # Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
''' '''
@ -31,7 +31,7 @@ The output will be two data structures with the peers in binary format:
These should be pasted into `src/chainparamsseeds.h`. These should be pasted into `src/chainparamsseeds.h`.
''' '''
from __future__ import print_function, division
from base64 import b32decode from base64 import b32decode
from binascii import a2b_hex from binascii import a2b_hex
import sys, os import sys, os

16
contrib/seeds/makeseeds.py

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (c) 2013-2016 The Bitcoin Core developers # Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# #
@ -14,13 +14,13 @@ MIN_BLOCKS = 337600
# These are hosts that have been observed to be behaving strangely (e.g. # These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node). # aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([ SUSPICIOUS_HOSTS = {
"130.211.129.106", "178.63.107.226", "130.211.129.106", "178.63.107.226",
"83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6", "83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6",
"54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211", "54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211",
"54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214", "54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214",
"54.94.195.96", "54.94.200.247" "54.94.195.96", "54.94.200.247"
]) }
import re import re
import sys import sys
@ -30,7 +30,7 @@ import collections
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$") PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$") PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$") PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
PATTERN_AGENT = re.compile(r"^(\/Satoshi:0\.8\.6\/|\/Satoshi:0\.9\.(2|3|4|5)\/|\/Satoshi:0\.10\.\d{1,2}\/|\/Satoshi:0\.11\.\d{1,2}\/)$") PATTERN_AGENT = re.compile(r"^(/Satoshi:0.12.(0|1|99)/|/Satoshi:0.13.(0|1|2|99)/)$")
def parseline(line): def parseline(line):
sline = line.split() sline = line.split()
@ -104,7 +104,7 @@ def filtermultiport(ips):
hist = collections.defaultdict(list) hist = collections.defaultdict(list)
for ip in ips: for ip in ips:
hist[ip['sortkey']].append(ip) hist[ip['sortkey']].append(ip)
return [value[0] for (key,value) in hist.items() if len(value)==1] return [value[0] for (key,value) in list(hist.items()) if len(value)==1]
# Based on Greg Maxwell's seed_filter.py # Based on Greg Maxwell's seed_filter.py
def filterbyasn(ips, max_per_asn, max_total): def filterbyasn(ips, max_per_asn, max_total):
@ -164,9 +164,9 @@ def main():
for ip in ips: for ip in ips:
if ip['net'] == 'ipv6': if ip['net'] == 'ipv6':
print '[%s]:%i' % (ip['ip'], ip['port']) print('[%s]:%i' % (ip['ip'], ip['port']))
else: else:
print '%s:%i' % (ip['ip'], ip['port']) print('%s:%i' % (ip['ip'], ip['port']))
if __name__ == '__main__': if __name__ == '__main__':
main() main()

1831
contrib/seeds/nodes_main.txt

File diff suppressed because it is too large Load Diff

1831
src/chainparamsseeds.h

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save