Skip to content

Quakeitup/digibyte-seeder

 
 

Repository files navigation

DigiByte Seeder

DigiByte Seeder is a crawler for the DigiByte 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.5.0 to request new IP addresses from, but only reports good post-v0.6.9 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 96 threads simultaneously).

JOIN DIGIBYTE CRITICAL INFRASTRUCTURE TEAM (DGBCIT)

If you are intending to run a DigiByte Seeder, you are encouraged to join the DGBCIT Telegram group. The DigiByte Critical Infrastructure Team helps coordinate the seeders on the network. The team provides a detailed step-by-step tutorial for setting up your DigiByte Seeder and community support if you need help. Participation is optional but encouraged. Find the detailed tutorial here.

The objectives of DGBCIT is to help:

  • Distribute DigiByte Seeders across the community.
  • Distribute the Seeders geographically across the globe.
  • Distribute DigiByte Seeders across diferent providers.

REQUIREMENTS

IMPORTANT: To improve decentralization, mitigate single points of failure, and increase community participation, it is recommended that each person run a maximum of one mainnet seeder and one testnet seeder each. The network does not require many testnet seeders, so only a few people need run them.

To setup a DigiByte Seeder you need:

  • A server to run it on with a static IP address. A VPS is fine. It does not need many resources - DigiByte Seeder needs <1Gb RAM to run. Note: Many VPS providers give you the option to chose from several geographic locations in which to run your server. To help better distribute the DigiByte Seeders around the globe, please try and choose a location where the network doesn't already have a Seeder, that is a good distance from any existing seeders. Feel free to discuss this in the DGBCIT Telegram group to help choose a good location.
  • A domain name where you can edit the DNS settings.

HOW TO SETUP A DIGIBYTE SEEDER

STEP 1. SETUP DNS RECORDS

Visit your domain name registrar and edit the DNS settings. Assuming you want to run a DNS seed on seed.example.com, you will need an authorative NS record in example.com's domain record, pointing to a subdomain to identify your server - e.g. server.example.com. You will also need an A record for server.example.com pointing at the IP address of the server.

Create an NS record:

  • Host: seed.example.com or testnetseed.example.com [ The desired address of your DigiByte Seeder. ]
  • Answer: server.example.com [ A subdomain to identify your server. ]

Note: Some providers do not allow you to add an NS record. In that case, you may need to move your domain to one that does, or register a new one.

Create an A record:

  • Host: server.example.com [ Use the same subdomain you set above. ]
  • Answer: 123.123.123.123 [ The IP address of your server. ]

Test the NS record:

$ dig -t NS seed.example.com

Expected response: seed.example.com. 21600 IN NS server.example.com.

(It should return the URL you chose to identify your server - e.g. server.example.com.)

Test the A record:

$ dig -t A server.example.com

Expected response: server.example.com. 161 IN A 123.123.123.123

(It should return the IP address of your server.)

STEP 2. COMPILE SOFTWARE

These instructions are for Ubuntu or Debian. Compiling will require boost and ssl. On debian systems, these are provided by libboost-dev and libssl-dev respectively.

If running Debian, switch to root:

$ su

Perform a system update:

Ubuntu: $ sudo apt-get update

Debian: $ apt-get update

Install required software packages for DigiByte Seeder on Ubuntu or Debian:

Ubuntu: $ sudo apt-get install gcc g++ build-essential libboost-all-dev libssl-dev git tmux iptables

Debian: $ apt-get install gcc g++ build-essential libboost-all-dev libssl-dev git tmux iptables

If running Debian, switch back to your user account ('user' in this example):

$ su user

Clone the DigiByte Seeder software into your home folder:

$ cd ~/

$ git clone https://github.com/DigiByte-Core/digibyte-seeder

If you are also running a DigiByte full node on the same server, you need to make a change to main.cpp to add the loopback IP address:

$ nano ~/digibyte-seeder/main.cpp

Change line 424 and 425 to add the loopback IP address: "127.0.0.1", . This will make it possible for the Seeder to connect directly to your local DigiByte full node.

To compile the software:

$ cd ~/digibyte-seeder

$ make

This will produce the dnsseed binary.

STEP 3. START DIGIBYTE SEEDER

To view the software flag options, enter:

$ ./dnsseed --help

These are the flags supported by the dnsseed binary:

Usage: ./dnsseed -h <host> -n <ns> [-m <mbox>] [-t <threads>] [-p <port>]

