帖子
分享您的知识。
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
答案
2关于添加类似于 TypeScript 的可选字段,你确实可以自定义 NFT 元数据. 流行的 NFT 集合使用了一种 “标准” 元数据格式,但你可以偏离它. VecMap
如您所述,使用属性,并探索使用Display
参数自定义显示的元数据的选项. 要了解更多信息,请浏览以下资源:
听起来你最担心的是有人可能会推断出未来的 NFT 元数据,因为它们是按顺序铸造的. 为了降低这种风险,可以考虑将元数据序列改组到区块链之外. 这样,尽管它们可能在区块链上按顺序显示,但元数据是不可预测的. 或者,分配一个随机 ID,并确保铸币函数检查此 ID 是否尚未铸造.
你知道答案吗?
请登录并分享。
Move is an executable bytecode language used to implement custom transactions and smart contracts.