NEM Catapult: Understanding Namespaces and Mosaics

Join the discussion in the NEM forum’s!

NEM Catapult Namespaces, Mosaics, Aliases

This is a Catapult features update from our Catapult Series
Link to the document can be found: here.
Translations:
Spanish, Japanese, Italian, Russian
Updated: May 13, 2019

Recent updates in NEM have been implemented to the namespace and mosaic features integral to the NEM blockchain’s operations. These updates will further boost the flexibility and functionality of namespaces and mosaics to satisfy enterprise demands. Of course, before we cover the specifics of the changes from NIS1 (the current version of NEM) to Catapult (next NEM core engine), it may be useful to briefly review how the mosaic and namespace features currently work.

Namespace

A namespace is a text string that points to a NEM account address. One can think of it as a public domain name for a NEM account. For example, “dinosaurs” could be owned by a NEM address, NAAAAA-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXX. The fee to establish or renew a namespace for an account in NIS1 is 100 XEM. (Note that for the rest of this post, the words “addresses” and “accounts” will be used interchangeably, as they are essentially equivalent in the NEM-verse.)

Subnamespace

Continuing with the web domain analogy, subnamespaces resembles website subdomains, e.g. a blog.shop.net, to define separate categories within larger namespaces. For example, the subnamespace “ornithischia” could be established under “dinosaurs,” which would be written out in NEM syntax as “dinosaurs.ornithischia.” In NIS1, subnamespaces can additionally have their own subnamespaces, for up to three levels in total, i.e., “dinosaurs.ornithischia.triceratops.” The fee to establish a subnamespace for an account presently is 10 XEM.

Mosaic

A mosaic is a string-named asset defined on the NEM blockchain that is linked to a namespace. On other blockchains, mosaics are also called “tokens.” or “assets”. The originating location of a mosaic on the NEM blockchain would be written out as namespace: mosaic or namespace.subnamespace:mosaic, i.e. “dinosaurs.ornithischia:fossils.” In NIS1, the namespace needed to be created before the mosaic. The fee to create a mosaic for a namespace is presently 10 XEM.

Catapult builds on the achievements of its previous iteration, adding the newest innovations in blockchain technology. Its emphasis lies on scalability, but Catapult will bring overall improvement to the NEM platform. The following changes to namespaces and mosaics will make NEM more convenient and user-friendly.

Namespace registration

In NIS1, namespaces can only be linked to an account through an annual rental contract that is irreversible once initiated. At the end of the one year term, the owner of the namespace has to renew their contracts to retain their ownership of the root namespace and the corresponding subnamespaces and mosaics. If the contract is not renewed within a month of the deadline, assets created on top of the root namespace will expire and disappear.

In contrast to NIS1, namespace creators will be able to choose the renting duration in Catapult. In the RegisterNamespaceTransaction, the creator can specify the exact number of blocks of desired ownership. During the renting period, it will also be possible to extend the rental by sending another register transaction with the extra-confirmed block to rent the namespace. When a renting period ends, the namespace will become inactive.

Read more: Namespace

Mosaic registration

In NIS1, a mosaic can only be created in conjunction with a previously registered and active namespace. In Catapult, a mosaic can be created without a namespace. For instance, a mosaic could be created with a random set of characters that will be used as its identifier; this may look something like (0dc67fbe1cad29e3).

Mosaics, now detached from namespaces, have an independent expiration time. Catapult introduces the possibility to create mosaics that never expire, which is not possible in the current version.

Read more: Mosaic

Linking namespaces with accounts and mosaics

The new feature that Catapult introduces to build on NIS1 namespaces are aliases. An alias is derived from a namespace assigned to an account or mosaic for easier referencing.

In Catapult, users will be able to freely manage the linking of namespace and subnamespace addresses (and consequently, aliases) to NEM accounts and mosaics in a manner that is not possible in NEM1. The management of aliases and namespaces will occur through alias transactions, which will include AddressAliasTransaction or MosaicAliasTransaction functions. The new functions will give users added flexibility within the NEM ecosystem. You can think of an alias transaction as a smart contract that assigns the namespace to a different account so it can be recognized easily by an easily human readable format instead of a random string of characters.

