RMRK NFT 2.0 & SNOW

ICONOsphere
7 min readNov 8, 2022

--

Taking your NFTs to the next level with RMRK and SNOW

NFTs have taken the world by storm. From collectibles to utility passes, NFT use cases have risen drastically and RMRK is working to take this to the truly next level, by creating a set of standards far beyond ERC-721 and ERC-1155.

It accomplishes this by developing NFT Lego building blocks that give NFTs new abilities, functions, and customizability, all while being ERC-721 compatible. The projects that adopt this set of standards will be able to build NFTs with features allowing for almost unlimited creative potential.

SNOW is a canary network for the upcoming ICE Blockchain. It is an extension network and application hub of the ICON Ecosystem. Built with Substrate, it is the first network to use the Substrate SDK to extend the feature-set of an existing layer one blockchain protocol. It is the only EVM-compatible parachain that is also optimized for ICON’s BTP. This will position SNOW/ICE as a potential flagship chain within the Polkadot ecosystem that showcases industry-leading cross-chain applications — all powered by ICON’s BTP.

RMRK NFT Lego

Nested NFTs — An NFT is able to own other NFTs directly, instead of cluttering your wallet.

Multi-Resource NFTs — An NFT is able to vary its output depending on the context it is being loaded.

Equippable NFTs — An NFT is able to equip other owned NFTs to gain extra utility or to change its appearance; also known as composable NFTs.

Conditional NFTs — An NFT is able to have different client-side outputs based on some on-chain or off-chain values.

NFTs as DAOs — An NFT is able to be fractionalized and governed by the community.

RMRK on EVM

Although the RMRK journey started in Kusama, the goal was always to get the RMRK NFT standard adopted by the whole industry. Given that more than half of NFT activity happens on Ethereum (and EVM chains), the RMRK team has been busy translating the RMRK NFT standard into EIPs as well as rewriting the RMRK logic into EVM contracts that can be deployed on the EVM-compatible blockchains like SNOW/ICE.

The team is regularly updating the contracts on Github. In addition to the solidity smart contracts, the team has also released sample contracts and a minimal UI to interact with those smart contracts.

For this article, we will be focusing on Multi-Resource NFTs and Nested NFTs. We have created a GitHub repository that combines both contracts and the UI and have also deployed it on the Arctic Testnet. A working implementation can be found here.

Note: You can get the test tokens by following the instruction here.

Home screen for RMRK EVM UI

Disclaimer

RMRK EVM Contracts are still in active development and should not be used in production.
All the following codes are based on rmrk-team/evm-contracts 0.11.1 .

Multi-Resource

To get started with multi-resource NFTs, click on the Multi-resource Demo and deploy a new multi-resource NFT. For the demo, we will be deploying Gangstabet, which is a popular NFT project on the ICON Blockchain.

The details for the collection we are creating are as follows:
Collection Name: Gangstabet
Collection Symbol: GBET
Max NFT Supply: 5555
Price per NFT mint: 0
Collection Metadata URI: https://ipfs.io/ipfs/QmYCQudEvXLbkgsnWjGKqBf6JVNREcV4Soni4CuQWxYQLt

Deploying an RMRK Multi-Resource NFT Collection

Confirm the transaction on the wallet and refresh the page. It should now show the list of the RMRK NFT Collections that you have deployed. Select the contract that you want to use to mint the collection’s NFT. Wait for the transaction to finish and then refresh the page. You should be able to see the NFTs that you have minted.

Your Minted Gangstabet NFTs

You can click on the NFT, to see more details.

If you take a closer look at the image below, you’ll see the gunshot coming out of the NFT. This is because the NFTs are GIFs.

You can now add new resources to your collection. To illustrate the purpose of multi-resource NFTs, we have created a separate collection of PNG images with the same Gangstabet characters. We’ll use that as a new resource for the same NFT.

The metadata URI is: https://ipfs.io/ipfs/bafybeiaihxjzqn5rq2yotj2fl3b4xger6imegsjuqxortmaiaftjtsgwya

Note: A resource is NOT an NFT or a standalone entity you can reference. It is part of an NFT — one of several outputs it can have. In our case, it is a GIF as well as a PNG. It can also be extended to have 3D art and musical pieces.

