[Tutorial] Create your own NuBits DNS seed


I was thinking about the security implications a DNS server brings to the Nu infrastructure.
My thought process resulted in me pushing a PHP script called “cf-php” to the https://github.com/bananenwilly/nubits-seeder master branch.

This tutorial is also available on https://docs.nubits.com/create-nu-dns-seed/

What does cf-php do?

It reads a file called dnsseed.dump in the nubits-seeder root directory, which is continuously created when nubits-seeder is crawling for nodes. It will generate a IP-table from the dnseed.dump file and pushes this table to a Cloudflare (CF) enabled domain of your choice over the Cloudflare API.

It will generate a DNS zone file like this

nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A
nuseed.coinerella.com. 299 IN A

without the need to run your own DNS server!


Let’s get started

  1. Get your CF API Key (My Settings -> Account -> API Key -> View API Key)

  2. Download and start nubits-seeder

    git clone https://github.com/bananenwilly/nubits-seeder
    cd nubits-seeder
    chmod +x dnsseed
    screen -dmS nuseed sh -c "./dnsseed"
    to have a screen session, detach the screen session with CTRL+A+D

  3. Edit cf-php/cf.php file
    open cf.php in an editor of your choice
    and fill in

    $domain =“domain.com”;
    $name = “nuseed”; //subdomain e.g. name.domain.com
    $number_of_records = 10; //maximum n A records with $name…
    $user = “emailofcloudflareaccount”; //user name
    $key = “yourapikey”; //key for cloudflare api found in account settings
    $seed_dump = “/path/to/dnsseed.dump”; //absolute path to dnsseed.dump in the nubits-seeder root directory

accordingly. (The number_of_records in the table displayed above is “10” and I think that’s a good number.)
4. Have a cronjob run cf-php regularly

crontab -e
* * * * * php ~/nubits-seeder/cf-php/cf.php

That should be it. You now have your own Nu DNS seed.

Thanks to @MatthewLM and vexxhost



nuseed.coinerella.com is fully operational on my raspberry pi! :slight_smile:

Will add testnet branch and seed node soon.

Wooo! Where’s your icon? No more sloth because you aren’t slothful? :wink:
Will give it a try on my pi!

I’m still seeing it. mh.

this is not the discourse update thread! :frog:

it’s for dns :seedling:

You’re right. I deleted my post. Sry.

:sheep: thank you.

1 Like

This has been added to docs.nubits.com



Very nice job. I d like to give it a try when I have some time.

Repo pushed, Bug fixes.

Please note that the new code requires PHP >= 5.5.0, which is kind of a problem for Raspberry Pies, because the binaries offered via atp are 5.4.44.

The methods mentioned here

and here

http://snippets.khromov.se/php-5-5-on-raspbian-raspberry-pi/ (more radical - upgrade to jessie)

(I had to do “sudo apt-get install php5-cli” after the update/upgrade process to get the correct version)

are both feasible to get a fitting PHP version .

Hello, I have been trying to get a DNS Seeder set up and was wondering what type of account is needed on Cloudflare. Are you using the free or pro ($20) account or did you have to go with the higher option to be able to use custom name servers? What are the initial records you added to the zone after the domain is added?

Thanks for any help

Free account should work as well.

Initial values should be created automatically when there are suitable nodes in the dnsseed.dump file.
If not, we have a bug.

Let me know how it goes.

Thanks for the reply. I guess I am confused as to the name server names mainly because I’m getting ns names like zeus.ns.cloudflare.com. Do I add new NS records like nuseed1.mydomain.com and nuseed2.mydomain.com to the zone?
Thanks Again!!!

Alter the values mentioned in step 3 and the software should do it automatically.
You don’t have to do anything on CloudFlare by hand, besides getting your API key.
Provided your domain is already using the CloudFlare DNS servers of course. You will keep using them.

If you don’t change “name”, this will result in nuseed.yourdomain.com, which will have the number of A records you chose, like this:

One subdomain can have more than one IP address in its A records.

Cool, I was hoping that was the case. I’m going to try finishing it up tonight

Pushed an update on github today.

If anyone using this has a problem with the number of dns records set on the domain, try this update.