There are four steps to creating a namespace:
NAMESPACE_PREORDERtransaction (live example). This is the first step. This registers the salted hash of the namespace with BNS nodes, and burns the requisite amount of cryptocurrency. In addition, it proves to the BNS nodes that user has honored the BNS consensus rules by including a recent consensus hash in the transaction (see the section on BNS forks for details).
NAMESPACE_REVEALtransaction (live example). This is the second step. This reveals the salt and the namespace ID (pairing it with its
NAMESPACE_PREORDER), it reveals how long names last in this namespace before they expire or must be renewed, and it sets a price function for the namespace that determines how cheap or expensive names its will be. The price function takes a name in this namespace as input, and outputs the amount of cryptocurrency the name will cost (i.e. by examining how long the name is, and whether or not it has any vowels or non-alphabet characters). The namespace creator has the option to collect name registration fees for the first year of the namespace’s existence by setting a namespace creator address.
Seed the namespace with
NAME_IMPORTtransactions (live example). Once the namespace has been revealed, the user has the option to populate it with a set of names. Each imported name is given both an owner and some off-chain state. This step is optional—namespace creators are not required to import names.
NAMESPACE_READYtransaction (live example). This is the final step of the process. It launches the namespace, which makes it available to the public. Once a namespace is ready, anyone can register a name in it if they pay the appropriate amount of cryptocurrency (according to the price funtion revealed in step 2).
The reason for the
NAMESPACE_PREORDER/NAMESPACE_REVEAL pairing is to prevent
frontrunning. The BNS consensus rules require a
NAMESPACE_REVEAL to be
paired with a previous
NAMESPACE_PREORDER sent within the past 24 hours.
If it did not do this, then a malicious actor could watch the blockchain network
and race a victim to claim a namespace.
Namespaces are created on a first-come first-serve basis. If two people try to
create the same namespace, the one that successfully confirms both the
NAMESPACE_REVEAL wins. The fee burned in the
NAMESPACE_PREORDER is spent either way.
Once the user issues the
NAMESPACE_REVEAL, they have
1 year before they must send the
NAMESPACE_READY transaction. If they do not
do this, then the namespace they created disappears (along with all the names
Developers wanting to create their own namespaces should read the namespace creation document. It is highly recommended that developers individula support to create your own namespace, given the large amount of cryptocurrency at stake.