MetaCreats中文

Posted on Apr 01, 2022Read on Mirror.xyz

斯坦福考试奖励NFT,引领新兴文凭?

近期关于斯坦福大学的结业考试奖励NFT,引起了不小的讨论。很早就有斯坦福区块链研究小组参与布局区块链的相关报道。当前热门的NFT为什么会引起热捧,已有不少高校在创作关于NFT的授课书籍,这些对于未来又会有怎么样的冲击呢?

为什么会有人愿意花掉几十万上百万去购买一张图片?或许他们买的是吹牛的权利,他们可以四处找人吹嘘说“嘿,你可以下载,这很棒。但我是主人这其中意味着什么?”仅仅是为了炫耀吗

斯坦福大学 CS 251

加密货币和区块链技术https://cs251.stanford.edu/

该课程涵盖了加密货币、区块链和智能合约的所有方面,包括分布式共识、智能合约、经济学、可扩展性和应用程序。

2021年课程学完期末考试合格可以获得一个NFT,97 个人拿到了这个 NFT。当前Opensea 地板价 显示为9.9 ETH (不能交易),光凭这一个NFT奖励就可以拿来刷新简历获得很棒的Offer了吧!

https://opensea.io/collection/stanford-cs-251-nft-autumn-2021

考试题Q4 NFT

The Hashmasks re-entrency bug

solidity re-entrency bug,在这个问题中我们将看一个有趣的现实世界的例子。考虑以下可靠性代码片段16384 NFT。用户一次最多可以通过调用 20 个 NFT合约上的 mintNFT() 函数。你可以假设所有的内部变量由构造函数正确初始化(未显示)。

$function mintNFT(uint256 numberOfNfts) public payable {require(totalSupply() < 16384, "Sale has already ended");require(numberOfNfts > 0, "numberOfNfts cannot be 0");require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once");require(totalSupply().add(numberOfNfts) <= 16384, "Exceeds NFT supply");require(getNFTPrice().mul(numberOfNfts) == msg.value, "Value sent is not correct");for (uint i = 0; i < numberOfNfts; i++) {uint mintIndex = totalSupply(); // get number of NFTs issued so far_safeMint(msg.sender, mintIndex); // mint the next one} }function _safeMint(address to, uint256 tokenId) internal virtual {// Mint one NFT and assign it to address(to).require(!_exists(tokenId), "ERC721: token already minted");_data = _mint(to, tokenId); // mint NFT and assign it to address to_totalSupply ++; // increment totalSupply() by oneif (to.isContract()) {// Confirm that NFT was recorded properly by calling// the function onERC721Received() at address(to).// The arguments to the function are not important here.// If onERC721Received is implemented correctly at address(to) then// the function returns _ERC721_RECEIVED if all is well.bytes4 memory retval =IERC721Receiver(to).onERC721Received(to, address(0), tokenId, _data);require(retval == _ERC721_RECEIVED, "NFT Rejected by receiver");} }$

让我们来证明 _safeMint 根本不安全。

A) 假设已经铸造了 16370 个 NFT,因此 totalSupply() == 16370。解释恶意合约怎么导致铸造超过 16384 个。攻击者可以铸造的最大 NFT 数量是多少?提示:如果调用地址的 onERC721Received 是恶意的,会发生什么?检查仔细铸币循环并考虑可重新进入的错误。

B) 为恶意 Solidity 合约编写代码,从(a) 部分,假设 totalSupply() 的当前值为 16370。

C) 你会在上一页的代码中添加或更改哪一行 Solidity防止被攻击?请注意,单笔交易不应超过 20NFT

关于NFT的合约代码问题,非常常见。很多NFT在发行上线时都要考虑到这个问题的严重性,导致NFT破发,无法mint,合约代码无法调用等等。以上问题贴切的体现出斯坦福关于NFT时事热点的关注度,你知道怎么解答吗?

关于NFT

世界上最令人羡慕的NFT,如果NFT可以改变教育会带来什么不一样的感受呢?一种新的文凭?NFT 抓住了许多学生好奇的新兴趋势,更广泛视野,对学生来说也可以帮助在课堂上建立社区。

NFT 模糊了爱好和投资之间的界限。许多收藏家将收藏作为一种爱好,无意出售或交易他们珍贵的数字财产,收藏家可能有机会获得巨额利润。这是一个独特的灵活市场,因为它可以同时做到这两点。


风险提示:

NFA DYOR (Not Financial Advice Do Your Own Research)本文仅用于分享交流,不作为投资建议。

关注MetaCreat

Twitter: https://twitter.com/MetaCreats

Medium: https://medium.com/@MetaCreats

Mirror: https://mirror.xyz/0x2519b80f3c38433a4eB73A5fd0E7bfd122C4D97f

Mirror中文:https://mirror.xyz/0xe327aeEa2b52fCB1e2498b5B0F08a7F425f1e7A7