forked from WisprProject/bitcoin-seeder
-
Notifications
You must be signed in to change notification settings - Fork 0
THETCR/bitcoin-seeder
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
wispr-seeder ============== WISPR-seeder is a crawler for the WISPR network, which exposes a list of reliable nodes via a built-in DNS server. Features: * regularly revisits known nodes to check their availability * bans nodes after enough failures, or bad behaviour * accepts nodes down to v0.3.19 to request new IP addresses from, but only reports good post-v0.3.24 nodes. * keeps statistics over (exponential) windows of 2 hours, 8 hours, 1 day and 1 week, to base decisions on. * very low memory (a few tens of megabytes) and cpu requirements. * crawlers run in parallel (by default 24 threads simultaneously). REQUIREMENTS ------------ $ sudo apt-get install build-essential libboost-all-dev libssl-dev COMPILING --------- Compiling will require boost and ssl. On debian systems, these are provided by `libboost-dev` and `libssl-dev` respectively. $ make This will produce the `dnsseed` binary. BASIC USAGE/SETUP ----- Assuming you want to run a dns seed on seed.MYURL.com, you will need an authorative NS record in MYURL.com's domain record, pointing to for example vps.MYURL.com: $ dig -t NS seed.MYURL.com ;; ANSWER SECTION seed.MYURL.com. 86400 IN NS vps.MYURL.com. On the system vps.MYURL.com, you can now run dnsseed: ./dnsseed -h seed.MYURL.com -n vps.MYURL.com If you want the DNS server to report SOA records, please provide an e-mail address (with the @ part replaced by .) using -m. RUNNING AS NON-ROOT ------------------- Typically, you'll need root privileges to listen to port 53 (name service). One solution is using an iptables rule (Linux only) to redirect it to a non-privileged port: $ iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5353 If properly configured, this will allow you to run dnsseed in userspace, using the -p 5353 option. See also the example at the bottom which gives a working example of how to do this on ubuntu. PERMANENT SETUP ____ For a more robust/permanent setup - that auto starts on server reboot. 1) Modify variables in dnsseed_service.sh 2) sudo cp dnsseed_service.sh /etc/init.d/wisprdnsseed 3) sudo chmod +x /etc/init.d/wisprdnsseed 4) sudo service wisprdnsseed start 5) sudo update-rc.d wisprdnsseed defaults ADDITIONAL SETUP ________________ The seeders periodically scan for two files "nodes4.txt" (ipv4); "nodes6.txt" (ipv6). (Plain text files with one ip per line - no port numbering) If these files are present, the seeders will use these as an additional source of IPs to feed into the crawler, this can help get better network coverage. For best seeder performance, it is advised to acquire an external source that can provide such a list of IPs and then use a cronjob to have it periodically place new versions of the lists in these files. EXAMPLE SETUP - RUNNING TWO DNS SEEDS ON ONE UBUNTU SERVER USING TWO IPS (testnet + mainnet) __________________________________________________________________ Basic setup to run two DNS seeds from one box (one for mainnet one for testnet) Assumes ufw is already set up and enabled. Please ensure there is not already a service on port 53 (dnsmasq/avahi) if there is that must first be removed. Assuming two external IPs for the box, with NS records already set up: 104.233.1.1 seed.example.com vps.example.com 104.233.1.2 testseed.example.com testvps.example.com Place the following in /etc/ufw/before.rules to forward the incoming traffic to different ports based on the IPs: *nat :PREROUTING ACCEPT [0:0] -F PREROUTING -A PREROUTING -d 104.233.1.1 -p udp --dport 53 -j REDIRECT --to-port 5454 -A PREROUTING -d 104.233.1.1 -p tcp --dport 53 -j REDIRECT --to-port 5454 -A PREROUTING -d 104.233.1.2 -p udp --dport 53 -j REDIRECT --to-port 5455 -A PREROUTING -d 104.233.1.2 -p tcp --dport 53 -j REDIRECT --to-port 5455 COMMIT Allow ports through ufw: sudo ufw allow 53 && sudo ufw allow 5454 && sudo ufw allow 5455 && sudo ufw reload Set up init scripts: sudo cp dnsseed_service.sh /etc/init.d/wisprdns sudo cp dnsseed_service.sh /etc/init.d/wisprdnstestnet Configure init scripts: Open wisprdns script and set the variables in it. PREFIX1=seed PREFIX2=vps PORT=5454 URL=example.com Open wisprdnstestnet and set the variables in it. PREFIX1=testseed PREFIX2=testvps PORT=5455 URL=example.com Note that you must also set the APPROOT for each of the above, to seperate folders, you will need two copies of the folder one for each app to run in. Finally run the init scripts and wait a while. You can confirm from the inside if everything works by running tail -f on the log file. You can confirm (from the outside) if everything works via nslookup.
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- C++ 87.4%
- C 10.3%
- Perl 1.3%
- Other 1.0%