# IP collaboration

## Rust SDK Quick Start for Endless Legends <a href="#rust-sdk-quick-start-for-endless-legends" id="rust-sdk-quick-start-for-endless-legends"></a>

### 1. Purpose <a href="#id-1-purpose" id="id-1-purpose"></a>

In the context of the rapid development of the current digital content industry, traditional historical legend novel IPs are facing practical challenges such as copyright confirmation difficulties, content theft, and inequitable revenue distribution. Blockchain technology, with its core features such as decentralization, immutability, and smart contracts, provides a new foundational solution for cultural and creative IPs.

This document describes how to combine cultural and creative content with blockchain to enhance IP extension capabilities and further increase user engagement.

This article takes the widely circulated "Legend of King Arthur and the Knights of the Round Table" in the West as the background, and creates cultural and creative NFTs for the legendary heroes. In addition to collection, it also adds growth concepts and random attributes. Players can freely create their own NFTs and cultivate them, breathing new life into cultural and creative IPs.

#### 1.1. Introduction to Features <a href="#id-11-introduction-to-features" id="id-11-introduction-to-features"></a>

`endless-legends` implements a foundational layer for a complex collectible character RPG with strategic combat and immersive storytelling, all built on the Endless blockchain. The core vision is to create a fair, transparent, and engaging NFT ecosystem with a rich character progression system.

Key features include:

* **True Random Generation**: Utilizes Endless's native randomness for fair and verifiable attribute generation, eliminating manipulation risks.
* **Character Progression System**: An experience-based leveling system where power scales based on character type.
* **Rarity Economics**: A clear hierarchy of character types and lucky values creates natural market dynamics and provides meaningful gameplay advantages for rare characters.
* **Flexible Property System**: Comprehensive attribute management that is extensible for future game mechanics.
* **Administrative Controls**: Secure functions for managing the mint window, supply, and fees.

#### 1.2. Game Design <a href="#id-12-game-design" id="id-12-game-design"></a>

**Hero Design System**

* 1 Role ID
  * Each NFT has an immutable property called Role ID. It identifies the specific hero represented by the NFT. There are 111 heroes in total. King Arthur's Role ID is 111.
  * Role ID 1-10 is a legendary knight, 11-20 is an elite knight, 21-30 is a knight, 31-110 is a warrior. According to the ability ranking of the Knights of the Round Table, a fixed hero name can be assigned to each Role ID.
  * When minting NFT, the probability of obtaining an NFT with a specific Role ID, such as Arthur King, is 0.01% according to the probability table.
* 2 Lucky Value
  * Each NFT also has an immutable property called Lucky Value, which affects NFT's growth and battle performance. The probability distribution of luck values is described in the next section.
* 3 Other properties
  * NFTs also have other mutable gaming attributes, including `role_name`,`experience`,`level`,`power` etc.

**Probability Distribution System**

The contract implements a sophisticated probability system for attribute generation:

* **Role Distribution**: Character roles are distributed according to specific probabilities:

| Role Type        | Role IDs | Probability | Base Power | Power/Level |
| ---------------- | -------- | ----------- | ---------- | ----------- |
| Arthur King      | 111      | 0.01%       | 1000       | 100         |
| Legendary Knight | 1-10     | 1%          | 500        | 80          |
| Elite Knight     | 11-20    | 5%          | 300        | 60          |
| Knight           | 21-30    | 20%         | 200        | 40          |
| Warrior          | 31-110   | 73.99%      | 100        | 20          |

* **Lucky Value Distribution**: Lucky values follow an exponential rarity curve:

| Lucky Value | Probability | Rarity Level |
| ----------- | ----------- | ------------ |
| 1           | 0.01%       | Legendary    |
| 2           | 0.05%       | Epic         |
| 3           | 1%          | Rare         |
| 4           | 10%         | Uncommon     |
| 5           | 88.94%      | Common       |

#### 1.3. Move Contract's Architecture <a href="#id-13-move-contracts-architecture" id="id-13-move-contracts-architecture"></a>

The contract is organized into several interconnected modules, each with specific responsibilities:

* `legends::constants`: Manages configuration and probability settings.
* `legends::collection_manager`: Handles the NFT collection lifecycle.
* `legends::game_logic`: Contains random generation and core game mechanics.
* `legends::property_utils`: Provides utilities for managing NFT properties.
* `legends::nft_manager`: Manages NFT upgrades and post-mint actions.
* `legends::main`: Contains the core minting functionality.

### 2. Endless Move Smart Contract Development <a href="#id-2-endless-move-smart-contract-development" id="id-2-endless-move-smart-contract-development"></a>

The process for setting up the development environment and deploying the Move contract is similar to other Endless projects.

#### 2.1. Install Endless CLI <a href="#id-21-install-endless-cli" id="id-21-install-endless-cli"></a>

Download the `endless-cli` from the [official releases page](https://github.com/endless-labs/endless-release/releases).

**2.1.1. Windows**

Unzip the downloaded `endless-cli-Windows-x86_64.zip` to a specified folder and add the folder to the system's PATH environment variable.

`C:\Users\Alice>endless --version` `endless 2.4.0`

**2.1.2. Ubuntu**

Unzip the downloaded `endless-cli-Ubuntu-x86_64.zip` and add its location to your system's PATH.

#### 2.2. Install endless-vscode-plugin <a href="#id-22-install-endless-vscode-plugin" id="id-22-install-endless-vscode-plugin"></a>

For the best development experience, install the `endless-vscode-plugin` from the VSCode marketplace, following the instructions on its [GitHub page](https://github.com/endless-labs/endless-vscode-plugin).

#### 2.3. Create `endless-legends` Move Contract <a href="#id-23-create-endless-legends-move-contract" id="id-23-create-endless-legends-move-contract"></a>

**2.3.1. Create `move` directory**

Create a `move` directory inside your project folder.

```
{path}>mkdir endless-legends
{path}>cd endless-legends
{path}\endless-legends>mkdir move
{path}\endless-legends>cd move
```

**2.3.2. Initialize Move contract**

```
endless move init --name endless-legends
```

This command creates the necessary directory structure (`sources`, `scripts`, `tests`) and a `Move.toml` file.

**2.3.3. Initialize a deployment account**

Use the CLI to create a new account for deploying the contract.

```
endless init
```

Follow the prompts, selecting `testnet` and generating a new key. This will create a `.endless/config.yaml` file containing your new account's credentials and automatically fund it with 10 EDS on the testnet.

**2.3.4. Modify `Move.toml`**

You will need to add the contract address from your newly created account to the `[addresses]` section of your `Move.toml` file. You also need to add the required `EndlessFramework` and `EndlessToken` dependencies.

```toml
[package]
name = "endless-legends"
version = "1.0.0"

[addresses]
legends_address = "YOUR_ACCOUNT_ADDRESS"

[dependencies]
EndlessFramework = {git = "https://github.com/endless-labs/endless-move-framework", subdir = "endless-framework", rev = "8332b04"}
EndlessToken = {git = "https://github.com/endless-labs/endless-move-framework", subdir = "endless-token", rev = "8332b04"}
```

Replace `YOUR_ACCOUNT_ADDRESS` with the account address from your `.endless/config.yaml` file.

**2.3.5. Develop `legends.move`**

The core logic of the contract resides in `move/sources/`. It contains six modules,this file defines the structs and functions described in section 1.23. The full source code can be found in the project repository.

**2.3.6. Compile and Deploy**

With the contract code in place, compile and publish it to the testnet.

```
# Compile the contract
{path}\endless-legends\move>endless move compile
Compiling, may take a little while to download git dependencies...
INCLUDING DEPENDENCY EndlessFramework
INCLUDING DEPENDENCY EndlessStdlib
INCLUDING DEPENDENCY EndlessToken
INCLUDING DEPENDENCY MoveStdlib
BUILDING endless-legends
[a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::constants,a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::property_utils,a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::game_logic,a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::nft_manager,a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::collection_manager,a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae::main]

# Deploy the contract
{path}\endless-legends\move>endless move publish
Compiling, may take a little while to download git dependencies...
INCLUDING DEPENDENCY EndlessFramework
INCLUDING DEPENDENCY EndlessStdlib
INCLUDING DEPENDENCY EndlessToken
INCLUDING DEPENDENCY MoveStdlib
BUILDING endless-legends
package size 18163 bytes
Do you want to submit a transaction for a range of [1125400 - 1688100] Veins at a gas unit price of 100 Veins? [yes/no] >
yes
transaction_hash:AE1U1AWacUSnUyvKQ2T7k9xYrFf3yLiATtrLR53116FH
gas_used:11254
gas_unit_price:100
sender:a8726a43bf42970c789388f2484cfd24fc341f445f1e360955f898bbca7587ae
sequence_number:0
success:true
timestamp_us:1752568499380325
version:267250612
vm_status:Executed successfully
```

Follow the prompts to confirm the transaction.

### 3. Create a Rust Project <a href="#id-3-create-a-rust-project" id="id-3-create-a-rust-project"></a>

The client for interacting with the `endless-legends` contract is a Rust-based CLI application.

#### 3.1. Install Development Environment <a href="#id-31-install-development-environment" id="id-31-install-development-environment"></a>

Ensure you have a recent version of Rust installed. You can get it from [rust-lang.org](https://www.rust-lang.org/).

#### 3.2. Initialize Rust Project <a href="#id-32-initialize-rust-project" id="id-32-initialize-rust-project"></a>

Use `cargo` to initialize a new Rust project.

```
{path}>cargo init endless-legends
```

This will create in the existing `endless-legends` directory with a `src` folder and a `Cargo.toml` file. And Initialize a git code repository at the same time.

#### 3.3. Add Dependencies <a href="#id-33-add-dependencies" id="id-33-add-dependencies"></a>

Add the necessary dependencies to your `Cargo.toml` file. The key dependencies are `endless-rust-sdk` for blockchain interaction and `clap` for building the CLI.

```toml
[dependencies]
anyhow = "1.0.71"
bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594be5cd5cdf845786a30562d" }
clap = { version = "4.5.40", features = ["cargo"] }
serde = { version = "1.0.193", features = ["derive", "rc"] }
once_cell = "1.10.0"
url = { version = "2.4.0", features = ["serde"] }
tokio = { version = "1.35.1", features = ["full"] }
hex = "0.4.3"
rand_core = "0.5.1"
rand = "0.7.3"
serde_json = { version = "1.0.81", features = ["preserve_order", "arbitrary_precision"] }   

# endless sdk dependencies
endless-sdk = { git = "https://github.com/endless-labs/endless-rust-sdk" }

[patch.crates-io]
serde-reflection = { git = "https://github.com/aptos-labs/serde-reflection", rev = "73b6bbf748334b71ff6d7d09d06a29e3062ca075" }
merlin = { git = "https://github.com/aptos-labs/merlin" }
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
```

### 4. Interacting with the Contract (Rust SDK) <a href="#id-4-interacting-with-the-contract-rust-sdk" id="id-4-interacting-with-the-contract-rust-sdk"></a>

The Rust application provides a CLI to interact with the deployed contract. It is organized into several modules, each handling a specific set of functionalities.

#### 4.1. Project structure <a href="#id-41-project-structure" id="id-41-project-structure"></a>

The core architecture is logically separated into two main components:

* **CLI (`src/cli`)**: This layer is responsible for defining and handling the command-line interface, parsing arguments, and mapping user commands to specific actions.
* **Web3 (`src/web3`)**: This layer encapsulates all the logic for interacting with the blockchain. It uses the `endless-sdk` to build, sign, and submit transactions, as well as query blockchain data.

***

#### 4.2. Directory and File Structure <a href="#id-42-directory-and-file-structure" id="id-42-directory-and-file-structure"></a>

```
src/
├── main.rs           # Application entry point
├── cli/              # Handles all CLI command definitions and logic
│   ├── mod.rs        # Declares the modules within the `cli` directory
│   ├── account.rs    # Defines commands for account management (create, faucet)
│   ├── collection_manager.rs # Defines commands for managing NFT collections
│   ├── commands.rs   # Aggregates all subcommands into a single CLI structure
│   ├── main_module.rs# Defines commands for primary NFT actions (minting)
│   └── nft_manager.rs# Defines commands for updating and managing existing NFTs
└── web3/             # Handles all blockchain interaction logic
    ├── mod.rs        # Declares `web3` modules and contains shared utilities/constants
    ├── account.rs    # Implements account creation, loading, and funding logic
    ├── collection_manager.rs # Implements transaction logic for the `collection_manager` contract
    ├── main_module.rs# Implements transaction logic for the `main` (minting) contract
    └── nft_manager.rs# Implements transaction logic for the `nft_manager` contract
```

***

#### 4.2.3. Implementation Details <a href="#id-423-implementation-details" id="id-423-implementation-details"></a>

**4.2.3.1. `src/main.rs`**

The application's entry point. It uses the `clap` crate to parse command-line arguments into the `Cli` struct defined in `src/cli/commands.rs`. It then calls `handle_command` to process the command.

**4.2.3.2. `src/cli` Module (Command-Line Interface)**

This module acts as the user-facing part of the application.

* **`commands.rs`**: Defines the main `Commands` enum, which enumerates the available subcommands (`Account`, `CollectionManager`, `Main`, `NftManager`). It acts as a router, delegating the parsed arguments to the appropriate handler function in the other `cli` modules.
* **`account.rs`**: Defines the CLI for creating a new account (`CreateAccount`) and funding it from a faucet (`FaucetAccount`). It calls functions from `src/web3/account.rs` to perform these actions.
* **`collection_manager.rs`**: Defines the CLI for initializing an NFT collection (`InitializeCollection`) and updating its parameters (`UpdateMintParams`). It calls the corresponding functions in `src/web3/collection_manager.rs`.
* **`main_module.rs`**: Defines the CLI for minting a single NFT (`MintNft`) and multiple NFTs in a batch (`BatchMintNft`). It calls the corresponding functions in `src/web3/main_module.rs`.
* **`nft_manager.rs`**: Defines the CLI for managing an existing NFT's properties, such as upgrading its level (`UpgradeLevel`), changing its nickname (`UpdateNickname`), or updating its description (`UpdateDescription`). It calls the corresponding functions in `src/web3/nft_manager.rs`.

**4.2.3.3. `src/web3` Module (Blockchain Interaction)**

This module contains all the logic that directly communicates with the Endless blockchain.

* **`mod.rs`**: A central hub for the `web3` layer. It defines shared constants, including the `NODE_URL`, the `LEGENDS_ADDRESS` of the deployed smart contract, and the names of the contract modules. It also provides crucial utility functions like `get_sequence_number` (to fetch the latest sequence number for an account before a transaction) and `get_event_from_tx`/`get_events_from_tx` (to parse specific events from transaction receipts).
* **`account.rs`**: Implements the logic for creating a new keypair and saving it to a local `.json` file. It also handles loading accounts from these files and interacting with the faucet to fund an account.
* **`collection_manager.rs`**: Contains functions that build and send transactions to the `collection_manager` module of the smart contract. It handles the serialization of arguments and submission of transactions for initializing collections and updating their mint parameters.
* **`main_module.rs`**: Contains functions to interact with the `main` module of the smart contract, specifically for executing single and batch mints.
* **`nft_manager.rs`**: Contains functions to interact with the `nft_manager` module of the smart contract, allowing for the modification of NFT metadata and properties after they have been minted.

**4.2.3.4. Execution Flow**

1. A user executes a command (e.g., `cargo run -- main mint-nft ...`).
2. `main.rs` parses the command-line arguments via `clap`.
3. `cli::commands::handle_command` directs the flow to the appropriate handler, such as `cli::main_module::handle_main_command`.
4. The `cli` handler function calls the corresponding implementation in the `web3` layer (e.g., `web3::main_module::mint_nft`).
5. The `web3` function:
   * Loads the signer's account from a local file.
   * Fetches the latest account sequence number.
   * Serializes the transaction arguments using `bcs`.
   * Uses the `endless-sdk`'s `HelperClient` to submit the entry function call to the blockchain.
   * Waits for the transaction to be finalized.
   * Parses the transaction events to find and deserialize the expected result (e.g., `NFTMintEvent`).
6. The result is returned up the call stack and printed to the console.
7. All complete implementations can be found in the code repository.

### 5. Example Usage <a href="#id-5-example-usage" id="id-5-example-usage"></a>

Here is a complete workflow example:

#### 5.1. Account Management <a href="#id-51-account-management" id="id-51-account-management"></a>

The `account` command allows you to create and fund new user accounts.

* **Create an account**:

  ```
  {path}\endless-legends>cargo run -- account create-account --name alice
  CreateAccount's address:2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo
  ```

  This will create a new account named `alice` and save its credentials in an `alice.json` file.
* **Fund an account**:

  ```
  {path}\endless-legends>cargo run account faucet-account --name alice 
  Successfully fauceted account 0x1d59ab72681f1783b2a1dadd6dfcc8a2bba32838826613d738d611a7a23eb008 : 1000000000
  alice balance:1000000000
  ```

  This will request testnet EDS for the `alice` account.

#### 5.2. NFT Collection Management <a href="#id-52-nft-collection-management" id="id-52-nft-collection-management"></a>

The `collection-manager` command is used to create and manage the NFT collection.

* **Initialize the collection**:

  ```
  {path}\endless-legends>cargo run -- collection-manager initialize-collection --admin legends --max-supply 18446744073709551615 --mint-fee 100 --mint-start-time 0 --mint-end-time 18446744073709551615 --base-uri "https://legends-nft.com/collection"

  Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.27s
  Running `target\debug\endless-legends.exe collection-manager initialize-collection --admin legends --max-supply 18446744073709551615 --mint-fee 100 --mint-start-time 0 --mint-end-time 18446744073709551615 --base-uri https://legends-nft.com/collection`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::CollectionCreateEvent
  InitializeCollection:
  CollectionCreateEvent { collection: "2qpNxKiHoeuLg9TZPWuJAN66vfxLLYgWs9CMhpgzjrx1", admin: "CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH", mint_fee: "100", max_supply: "18446744073709551615", current_supply: "0", mint_start_time: "0", mint_end_time: "18446744073709551615", base_uri: "https://legends-nft.com/collection" }
  ```
* **Update the collection mint params**:

  ```
  {path}\endless-legends>cargo run -- collection-manager  update-mint-params --admin legends --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --new-mint-fee 10000 --new-mint-start-time 50000 --new-mint-end-time 18446744073709551615

  Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.18s
  Running `target\debug\endless-legends.exe collection-manager update-mint-params --admin legends --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --new-mint-fee 10000 --new-mint-start-time 50000 --new-mint-end-time 18446744073709551615`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::CollectionUpdateEvent
  UpdateMintParams:
  CollectionUpdateEvent { admin: "CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH", new_mint_fee: "10000", new_mint_start_time: "50000", new_mint_end_time: "18446744073709551615" }

  ```

#### 5.3. Legend NFT MintMint <a href="#id-53-legend-nft-mintmint" id="id-53-legend-nft-mintmint"></a>

The `main` Provides interfaces for minting NFT and batch minting NFT.One NFT represents one Hero.

* **Mint Nft**:

  ```
  {path}\endless-legends>cargo run main mint-nft --singer alice --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --name Hero_0001 --uri http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg --description "King Arthur was a legendary British leader who, according to medieval histories and romances, led the defense of Britain against Saxon invaders. He ruled from Camelot and was advised by the wizard Merlin. Arthur\'s most trusted warriors were the Knights of the Round Table, including Sir Lancelot, Sir Gawain, and Sir Galahad. Together, they embarked on quests such as the search for the Holy Grail and upheld the ideals of chivalry, honor, and courage."
   Compiling endless-legends v0.1.0 (D:\Develop\endless_projects\endless-legends)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 9.61s
  Running `target\debug\endless-legends.exe main mint-nft --singer alice --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --name Hero_0001 --uri http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg --description "King Arthur was a legendary British leader who, according to medieval histories and romances, led the defense of Britain against Saxon invaders. He ruled from Camelot and was advised by the wizard Merlin. Arthur\'s most trusted warriors were the Knights of the Round Table, including Sir Lancelot, Sir Gawain, and Sir Galahad. Together, they embarked on quests such as the search for the Holy Grail and upheld the ideals of chivalry, honor, and courage."`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::NFTMintEvent
  MintNft:
  NFTMintEvent { minter: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD" }
  ```
* **Batch Mint Nft**:

  ```
  {path}\endless-legends>cargo run main batch-mint-nft --singer alice --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --names Hero2 Hero3 Hero4  --uris  http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg  --descriptions "2. King Arthur was a legendary British leader." "3. King Arthur was a legendary British leader." "4. King Arthur was a legendary British leader."
   Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.50s
   Running `target\debug\endless-legends.exe main batch-mint-nft --singer alice --collection-owner CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH --names Hero2 Hero3 Hero4 --uris http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg http://pic.pimg.tw/cm3350658/1425799804-2929097506_wl.jpg --descriptions "2. King Arthur was a legendary British leader." "3. King Arthur was a legendary British leader." "4. King Arthur was a legendary British leader."`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::NFTMintEvent
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::NFTMintEvent
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::collection_manager::NFTMintEvent
  BatchMintNft:
  [NFTMintEvent { minter: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "AjxwrAMHsKa1pDqQEzqeFjTrkcn1aUKwmwXYLiLF3A12" }, NFTMintEvent { minter: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "1qG5FAfAaeTKzsYZYoGmBuTHnUpBw6QGjbqD4SGo8q8" }, NFTMintEvent { minter: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "Apv3hzXt7nxHkFTk2fmR3vttA2XJUDZeanvX6zufJsYq" }]
  ```

#### 5.4. Legend NFT Management <a href="#id-54-legend-nft-management" id="id-54-legend-nft-management"></a>

The `nft-manager` command allows users to interact with their Legend NFTs.

* **Upgrade a NFT's level**:

  ```
  {path}\endless-legends>cargo run nft-manager upgrade-level --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD --experience-gained 3000
  Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.31s
   Running `target\debug\endless-legends.exe nft-manager upgrade-level --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD --experience-gained 3000`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::nft_manager::UpgradeLevelEvent
  UpgradeLevel:
  UpgradeLevelEvent { owner: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD", new_level: "4", level_diff: "3" }
  ```
* **Upgrade a NFT's nickname**:

  ```
  {path}\endless-legends>cargo run nft-manager update-nickname  --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD  --new-nickname Hero05
  Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.26s
   Running `target\debug\endless-legends.exe nft-manager update-nickname --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD --new-nickname Hero05`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::nft_manager::UpdateNicknameEvent
  UpdateNickname:
  UpdateNicknameEvent { owner: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD", new_nickname: "Hero05" }
  ```
* **Upgrade a NFT's description**:

  ```
  {path}\endless-legends>cargo run nft-manager update-description --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD  --new-description "NEW_DESCRIPTION_FOR_TEST. hello update-description."   
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.25s
   Running `target\debug\endless-legends.exe nft-manager update-description --owner alice --token 7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD --new-description "NEW_DESCRIPTION_FOR_TEST. hello update-description."`
  Found matching event type: CLYgaysTdQQv3gpM9AHw1W3H57Gs15hVNPZdWAik1jpH::nft_manager::UpdateDescriptionEvent
  UpdateDescription:
  UpdateDescriptionEvent { owner: "2ya8QCPRG6rPGPB3E8XnGhuoSsKC5teU8sK6tbsk8HWo", nft: "7uEWmqaZfHPcKfQs66fJfNmrZSDmi8PNh28psdMUXxbD", new_description: "NEW_DESCRIPTION_FOR_TEST. hello update-description." }
  ```

### 6. Summarize <a href="#id-6-summarize" id="id-6-summarize"></a>

This guide demonstrated how to set up, deploy, and interact with the endless-legends on-chain Character-Collection RPG system using a Rust-based CLI. We covered how to design on-chain random attributes and growth systems and how to implement these functions using NFTs. Providing a complete overview of the project's capabilities. This powerful combination of Move contracts and a Rust SDK allows for the creation of complex, decentralized games on the Endless blockchain.