After you have added a new resource to the collection, you can add the resource to the token.

Note: An owner of an NFT cannot add new resources to their own NFT. This prevents mock-value from being added to an NFT. Only the owner of the collection (issuer) can add a new resource.

Once the resource is added to the token, it is up to the owner of that particular NFT to accept or reject the resource.

In this way, NFT requires the consent of both the issuer and the NFT’s owner.

Under the hood, the smart contract maintains three main mappings.

//mapping of uint64 Resource Ids to resource object
mapping(uint64 => string) private _resources;
//mapping of tokenId to pending resources
mapping(uint256 => uint64[]) private _pendingResources;
//mapping of tokenId to active resources
mapping(uint256 => uint64[]) private _activeResources;

When the issuer adds a new resource, the metadata URI is added to the _resources.

When the issuer adds a new resource to the token, the token resource ID is pushed into the _pendingResources array of that particular token ID.

Finally, when the owner accepts the resource, the resource ID is removed from the _pendingResources and pushed into _activeResourcesarray of that particular token ID.

You can learn more about the user journey in this README by the RMRK team.

Nesting NFTs

To get started with nesting NFTs, click on the Nesting Demo and deploy a new nesting NFT. For this demo too, we will be using the Gangstabet collection.

So,
Collection Name: Gangstabet
Collection Symbol: GBET
Max NFT Supply: 5555
Price per NFT mint: 0
Collection Metadata URI: https://ipfs.io/ipfs/QmYCQudEvXLbkgsnWjGKqBf6JVNREcV4Soni4CuQWxYQLt

Deploying an RMRK Nesting NFT

Confirm the transaction on the wallet and refresh the page. It should show the list of the RMRK NFT Collections that you have deployed. Select the contract that you want to use to mint the collection’s NFT. Wait for the transaction to finish and then refresh the page. You should be able to see the NFTs that you have minted.

Your Minted Gangstabet NFTs

You can click on the NFT Token ID: 1 to see more details.

Details on my owned NFTs

Since I own both NFTs, I can transfer any NFT to another NFT. For the demo, let’s transfer our NFT of token ID 2 to the NFT of token ID 1. Once we do that, we can see we have the option to accept or reject the child.

Under the hood, when transferring our NFT to another NFT, we make use of the _nestTransfer method. We can see how is it defined.

nestTransfer function in RMRK nesting contract.

To understand how it works, we should first understand thermrkOwnerOf function. Similar to ERC-721'sownerOf function, rmrkOwnerOf also takes tokenId as an argument and returns the owner of that particular NFT.

However, the owner information is extended in the rmrkOwnerOf since the NFT can also be owned by another NFT in the nested system. So, rmrkOwnerOf returns three parameters:

  1. ownerAddress: Address
  2. tokenId: uint256
  3. isNft: bool

If the NFT is owned by a wallet, tokenId will be zero and isNft will be false.

Otherwise, the returned data is the contract address and tokenId of the owner NFT, as well as isNFT flag is true.

The use of rmrkOwnerOf also enables us to check if the nesting is too deep.

Finally, let’s look at what happens in the sendToNFT function call done at the end of the nestTransfer method.

It simply calls addChild function of the destination contract. Let’s take a deeper look at this function.

We can see that the function creates a Child object and pushes it into the _pendingChildren array.

In case we accept the child, the Child object is removed from _pendingChildren array and pushed into _activeChildren .

In case we reject the child, the Child object is removed from the _pendingChildren array.

You can learn more about the user journey in this README by the RMRK team.

Combining the Legos

The true power of RMRK NFTs comes from being able to combine these different Legos to enhance creative potential.

So, we can also create a new collection that uses both Nesting and Multiresource RMRK Legos.

Conclusion

With the RMRK NFT standards being translated into EIPs and EVM smart contracts being developed, the RMRK team is on the right track to getting the RMRK NFT standard adopted by the whole industry.

With a lot of developers and users in the EVM ecosystem, I naturally expect to see some amazing projects/products that will be built using RMRK standards.

--

--

ICONOsphere

With a deep history of commitment to building projects that foster community growth & personal empowerment we work to create a nation built on trust with icon.