## Gear 合约开发案例解析 - OnChain NFT <p align="center"> <a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-on-chain-nft"> <img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR"> </a> </p> 代码仓库: https://github.com/gear-foundation/dapps-on-chain-nft 本 PPT 链接: https://hackmd.io/@btwiuse/on-chain-nft --- How Do Off-Chain NFTs Work? [wiki](https://wiki.gear-tech.io/docs/examples/gnft-721/) | [example](https://gear-non-fungible-token.vercel.app/nft/0) | [contract](https://idea.gear-tech.io/state/full/0xd48e2451dbb32de3e7d73623dc4b172a3f13eb1faf0a0cd89186513a0469bf00?node=wss%3A%2F%2Ftestnet.vara.rs) ``` { "name": "Genesis", "description": "genesis nft", "media": "Qmf3WTdCiDPD5mfP3N6jKU3WfHGLB6LtkBGo5AKEMRJNRR", "reference": "QmQ3sFAbF9Ry39NGS2GUnzXCvYybRbYVm9qL4TBxac9PMj" } ``` - reference (NFT Attributes): [QmQ3...9PMj](https://ipfs-gw.gear-tech.io/ipfs/QmQ3sFAbF9Ry39NGS2GUnzXCvYybRbYVm9qL4TBxac9PMj) - media (NFT Image): [Qmf3...JNRR](https://ipfs-gw.gear-tech.io/ipfs/Qmf3WTdCiDPD5mfP3N6jKU3WfHGLB6LtkBGo5AKEMRJNRR) --- What’s The Problem With Off-Chain NFTs? - Off-chain NFTs are usually stored on a server, cloud storage, or IPFS somewhere. - In any event, if the storage service is disrupted or completely goes down for whatever reason, the link will lead to nowhere and the asset will not be accessible. --- Introducing On-Chain NFTs - Firstly, when initializing a collection, one should provide all the possible images of all the layers for a collection. - Secondly, when minting alongside with a small metadata, one should provide a combination of layers used for a specific NFT. This approach seems quite costly when initializing, but is relatively cheap when it comes to minting. --- 例如,创建一个 背景+人物 形式的 NFT 集合,需要下列图层 ``` [ [ "#黑色[0]", "#白色[1]", "#蓝色[2]" ], [ "#李小龙[0]", "#青眼白龙[1]" ] ] ``` 总共可能有 3x2 种不同组合: {00, 01, 10, 11, 20, 21} --- 参考 Wiki https://wiki.gear-tech.io/docs/examples/onchain-nft <p align="center"> <a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-on-chain-nft"> <img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR"> </a> </p> 代码仓库: - 传统 NFT 合约 https://github.com/gear-foundation/dapps-non-fungible-token - 纯链上 NFT 合约 https://github.com/gear-foundation/dapps-on-chain-nft --- ## build ``` $ make build ``` ## download ``` ./on_chain_nft.meta.txt ./target/wasm32-unknown-unknown/release/on_chain_nft.opt.wasm ./target/wasm32-unknown-unknown/release/onchain_nft_state.meta.wasm ``` ## deploy https://idea.gear-tech.io/?node=wss://testnet.vara.rs --- ## 课后作业 本期作业: 在 [Vara Stable Testnet](https://idea.gear-tech.io/?node=wss://testnet.vara.rs) 上部署 https://github.com/gear-foundation/dapps-on-chain-nft 合约,并与合约交互,创建多个图层,并 Mint 出所有可能的组合 --- # Questions <img src="https://hackmd.io/_uploads/SyK8P72d2.jpg" width="240" alt="GEAR"> <img src="https://hackmd.io/_uploads/By_kgE3_2.png" width="240" alt="VARA"> 课后答疑频道: https://t.me/Gear_CN
{"title":"Gear 合约开发案例解析 - On-Chain NFT","slideOptions":"{\"theme\":\"solarized\",\"spotlight\":{\"enabled\":false}}","showTags":"true","description":"代码仓库: https://github.com/gear-foundation/dapps-on-chain-nft","contributors":"[{\"id\":\"94262fbf-81ae-4ed7-933c-561a41bd977a\",\"add\":4340,\"del\":1223}]"}
    280 views