Post
Share your knowledge.
How to keep NFT metadata stable without leaking info?
I'm trying to develop an NFT contract and wish to make sure all NFT metadata remains stable. I'm concerned that if I include a source metadata link in the contract, it could be visible to users who might exploit it. How can I prevent this from happening? Additionally, I'd like to know if I can add optional fields to an NFT object as I do in TypeScript. Here's my idea:
type NFT = {
name: string;
description: string;
url: string;
attributes: {field: string; value: string}[];
};
I've never seen this approach before and I feel like I'm missing something. Can someone guide me on the best practices here?
- Move CLI
- Smart Contract
Answers
2Regarding adding optional fields similar to TypeScript, you can indeed customize your NFT metadata. There's a 'standard' metadata format used by popular NFT collections, but you can deviate from it. Use VecMap
for attributes as you mentioned, and explore the options of using the Display
parameter to customize what metadata is shown. To learn more, explore these resources:
It sounds like your main concern is that someone might deduce future NFT metadata because of how they're minted sequentially. To mitigate this risk, consider shuffling the metadata sequence outside the blockchain. This way, even though they may appear sequential on the blockchain, the metadata won't be predictable. Alternatively, assign a random ID and ensure that the minting function checks that this ID hasn't been minted yet.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.