The workshop demonstrates how to store, manage, and extend data using nested tokens within the Unique Network.
- Create a Substrate account
- Get
OPL
(testnet) tokens: https://t.me/unique2faucet_opal_bot - Create
.env
from.env-example
and set your mnemonic phrase - Run
npm install
Let's create a very simple game. In this game user can mint an NFT that represents racing car. Each NFT starts with an empty record—no wins, no losses.
Players can then compete against each other. When a car wins a race, its Victories
counter increases. If it loses, the Defeats
counter increments accordingly.
Exciting achievements can be awarded as well, and these achievements are also NFTs owned by the original racing car NFTs!
- All NFTs are owned by individual users
- The application can modify NFT properties
- Users cannot directly modify the properties of their NFTs
node ./src/1-collection-cars.js
node ./src/2-collection-achievement.js
Pass the following arguments to the function
- collectionId (step 1)
- owner Substrate address
- owner nickname
For example:
node ./src/3-create-car.js 3135 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY FastGuy
node ./src/3-create-car.js 3135 5CPuU98SimxwoHZRZCi8hezgnfBwATs8vKo6haqkaP3hUj7X RaceQueen
Pass the following arguments to the function
- Cars collectionId (step 1)
- Achievements collectionId (step 2)
- First player's tokenId
- Second player's tokenId
node ./src/4-play.js 3132 3133 1 2