一些筆記,關於 gas 與 ipfs hash (CID)。 - 用 Byte32 貯存 SHA256-specifc hash 可以節省瓦斯 https://ethereum.stackexchange.com/a/17112 - 基於 future-proof 原則也有認為應用 bytes 的觀點 bytes because they are more than 32 bytes. https://ethereum.stackexchange.com/a/6862 - 為什麼不用兩個 Bytes32 的正反論戰 https://ethereum.stackexchange.com/a/86494 不同實作方式瓦斯費比較(反對只用單一 Bytes32) https://medium.com/temporal-cloud/efficient-usable-and-cheap-storage-of-ipfs-hashes-in-solidity-smart-contracts-eb3bef129eba - 瓦斯費比較 https://ethereum.stackexchange.com/a/61104 string ~ gasUsed: 85986 units, gasCost (ether): 0.00171972 ether struct ~ gasUsed: 55600 units, gasCost (ether): 0.001112 ether event log ~ gasUsed: 27501 units, gasCost (ether): 0.00055002 ether struct event log ~ 25841 units, gasCost (ether): 0.00051682 ether 關於 future-proof Smart Waifu 算是鏈上做的很好吧(辛苦了 XD) 如果做兩層 IPFS (TokenURI -> Image) 那麼即使 TokenURI prefix 可以在合約裡置換 Image 因為在鏈下合約裡也鞭長莫及 所以一個比較理想的可能是在檔案格式上作文章 PNG 1.2 理論上也可以塞 EXIF 資訊進去了 https://stackoverflow.com/a/9576717 jpeg 則是本來就行 那以現在 NFT 來說 其實就對含有 EXIF 的 PNG/JPEG 作一次雜湊後記錄就行 (前端則要負責去解析;現在 JSON 的做法多少有些畫蛇添足。) 目前 oasis 既不支援非 ERC721Enumerable 也不支援 ipfs:// URI (倒是發現一個小漏洞:ipfs:// 不會顯示圖片但是可以 transfer XD) 但就算談 future-proof 如果 ipfs.io 的 https gateway 掛掉(或者 infura) 那 IPFS 跟 NFT 大概也都不用玩了
No comments yet