P2P DNS

Updated: Wed, Jan 9, 2013 - 2:24pm
Concerning

I got an idea.

The Domain Name System has been the focus of interest from censors lately. The Pirate Bay and WikiLeaks have both had their domain names yanked out from under them, and this type of thing happens a lot to smaller sites as well. That's also been the proposed implementation of some of these anti-piracy bills.

So I started thinking about a P2P replacement for DNS, so that it is more difficult to shut down websites this way.

Here is my proposal: We have a distributed database that works like the Bitcoin block chain.

Here's the details.

First, we create a P2P network through the normal bootstraping algorithms. Now we have discovered peers.

If we want to publish a new domain name, we create a transaction. This contains:

  • A public key
  • A DNS record
  • A timestamp
  • A signature of the above

I figure the "DNS Record" would be in, like, bind zonefile format or something? I don't actually use bind, I've always used djbdns, but bind format is more widely supported. Maybe we can be agnostic and require support for bind and for djbdns format. Though that's annoying because it may make the software overly complex. Whatever, that's not the point.

The point is, you make this transaction and broadcast it to your peers, and you forward on transactions you hear about from other peers.

At some point, some peer decides to bundle the transactions into a block. A block is:

  • A public key
  • A list of transactions
  • A timestamp
  • The hash of the previous block
  • A hash of the abobe
  • A signature of the above

The hash of this block is constructed such that the first n bits of it must be 0. The number n is called the "difficulty" and can change over time as computers get better at generating hashes.

Since the block must include information about the previous block, this introduces the "block chain". You can query your peers about the block chain. If the chain has a branch in it -- that is, two blocks both claim block X as their parent -- you must believe the chain that is longer. If it's a tie, wait until someone has picked one arbitrarily and added to that chain. Now their chain is longer than the other one, so you should believe that one.

This is basically the bitcoin block chain.

Now, let's say someone wants to publish a change to a dns record. They must publish a new transaction that is signed with the same key as the original. Everybody must ignore transactions that are not signed properly.

Mostly, updates will be new zone files, but there will also be another type of transaction: Ownership change. That transaction looks like this:

  • Old owner's public key
  • New owner's public key
  • domain name
  • timestamp
  • signature from old owner

Then the new owner can go ahead and publish changes to the domain name.

Okay, so what can the bad guys do with this setup?

In order to insert bad-guy data, they'd have to control more than 50% of the computing power on the network, because otherwise, the good guys can publish new blocks faster than the bad guys can. Now, with bitcoin, there's an incentive for people to spend lots of money to buy a bunch of cpus -- that is, if you have a bunch of cpus, you get to claim the financial reward for solving the block. There is no such reward here. Also, the bad guys have a lot of money to spend. All the copyright people might pool their money and buy a big setup that could overpower the community one.

But what could they do?

One thing they could *not* do is take down domains. If they tried to insert a change to an existing domain, then they wouldn't be able to sign the transaction correctly, so everybody would reject this transaction. If they wrote this evil transaction, everybody would see that it was an illegal transaction and ignore it. If they wrote that transaction into a block, then the block would be ignored. Burrrnnnnn.

But what they *could* do is create a bunch of spam transactions and write them into blocks more quickly than anybody else could. In that way, they could make sure that nobody else could write transactions except for them. That would mean that nobody could change their dns info until this situation was resolved. They might want to do this if, for example, they shut down the pirate bay at one IP address, and wanted to make sure that the dns never got updated to point to their new address.

So, there's that. We'll cross that bridge when we come to it.

So who would run this program? Not normal clients. People would run the normal client if they wanted to insert transactions (and thus maintain their domain names). People would run this program if they wanted to run a dns server. But normal people would make normal dns queries to this dns server. The dns server would consult the blockchain backend, and return a normal dns result.

It is not even necessarily the case that the query would take longer than a normal dns query. It would take more disk space on the dns server, since it would have to keep the whole database online, and keep listening for updates.

Oh hey, look. After I wrote this up, I googled for it. It turns out that somebody is already doing pretty much exactly this.

Dot-bit. I got linked there from bitcoin's page on alternative blockchains.

Well, maybe I'll test out that software and tell you what is up.

Your rating: None Average: 3 (2 votes)