如何防止任何人创建链接到同一URI的智能合约/ NFT?

发布于 2025-01-29 08:59:54 字数 468 浏览 3 评论 0原文

以下是智能合约的最小示例,允许注册URI创建NFT(为了易于论证,这是高度简化的,并且不允许与合同进行任何互动,这是没有人可以注册自己的链接,等):

pragma solidity ^0.6.0

contract ExampleToken {
string public name = "example token"
string public uri = "http://example-link.com/123examplelink"
address public owner_of_token = 0x1234567890...

}

除了高度简化外,这是我们创建NFT的方式(我忽略了ERC标准等),也就是说,我们创建了一个智能合约,允许将地址连接到存储文件的链接(同样,同样,高度高度简化,我没有使用映射或任何东西)。

但是,如何确保该地址确实是该链接文件的所有者?我难道不是只创建第二个合同,声称一个不同的地址是同一链接的所有者?

Below is a min example of a smart contract that allows registering a URI to create an NFT (for ease of argument, this is highly simplified and not doesn't allow any interaction with the contract, that is no one can register their own link, etc.):

pragma solidity ^0.6.0

contract ExampleToken {
string public name = "example token"
string public uri = "http://example-link.com/123examplelink"
address public owner_of_token = 0x1234567890...

}

Except for being highly simplified, this is how we create NFTs (I am ignoring ERC standards etc.), that is we create a smart contract that allows connecting an address to a link where the file is stored (again, highly simplified, I am not using a mapping or anything).

But how is it ensured that this address truly is the owner of that linked file? Couldn't I just create a second contract that claims a different address is the owner of the same link?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随遇而安 2025-02-05 08:59:54

您可以创建一个映射来存储URI,

 mapping(string=>bool) private _usedTokenURIs;

查询此数据结构:

function tokenURIExists(string memory tokenURI) public view returns(bool){
    return _usedTokenURIs[tokenURI]==true;
  }

然后在您的Mint函数中添加需要语句

  require(!tokenURIExists(tokenURI),"Token URI already exists")
  • 然后编写一个函数来 。请记住,人们会从信誉良好的艺术家那里购买,而不是您不知道的随机用户。您不能阻止使用同一URI并创建重复令牌的人。但是本文讨论了一家公司的系统以防止这种情况:

https://cointelegraph.com/news/there-is-is-a-way-way-to-to-protect-nfts-nfts-from-being-being-being-being-replicated-orplicated-or-or-rplicated-or--or-or----丢失 - 这是

柔和网络开发了一种独特的解决方案,以提供额外的解决方案
保证保证NFT的收藏家的保证层不是
撕裂或假货。使用柔和的NFT指纹机制,
创作者可以确保其原始NFT的真实性是
维护。柔和验证真实性和出处
使用创建者的数字签名(如所有使用的NFT系统),
它走得更远,并评估了基础像素的罕见
NFTS数据的模式是。

You could create a mapping to store the URI's

 mapping(string=>bool) private _usedTokenURIs;

Then write a function to query this data structure:

function tokenURIExists(string memory tokenURI) public view returns(bool){
    return _usedTokenURIs[tokenURI]==true;
  }

then add a require statement in your mint function

  require(!tokenURIExists(tokenURI),"Token URI already exists")
  • it is possible that people can use the same uri and make fake nft’s but remember people are gonna buy from reputable artists not from a random user that you dont know. You cannot prevent someone using same uri and creating a duplicate token. but this article talks about a company's system to prevent this:

https://cointelegraph.com/news/there-is-a-way-to-protect-nfts-from-being-replicated-or-lost-this-company-does-just-that

The Pastel Network has developed a unique solution to provide an extra
layer of assurance to collectors that guarantees the NFT is not a
rip-off or a fake. Using the Pastel NFT fingerprint mechanism,
creators can ensure that the authenticity of their original NFT is
maintained. While Pastel verifies the authenticity and provenance
using the creator’s digital signatures (like all NFT systems in use),
it goes much further and assesses how rare the underlying pixel
patterns of the NFTs’ data are.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文