Rust

Our implementation consists of two repositories: NRC-721 and NRC-721-template. The first one contains the base implementation of the type-script for a custom NFT. It also contains optional behaviors that can be added using a single line of code, increasing the capabilities of the NRC-721. The second repository contains a template for creating custom NFTs.

Custom NFT creation procedure

In order to compile the custom NFT, it is necessary to have ckb-capsule installed and working.

Then the following steps will suffice to edit and build a new NFT.

First, we need to clone the NRC-721-template repository. Then, to define custom behavior we have two main points to introduce the desired logic. Editing the file contracts/custom_nft/src/entry.rs, we find two sections marked through code comments.

Composite script section: allows defining a list of basic behaviors that we want our NFT to implement. In this section, we can choose from the basic behaviors available in the extensions module.

Custom behavior section: this section allows defining custom behaviors through Rust code. Once the behavior definition is completed we can build the typeScript using Capsule.

capsule build

The resulting script can be tested by a test included in the repository using capsule again.

capsule test

In order to use the script in production we must build it in release mode.

capsule build --release

Last updated