To demonstrate, let’s say John registered the namespaces “dinosaur” and “fossils” and respectively associated them as aliases to an address (NBBBBB-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXX) and mosaic(ID:0dc67fbe1cad29e3). In Catapult, Sally could simply input to send 100 “fossils” to “dinosaur” in the NEM wallet interface rather than send 100 “0dc67fbe1cad29e3” to NBBBBB-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXX.

Alias connections can be easily modified. A mosaic ID may be linked and unlinked with any registered namespace. However, only the creators of the mosaics will be able to edit its alias relations, as is appropriate for basic security reasons. Multiple namespaces may be associated with a single address or mosaic, but each namespace must be unique.

Ultimately, aliases are a defining feature in NEM that will separate public chain Catapult from other blockchains. Aliases and namespaces in Catapult will advance the public blockchain user experience by facilitating easier, less confusing, and more secure transaction processes. It will be easier for users to identify, double-check, and copy-paste recognizable and trusted aliases, rather than lengthy addresses.

Read more: Alias

Examples

Now, let us present a hypothetical, practical example that puts together all the features we have described in the preceding paragraphs. Suppose a Cheryl Gonzales is running against a Patricia Choi to become Mayor of Santa Frangelina, a city in the U.S. The city of Santa Frangelina has decided to carry out their municipal elections using the public NEM blockchain. A root NEM namespace is created, associated with the municipal government of Santa Frangelina, “Santa Frangelina,” and following that, a NEM subnamespace “Santa Frangelina.2019MunicipalMayoralElection” is created. Two second-level subnamespaces are then initiated, one representing each candidate in the election and these are assigned as aliases to the candidates:

Address:
SantaFrangelina.2019MunicipalMayoralElection.CandidateGonzales

Address:
SantaFrangelina.2019MunicipalMayoralElection.CandidateChoi

A third second-level subnamespace is created and assigned to a mosaic as its alias.

Mosaic: SantaFrangelina.2019MunicipalMayoralElection.Vote

We are now ready to proceed with the election by instantiating and issuing mosaics to accounts of eligible voters. The vote mosaic is created, linked to an appropriate namespace, and handed out systematically to all eligible voters. The voters are given time to choose and vote for their preferred candidate. After the deadline has passed, the votes can be counted by checking the balance of the vote mosaics in the respective candidate’s addresses, and the address with a higher amount of votes will win the election.

Namespaces and mosaics

For another example of how the adaptability of Catapult aliases can be employed, suppose there is a student named Kelly with a NEM address of NCVG35-ZSPMYP-L2POZQ-JGSVEG-RYOJ3V-BNIU3U-N2E6. For convenience’s sake, Kelly might register the namespace Kelly99 and link it to her address for general use. When she enrolls at UCLA, the school might assign UCLA.ID90703 as another alias to her account.

The UCLA namespace can be used for Kelly to specifically interact in the UCLA ecosystem. When she graduates, the namespace can be set to expire and is free to be used by another incoming student.

With these updates, Catapult continues to realize convenient, powerful, and flexible features for enterprise functionality. The developers intend to keep NEM on its path at the cutting edge of blockchain, and will eagerly receive additional input and suggestions on features expansion and technical implementation of Catapult across NEM’s social media channels. Do stay tuned for further updates and development announcements.

Link to the document can be found: here.

References:

https://nemtech.github.io/concepts/namespace.html
https://docs.nem.io/ja/nanowallet/mosaics
https://nemtech.github.io/guides/mosaic/creating-a-mosaic.html
https://nemtech.github.io/guides/namespace/link-a-namespace-to-an-address.html
https://nemtech.github.io/guides/namespace/link-a-namespace-to-a-mosaic.html

Check out previous news about Catapult!

You may also like...