Options:
-h <host>       Hostname of the DNS seed
-n <ns>         Hostname of the nameserver
-m <mbox>       E-Mail address reported in SOA records
-t <threads>    Number of crawlers to run in parallel (default 96)
-d <threads>    Number of DNS server threads (default 4)
-a <address>    Address to listen on (default ::)
-p <port>       UDP port to listen on (default 53)
-o <ip:port>    Tor proxy IP/Port
-i <ip:port>    IPV4 SOCKS5 proxy IP/Port
-k <ip:port>    IPV6 SOCKS5 proxy IP/Port
-w f1,f2,...    Allow these flag combinations as filters
--testnet       Use testnet
--wipeban       Wipe list of banned nodes
--wipeignore    Wipe list of ignored nodes
-?, --help      Show this text

To make it easy to check on it in future, open a tmux session in which to run your DigiByte Seeder:

$ tmux new -s dgbseeder

To run a mainnet seeder, enter:

$ ./dnsseed -h seed.example.com -n server.example.com -m email.example.com -p 5353 -a 123.123.123.123

To run a testnet seeder, enter:

$ ./dnsseed -h seed.example.com -n server.example.com -m email.example.com -p 5353 -a 123.123.123.123 --testnet

  • Subsitute seed.example.com with the NS Host record.
  • Subsitute server.example.com with the A Host record.
  • Subsitute youremail.example.com with an email address that you can be reached at for the SOA records, substituting the @ for a period. So [email protected] would be youremail.example.com.
  • Subsitute 123.123.123.123 with IP address of your Server from Step 1.
  • If you are running testnet seeder, note that you must include the --testnet flag.

The software will begin crawling the DigiByte network. You may need to wait or minute or two to see results coming in. Check that the available count is climbing. This is a good sign that it is working correctly.

Disconnect from the tmux session by pressing Ctrl-B, followed by D

Check on your Seeder

When you need to reconnect to the tmux session later, enter:

$ tmux a -t dgbseeder

STEP 4. MAP PORT 53 WHEN 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.

Ubuntu: $ sudo iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5353

Ubuntu: $ sudo apt-get install iptables-persistent -y

Debian: $ su (switch to root)

Debian: $ /sbin/iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5353

Debian: $ apt install iptables-persistent -y

Debian: $ su user (switch back to your user account - 'user' in this example)

If properly configured, this will allow you to run dnsseed in userspace, using the -p 5353 option. iptables-persistent is used to make the change stick after a reboot.

Another solution is allowing a binary to bind to ports < 1024 with setcap (IPv6 access-safe)

$ setcap 'cap_net_bind_service=+ep' /path/to/dnsseed

STEP 5. TEST DIGIBYTE SEEDER

To verify that your DigiByte Seeder is setup correctly, open a web browser and visit:

https://www.whatsmydns.net/#A/

Enter the address you chose for your Seeder. You should see a list of IP addresses returned for each location.

For an example of what you should be seeing, look at the results for seed.digibyte.org here:

https://www.whatsmydns.net/#A/seed.digibyte.org

STEP 6. SETUP DIGIBYTE SEEDER TO STARTUP AT BOOT

You can use the included startseeder.sh script to automatically startup your DigiByte Seeder when your system boots.

Edit the script to add your DigiByte Seeder credentials:

$ nano ~/digibyte-seeder/startseeder.sh

Save and exit. Copy the file to your home folder:

$ cp ~/digibyte-seeder/startseeder.sh ~/

Make it executable:

$ sudo chmod +x ~/digibyte-seeder/startseeder.sh

Edit cron:

$ crontab -e

Add this value to the bottom of your cron file. Replace 'user' with your user account name.

@reboot sleep 30 && /home/user/startseeder.sh

When your server boots, it will pause for 30 seconds, before launching your DigiByte Seeder. Adjust the duration if needed. Save and exit.

TROUBLESHOOTING

Running under Ubuntu

All Ubuntu releases from 16.10 onwards come installed with systemd-resolved, which prevents the seeder from running effectively.

The recommended solution is to bind the seeder to a specific IP address

$ ./dnsseed -h seed.example.com -n server.example.com -a 123.123.123.123

Firewall

Be sure to check that port 53 is open on any external firewall.

If your system firewall is enabled, make sure you have opened port 53:

$ sudo ufw allow 53

You can check the status of your system firewall with:

$ sudo ufw status

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 95.3%
  • C 2.4%
  • Perl 1.3%
  • Other 1.0%