# The short story of the DNS Coin Flip.

Whilst working on one of my projects, I was bound to write my own DNS server. I wanted to play around with it and had to dig through all the RFCs related to DNS and RRs (Resource Records). 

After implementing the basics, I started to getting curious of how I could further improve it. After a quick brainstorming session, I started coding health checks, but also DNS-based load balancing (Round Robin, Random, Geographic, Sticky, etc.).

Now, how could I possibly test Random DNS? Yes! Just add a couple of IPs with different content.

Now, what could the content be? Ofcourse! HEADS AND TAILS! The **coinflip** was born.

... But why waste my precious traffic for all these TCP & HTTP headers, HTML, and more? Why not just use DNS to return Heads or Tails? And that's how we started creating a DNS-based coinflip service:

```bash
$ for i in {1..10}; do dig coin.heinemann.dev TXT @ns1.gentlent.net +short; done
"Tails"
"Heads"
"Heads"
"Heads"
"Tails"
"Tails"
"Heads"
"Heads"
"Tails"
"Heads"
```

Try it out! Just do a TXT query to `coin.heinemann.dev` and don't forget to  [visit my colleague's website](https://heinemann.dev) .
