Move.

帖子

分享您的知识。

Dominikus .
Jan 30, 2025
专家问答

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
3
2
分享
评论
.

答案

2
yhant3.
Feb 5 2025, 11:01

关于添加类似于 TypeScript 的可选字段,你确实可以自定义 NFT 元数据. 流行的 NFT 集合使用了一种 “标准” 元数据格式,但你可以偏离它. VecMap如您所述,使用属性,并探索使用Display参数自定义显示的元数据的选项. 要了解更多信息,请浏览以下资源:

-NFT 标准和特许权使用费 -带场的 SUI 视觉对象 -NFT 显示参数

3
最佳答案
评论
.
Michelle .
Feb 5 2025, 11:01

听起来你最担心的是有人可能会推断出未来的 NFT 元数据,因为它们是按顺序铸造的. 为了降低这种风险,可以考虑将元数据序列改组到区块链之外. 这样,尽管它们可能在区块链上按顺序显示,但元数据是不可预测的. 或者,分配一个随机 ID,并确保铸币函数检查此 ID 是否尚未铸造.

1
评论
.

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息