create account

[GUIDE] Running your own SteemDNS server by someguy123

View this thread on: hive.blogpeakd.comecency.com
· @someguy123 ·
$300.65
[GUIDE] Running your own SteemDNS server
Running your own SteemDNS server
===============

[Check out the original post about SteemDNS here!](https://steemit.com/steemit/@someguy123/steem-dns-your-username-dot-steem-dns-on-the-blockchain)
---

SteemDNS is an open standard created by myself. It works similarly to Namecoin. Using the `json_metadata` of a user, we can iterate through all users on Steemit and add them to a database. Once you're synchronized, you can then run the live websocket feed instead, which will update a user usually within 60 seconds of them changing their metadata.

It's entirely possible to do this with any DNS server, however I personally use [PowerDNS](https://powerdns.com) as it can read from a database in real-time, allowing me to update the DNS configuration without having to generate ZONE files or building plugins.

If you need a server host, I strongly recommend [DigitalOcean ($10 free credit for signing up)](https://m.do.co/c/ee902cbe72a4), or if you desperately want to pay with Steem Dollars, [VertVPS accepts Steem](https://steemit.com/introduceyourself/@coolty/introducing-vertvps-the-first-vps-host-to-accept-steem).

**DISCLAIMER: This article is aimed at people who have at least a small amount of server experience.**

**It's not recommended to operate a server unless you know what you're doing, as you could be attacked by failing to secure it. If you're installing it for local usage, then this isn't as much of a problem.**

Step 1 - Installing PowerDNS
----

I'm going to assume you're using Ubuntu 16.04 (Xenial). If you're using any other distribution, or you're using an older version of ubuntu, the instructions may differ.

Obtain PowerDNS 4.0.x from the repository site at https://repo.powerdns.com/

If you're using Ubuntu 16.04 the instructions are as follows:

    sudo su
    echo "deb http://repo.powerdns.com/ubuntu xenial-rec-40 main" > /etc/apt/preferences.d/pdns.list
    echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600" > /etc/apt/preferences.d/pdns
    curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add -
    apt update && apt install pdns-recursor pdns-backend-sqlite3 sqlite3

Edit /etc/powerdns/pdns.conf and add the following under where the existing `launch=` is (replace it).

    launch=gsqlite3
    gsqlite3-database=/var/spool/powerdns/steem.sqlite

You may want to add a recursive resolver (this allows you to resolve non-steem domains like google.com):

    recursor=8.8.4.4

Other items in the configuration are completely optional, and have rather sensible defaults, so don't worry about those unless you intend for an advanced configuration.

Don't worry about restarting the PowerDNS server just yet, we have to set up the scanner first!

Step 2 - Installing SteemDNS loader script
----

[The source code is in Python, and is available at Github](https://github.com/Someguy123/steemdns)

As a normal user (or as root if you don't care):

    cd ~
    git clone https://github.com/Someguy123/steemdns.git
    cd steemdns

You'll need python3 installed, and python3-pip

    sudo apt install python3 python3-pip

Run the following command to install dependencies:

    pip3 install -r requirements.txt

Create a DB using

    sudo touch /var/spool/powerdns/steem.sqlite
    sudo sqlite3 /var/spool/powerdns/steem.sqlite < schema.sql
    # to allow access by different users, i.e. the one running the watcher
    sudo chmod 777 /var/spool/powerdns/steem.sqlite

You'll need to configure the nameserver domain (which is a domain you own that points at your server), and SOA in the python file:

    NAMESERVERS = ['ns1.example.com']
    SOA = 'ns1.example.com dns-admin.example.com 0'

If you're running this locally, and aren't going to be publishing your DNS, you can set all domains to `localhost`. Leave the '0' at the end of the SOA. That tells PowerDNS to automatically detect when a domain changes and adjust the value automatically.

Now re-scan all users (may take a long time!)

    python3 cmd.py rescan_users

Once it's re-scanned, you can now run the watcher command. Run this in screen to prevent it from closing when you disconnect.

    screen -S steemwatchchain python3 cmd.py watch_chain

Remember to restart PowerDNS now that we have the database working nicely:

    sudo service pdns restart

You can inspect the sqlite database by running `sqlite3 /var/spool/powerdns/steem.sqlite`. To verify if your DNS is working, just run on the server:

    dig a someguy123.steem @127.0.0.1

If this is public, remember to verify the outside can see it too!

At this point you should be good to go. Keep an eye on the steem watch script in-case it crashes (though it should be reliable), you may want to test it by publishing your own DNS records to your json_metadata.

Follow me to keep up to date on my development work for STEEM. If you like what I'm doing, [vote for someguy123 to be a witness](https://steemit.com/~witnesses)
=====
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorsomeguy123
permlinkguide-running-your-own-steemdns-server
categorynamecoin
json_metadata{"tags":["namecoin","steem","dns","steemdns","steem-help"],"links":["https://steemit.com/~witnesses"]}
created2016-08-13 18:22:21
last_update2016-08-13 18:22:21
depth0
children7
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value228.756 HBD
curator_payout_value71.890 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,931
author_reputation103,945,664,283,580
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id786,514
net_rshares42,582,467,874,649
author_curate_reward""
vote details (63)
@ausbitbank ·
Great guide nice work @someguy123 :) 
I bought a vultr vps for my attempt at this, cant recommend them enough.. I never got an answer if you wanted the domain and username for steemdns either btw, did you want to maintain this long term?
properties (22)
authorausbitbank
permlinkre-someguy123-guide-running-your-own-steemdns-server-20160814t003609849z
categorynamecoin
json_metadata{"tags":["namecoin"],"users":["someguy123"]}
created2016-08-14 00:36:12
last_update2016-08-14 00:36:12
depth1
children0
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length237
author_reputation287,009,709,424,827
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id792,005
net_rshares0
@coolty ·
$0.03
@Someguy123 Thanks for the VertVPS mention! 
My VertVPS post: https://steemit.com/introduceyourself/@coolty/introducing-vertvps-the-first-vps-host-to-accept-steem
👍  , ,
properties (23)
authorcoolty
permlinkre-someguy123-guide-running-your-own-steemdns-server-20160813t215047592z
categorynamecoin
json_metadata{"tags":["namecoin"],"links":["https://steemit.com/introduceyourself/@coolty/introducing-vertvps-the-first-vps-host-to-accept-steem"]}
created2016-08-13 21:50:48
last_update2016-08-13 21:50:48
depth1
children1
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.022 HBD
curator_payout_value0.003 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length162
author_reputation182,619,937,252
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id789,721
net_rshares32,863,613,551
author_curate_reward""
vote details (3)
@ausbitbank ·
Nice to see vps services for steem, will try you out next time i need one :)
👍  
properties (23)
authorausbitbank
permlinkre-coolty-re-someguy123-guide-running-your-own-steemdns-server-20160814t003722650z
categorynamecoin
json_metadata{"tags":["namecoin"]}
created2016-08-14 00:37:27
last_update2016-08-14 00:37:27
depth2
children0
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length76
author_reputation287,009,709,424,827
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id792,018
net_rshares59,216,026
author_curate_reward""
vote details (1)
@cryptohead ·
Interesting
What is the incentive for running a Steem DNS server?
properties (22)
authorcryptohead
permlinkre-someguy123-guide-running-your-own-steemdns-server-20160814t021721095z
categorynamecoin
json_metadata{"tags":["namecoin"]}
created2016-08-14 02:17:18
last_update2016-08-14 02:17:18
depth1
children1
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length65
author_reputation607,929,583,052
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id793,043
net_rshares0
@someguy123 ·
If SteemDNS became popular, I'm sure you could make money from just posting about it.
properties (22)
authorsomeguy123
permlinkre-cryptohead-re-someguy123-guide-running-your-own-steemdns-server-20160814t022451258z
categorynamecoin
json_metadata{"tags":["namecoin"]}
created2016-08-14 02:24:51
last_update2016-08-14 02:24:51
depth2
children0
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation103,945,664,283,580
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id793,095
net_rshares0
@igster ·
Thank you, I will be trying this out once I have finished my web project, if  ever..  You talked about security, perhaps you could do a post about it at some point as this would be my first public hosting.
👍  
properties (23)
authorigster
permlinkre-someguy123-guide-running-your-own-steemdns-server-20160813t183626922z
categorynamecoin
json_metadata{"tags":["namecoin"]}
created2016-08-13 18:36:21
last_update2016-08-13 18:36:21
depth1
children0
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length205
author_reputation17,415,198,441,969
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id786,803
net_rshares13,845,595,678
author_curate_reward""
vote details (1)
@steemitqa ·
Doing god's work my man!    steemitqa.steem is coming soon ;)
👍  
properties (23)
authorsteemitqa
permlinkre-someguy123-guide-running-your-own-steemdns-server-20160813t182850298z
categorynamecoin
json_metadata{"tags":["namecoin"]}
created2016-08-13 18:28:42
last_update2016-08-13 18:28:42
depth1
children0
last_payout2016-09-13 09:54:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length61
author_reputation22,135,803,163,402
root_title"[GUIDE] Running your own SteemDNS server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id786,624
net_rshares13,845,595,678
author_curate_reward""
vote details (1)