Namespace

From NEM Wiki
Jump to: navigation, search

Namespaces on the NEM system are a domain naming system, similar to that of the internet. There are higher level domains and sub-domains. This allows one person with one domain to create many different subdomains for their different projects or outside business accounts. It also helps to build and maintain a reputation system for Mosaics.

A domain or the sub-domain allows a person to create a unique Mosaic. Without the domain or sub-domain a Mosaic can have the same name and therefore is not unique, just like the domain naming convention, where every website or url is uniquely defined with the help of a unique domain name.

A creator owning the root domain namespace can create as many sub-domains as needed using a convention similar to the Java namespace convention, i.e., separated by a dot \".\" to represent a domain or subdomain and a colon \":\" to represent the name of an asset (in NEM, this is defined as a mosaic). This gives the creator a practically limitless number of mosaics that can be defined within a practically limitless number of sub-domains.

The sub-levels of a namespace can act as the actual name of the asset class as it is itself a sub-domain with lots of assets under that sub-domain name. This means that last part of a string will always be the name of the individual asset on the NEM blockchain and the prior names will act as the domain and/or subdomain for that asset.

Use for Sending Assets

The upcoming Nano Wallet will include a feature called "send by namespace." This will allow users of the NEM blockchain to exchange XEM and other assets using a name, rather than an address. Instead of having someone you want to receive money from scan your QR code, they can just send money to your registered namespace.

Use in Mosaics

For more about mosaics, read the Wiki page about Mosaics.

Namespace (root level domain): spaceminers 
Sub-domain 1: mars 
Sub-domain 2: moon
Mosaics: 
gold 
gem
water
//Accordingly, mosaics or the asset can be named as such: 
spaceminers:gold 
spaceminers:gem 
spaceminers:water 
spaceminers.mars:gold 
spaceminers.mars:gem 
spaceminers.mars:water 
spaceminers.mars.moon:gold 
spaceminers.mars.moon:gem 
spaceminers.mars.moon:water

Each of the above mosaics is made unique by the namespace’s fully qualified name. Also, the mosaic is preceded by an “:” to differentiate it from a namespace.

In summary, everything under the root level domain belongs to the account that created it. In the above examples, the root level domain name is “spaceminers”.

Other Uses

Anything where it would be more useful to see a name, rather than a long address can probably be implemented into this namespaces feature. One such example is a distributed DNS, which is something that other projects are doing without a strong core like NEM.