## Gear 开发案例解析 - Inscription (上) 本 PPT 链接: https://hackmd.io/@btwiuse/insc --- 什么是 Inscription (铭文)? 在链上写入结构化数据,常用于在不支持智能合约的区块链上模拟同质化/非同质化代币, - KSM: RMRK 1.0 & 2.0 - BTC: Ordinals 以太坊铭文,狗狗币铭文、BNB铭文、SOL铭文、TON铭文、DOT铭文 --- 一些常见的铭文协议 - BRC-20 协议 - https://domo-2.gitbook.io/brc-20-experiment/ - RMRK 协议 - https://docs.rmrk.app/rmrk1 - https://docs.rmrk.app/rmrk2 - DOT Ordinals 协议 - https://niklabh.github.io/dotordinals/ - https://hackmd.io/@laboon/B15zi4GEp --- Deploy brc-20 https://domo-2.gitbook.io/brc-20-experiment/#deploy-brc-20 ``` { "p": "brc-20", // Protocol: Helps other systems identify and process brc-20 events "op": "deploy", // Operation: Type of event (Deploy, Mint, Transfer) "tick": "ordi", // Ticker: 4 letter identifier of the brc-20 "max": "21000000", // Max supply: set max supply of the brc-20 "lim": "1000" // * Mint limit: If letting users mint to themsleves, limit per ordinal "dec": 18 // * Decimals: set decimal precision, default to 18 } ``` --- Mint brc-20 https://domo-2.gitbook.io/brc-20-experiment/#mint-brc-20 ``` { "p": "brc-20", // Protocol: Helps other systems identify and process brc-20 events "op": "mint", // Operation: Type of event (Deploy, Mint, Transfer) "tick": "ordi", // Ticker: 4 letter identifier of the brc-20 "amt": "1000" // Amount to mint: States the amount of the brc-20 to mint. Has to be less than "lim" above if stated } ``` --- Transfer brc-20 https://domo-2.gitbook.io/brc-20-experiment/#transfer-brc-20 ``` { "p": "brc-20", // Protocol: Helps other systems identify and process brc-20 events "op": "transfer", // Operation: Type of event (Deploy, Mint, Transfer) "tick": "ordi", // Ticker: 4 letter identifier of the brc-20 "amt": "100" // Amount to transfer: States the amount of the brc-20 to transfer. } ``` --- RMRK 1.0 (deprecated) 部署 + 铸造 ``` ALICE::Init::Apple::5 ``` 发送 ``` ALICE::Send::Apple::3::Bob ``` --- 如何在 Gear 上刻铭文? Vara Network 基于 Substrate 构建 因此可以使用通用的 [system.remarkWithEvent](https://polkadot.js.org/docs/substrate/extrinsics/#remarkwitheventremark-bytes) 创造自定义协议:`INSC` --- INSC::部署 ``` let tx = api.tx.system.remarkWithEvent("INSC::DEPLOY MEME 50000 10"); await tx.signAndSend(ALICE); ``` --- INSC::铸造 ``` let tx = api.tx.system.remarkWithEvent("INSC::MINT MEME 5"); await tx.signAndSend(ALICE); ``` --- INSC::发送 ``` let tx = api.tx.system.remarkWithEvent("INSC::SEND MEME 5 BOB"); await tx.signAndSend(ALICE); ``` --- 无样式前端模板 <p align="center"> <a href="https://gitpod.io/#https://github.com/btwiuse/vara-inscription"> <img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR"> </a> </p> 预览:https://vara-inscription.vercel.app 试将上面的代码添加到模板中,增加部署、铸造、发送按钮 --- # 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 开发案例解析 - Inscription (上)","description":"INSC::INIT LIME 50000 10INSC::MINT LIME 5","contributors":"[{\"id\":\"94262fbf-81ae-4ed7-933c-561a41bd977a\",\"add\":5661,\"del\":2601}]"}
    462 views