如何防止任何人创建链接到同一URI的智能合约/ NFT?
以下是智能合约的最小示例,允许注册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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个映射来存储URI,
查询此数据结构:
然后在您的Mint函数中添加
需要
语句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----丢失 - 这是
You could create a mapping to store the URI's
Then write a function to query this data structure:
then add a
require
statement in your mint functionhttps://cointelegraph.com/news/there-is-a-way-to-protect-nfts-from-being-replicated-or-lost-this-company-does-just-that