If I want to do nft, how do I get the collection id

I see that the collection id of Chia Friends is “517B1E97-F1AF-4824-A7B9-8D85E281D7B8”, how is this generated, are there any requirements?

How to generate uuid in python:

import uuid

In Chia Friends, a UUIDv4 is used. You can generate one of these easily using an online tool, just search for “UUIDv4 generator”.

It’s not an ID that needs to be secure, it should just be unique - i.e. not used by anyone else. And UUIDs are designed for this purpose.

The metadata format defined in CHIP-0007 specifies "format": "uuid" for the collection ID. What this means (in the 2020-12 JSON Schema) is that any version of UUID as defined in RFC 4122 can be used, but it’s not strictly enforced - you could put any string in here and it would technically pass the JSON schema.

For context, the purpose of the collection ID is for wallet and marketplaces to be able to group your NFTs together into a single collection. However, anyone else can choose the same collection ID, so most tools will group by a combination of the collection ID and the DID that the NFT was first assigned to.

So to summarise, you should:

  1. Use the same UUID (preferably UUIDv4) as the collection ID for every NFT you want to appear in that collection.
  2. Assign all of the NFTs you want in this collection to the same DID wallet. You can do this by minting directly to this DID wallet, or if you mint to your NFT wallet, you can assign them to this DID afterwards.