It looks like there are companies that sell the lists of domain names, yet their lists are incomplete, and each company has a different amount of entries for a particular TLD.
Why so much conspiracy about the complete list of existing/registered/active domain names? Why isn't it just available online for everyone (of course, without any additional data, just domain names)?
And the main question is - is there a right technical way to build such a list on my own?
If I understand correctly, registrars are accredited for each TLD, and then they are responsible to host zone files.
So, if one is to build the complete list, they would need to get a complete list from all registrars and join them together.
Sounds simple, yet there are no such lists available. So why is it so and how to do it properly on my own from the technical point of view?
In some sense one might argue that the "right" technical approach is to jump through whatever hoops the relevant registries require to get access to their TLD zone data or, if they do not have such a program, just not do it.
Regarding gTLDs, ICANN does provide a central repository:
For a much longer time individual zones have been made available separately. For instance the com and net zones have been made available by Verisign (operating these zones on behalf of ICANN).
For ccTLDs there is no such convenience as a central repository and each registry may or may not have a program that allows access to the full zone data.
Registrars do not host zone files, the nameservers for the TLD are operated on behalf of the registry. The registrars feed data to the registry.
There's no conspiracy, it's just that the list is HUGE (133,182,309 domains handled just by VeriSign (.net and .com) as of this writing, supposing an average of 13 byte-width characters per domain, that's almost 2 GB of just domain names, not to mention the associated information attached to a domain entry) and bandwidth costs money.
You can request the zone file from or sign up as a registrar (to get better access to the zone file) for the individual zone sponsor. Continuing with the VeriSign example, you can look for .net and .com here: http://www.verisigninc.com/en_US/channel-resources/domain-registry-products/zone-file/index.xhtml and http://www.verisigninc.com/en_US/channel-resources/become-a-registrar/index.xhtml
You can also sign up to access the API of a whois database (usually will cost money because bandwidth isn't cheap), or download the zone file from a site that provides access to their cached copies, like http://www.premiumdrops.com/zones.html.
Again, accessing said list for each TLD will require its own process.
Lastly, this information becomes stale the moment that you download it, since domains are being continuously registered/renewed/expired. This issue decreases the value of maintaining such a list available for download.
Addendum: This doesn't begin to cover the case where the DNS servers you (or your intended clients) are set up NOT to serve all DNS records as they are registered with their registrars, or many other cases that would make such a list useless.
No supported (anymore) by any TLD operator but the technical mechanism provided by the DNS protocol established in RFC 833 (and refined in subsequent RFC's) is a zone transfer for the TLD root zone, with the
AXFR
request.