I am developing a free DNS service and I can't totally solve the situation when two or more customers try to add the same domain (nearly at the same time).
Here are a few solutions to handle this situation, but none of them seems to be good or viable.
Solution 1:
Use different pairs of name server for each customer
Creating multiple and distinct ns's (like ns1, ns2.. ns49, ns50, ns51..) allows me to use different pairs of servers with different customers trying to add same domain.
The real owner will use only his pair in domain registrar (ie: ns8 and ns9) so only his records will be accepted and propagated to the whole internet.
The problem with Solution 1:
It is vulnerable to a mass attack
If a malicious person create a really big number of accounts, it would be impossible to have an equivalent number of pairs, if all of these accounts try to add the same domain.
Solution 2:
Only allow one user account to use a domain
If one user already added a specific domain and correctly configured it in his domain registrar, no other account will be able to add the same domain.
The problem with Solution 2:
Grace time
It can take hours to validate an added domain (please, correct me If I am wrong). It would require me to give a "grace time" to allow each recently added domain to stay "unverified" until we can validate it through the respective domain registrar.
Also, during this grace time, no other account would be able to add the same domain unless we use solution 1 ( but remember #1 has a vulnerability ).
How free (or paid) DSN services solve this problem? What are their approaches (since any user apparently can add whatever domain it wants without restrictions) ?
Edit: about the duplicate
There is a slight difference between my question and Era's one. I am the provider and not the customer. And Era's question only points to the problem from the customer's eyes.
Also, even @Jacob from DigitalOcean stated that they do a "first come, first serve" approach which I am trying to avoid and is the reason for my question to exist.