What is Nemesis 2D
Nemesis 2D is a proof of concept that intends to let people acknowledge NEM functionalities, and a way to create a Non-Fungible Token-like environment.
NEMESIS 2D is a grid divided into many cells.
People can take ownership of these cells and display an image and text in them, in a decentralized way.
Here are available resources, please note that it is a very early stage:
- Nemesis 2D online client
- Nemesis 2D source code
- The source code used to create the environment (it is a work in progress, do not use as-is)
Here is a walkthrough of how it is working. I use the official wallet to show the process, but the idea is to achieve all these steps programmatically.
1) Grid creation. An arbitrary grid is defined. In this PoC, I chose a grid of 111 lines and 6 columns, with the following format: L001C2 (Line 1, Column 2).
2)Publisher creation. For each cell in the grid, one NEM account is created. Each account is bound to “own” one cell. I coined them the Publishers.
3)Key accounts creation. Three “key” accounts are created, I called them God, Registry, and Metadata.
4)Registry creation. For each cell in the grid, “God” sends a message to “Registry” that ties the grid cells to the accounts created on the point 2). I chose the following format: <address>:<coordinates>.
We now have an immutable Publisher => Coordinate registry!
5)Publishers founding. Once “mapped”, each Publisher can be prepared to be transferred. We will use NEM multisig features to do that. First, we need to provision each Publisher with XEM so they can bear the transactions fees required to achieve the next steps. I chose to transfer each of them 1.15XEM.
6)Publisher first conversion. Each Publisher is converted to a 1–1 multisig account owned by God. 1–1 stand for 1 signature among 1 cosigner needed to validate any transaction of the multisig account. God is now the owner of all of the accounts linked to cells. Note that once an account is converted to a multisig account, its private key becomes useless.
7)Publisher transfers to third-party users. We can now transfer accounts to users, by using the exact same mechanism. Step 6 could technically be skipped according to the use case and/or the property distribution system. Here I chose the option to create the whole environment, before initiating the transmission of the Publishers to third-party users. This operation is called an edition of a multisignature contract. It consists of removing God as a cosignatory and replacing it by a third party user. Note that in order to be assigned as a cosignatory, an account must have done at least one transaction!
8)God suicides. Once the ownership of all the accounts has been transferred from God, it is possible to convert God itself as a 1–1 multisig account owned by the Nemesis address. By doing that, God becomes provably unusable as nobody can take control over him. Then the Publisher => Coordinate registry becomes immutable!
9) Publish data to a cell. The initial goal is to have the owner of a Publisher to be able to add things in the square. In this PoC, I chose to let users being the possibility to add an image and text that can contain hyperlinks. To update the content of a cell, the owner can send a multisig transaction with a message in a defined format. Here is the PoC format: T:<text>[<clickable text>](<URL>)<text>;I:<URL to image>.
Raw text of the example below: T:Hello Nemesis! [Check the repo here!](https://bit.ly/2EuIOiM) ;I:https://bit.ly/2A3umun
10) Rendering that to a webpage. Once I will be satisfied with the code, I will write a detailed article on the subject. Roughly, only 3 steps are needed:
10) A> Initiate the grid by populating an array with all the coordinates
10) B> Fetch all the incoming transactions of the Registry, and build the Publisher => Coordinate mapping
10) C> Fetch all the incoming transactions of Metadata starting by the newest, only keeping the newest transaction of each Publisher.
10) D> Check that the messages from the Publishers to Metadata are all compliant. Here I put limitations on the image size. Transform the raw text to HTML, and then render the grid!
That’s it! Contact me if you want to own a cell in Nemesis 2D!