1分钟教会你创建自己的 Chia Asset Tokens

1分钟教会你创建自己的 Chia Asset Tokens ,第1张

1.背景知识:

Chia 资产代币 (CAT) 是从 XCH 发行的可替代代币。 CAT1 标准是第一个(也是迄今为止唯一的)CAT 标准。它于 2022 年 1 月完成。

CAT 具有被“标记”的特性,使其无法作为常规 XCH 使用。但是,通常可以将 CAT 重新“融化”回 XCH。 CAT 通常用作信用或代币。

每个 CAT 都有自己独特的发行规则,这是不同类型 CAT 之间的唯一区别。这些发行规则采用遵循特定结构的任意 Chialisp 程序的形式。我们将该程序称为代币和资产发行限制 (TAIL)。

2.创建教程(适合有编程基础的同学)

1)第一步确认 python3 版本,确保您安装了 3.7 和 3.9 之间的 Python 版本。

2)安装chia-blockchian

git clone https://github.com/Chia-Network/chia-blockchain.git -b main --recurse-submodules

cd chia-blockchain

sh install.sh

. ./activate

chia init

chia start node
chia start wallet

3)安装CAT admin tool

sudo apt-get install -y build-essential python3-dev
git clone https://github.com/Chia-Network/CAT-admin-tool.git -b main --recurse-submodules
cd CAT-admin-tool
python3 -m venv venv
. ./venv/bin/activate
pip install .
pip install chia-dev-tools --no-deps
pip install pytest

3.1) 确认安装:cats --help

cats --help
Usage: cats [OPTIONS]

Options:
  -l, --tail TEXT            The TAIL program to launch this CAT with
                             [required]

  -c, --curry TEXT           An argument to curry into the TAIL
  -s, --solution TEXT        The solution to the TAIL program  [default: ();
                             required]

  -t, --send-to TEXT         The address these CATs will appear at once they
                             are issued  [required]

  -a, --amount INTEGER       The amount to issue in mojos (regular XCH will be
                             used to fund this)  [required]

  -m, --fee INTEGER          The XCH fee to use for this issuance  [default:
                             0; required]

  -f, --fingerprint INTEGER  The wallet fingerprint to use as funds
  -sig, --signature TEXT     A signature to aggregate with the transaction
  -as, --spend TEXT          An additional spend to aggregate with the
                             transaction

  -b, --as-bytes             Output the spend bundle as a sequence of bytes
                             instead of JSON

  -sc, --select-coin         Stop the process once a coin from the wallet has
                             been selected and return the coin

  --help                     Show this message and exit.

cdv --help:

 cdv --help
Usage: cdv [OPTIONS] COMMAND [ARGS]...

  Dev tooling for Chia development

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  clsp     Commands to use when developing with chialisp
  decode   Decode a bech32m address to a puzzle hash
  encode   Encode a puzzle hash to a bech32m address
  hash     SHA256 hash UTF-8 strings or bytes (use 0x prefix for bytes)
  inspect  Inspect various data structures
  rpc      Make RPC requests to a Chia full node
  test     Run the local test suite (located in ./tests)

如果执行命令如上图显示,表示安装成功了!

4)确保钱包里有足够的xch(如果没有xch到 catsfounder 的 XCH Faucet 获取一些),准备工作完成,下面我们开始铸币

5)single-mint CAT(这是一种一次性铸造的货币,比如现在我铸造的数量是100,以后我想扩展数量到1万是不行的)

直接上代码:

cats --tail /root/CAT-admin-tool/reference_tails/genesis_by_coin_id.clsp.hex --send-to xch1n9a6juhyzhdfqrerl88qr7q5paxapfaeuptfug43xytf9ke3pcdsxqz5mq --amount 10000 -m 1000 --as-bytes --select-coin -f 345372340

--coin id:
--0676c170b12efc1e3bf05a0cd44318d9cf93dd11f93f2d762f40d868ac51b395

cats --tail /root/CAT-admin-tool/reference_tails/genesis_by_coin_id.clsp.hex --send-to xch1n9a6juhyzhdfqrerl88qr7q5paxapfaeuptfug43xytf9ke3pcdsxqz5mq --amount 10000 -m 1000 --as-bytes -f 345372340 --curry 0x0676c170b12efc1e3bf05a0cd44318d9cf93dd11f93f2d762f40d868ac51b395

--d出是否发布到full node 输入(注意前提是full node 是synced状态): yes

--Asset ID: 6661d443c742055835e055c3ddd9c4f516086f261005fcd98a32711ef5e4c6b5

各参数解释及注意事项:

你接收新货币的地址:--send-to xch1n9a6juhyzhdfqrerl88qr7q5paxapfaeuptfug43xytf9ke3pcdsxqz5mq

铸造的数量(单位mojos):--amount 10000

手续费用(单位mojos): -m 1000

你钱包的指纹 : -f  345372340

coin id:执行完cats --tail 后的结果,后面的语句要带上这个coinid

注意 --curry 后面的coinid要加上 "0x"

 0x0676c170b12efc1e3bf05a0cd44318d9cf93dd11f93f2d762f40d868ac51b395

最终我们要的就是Assert ID

Assert ID:6661d443c742055835e055c3ddd9c4f516086f261005fcd98a32711ef5e4c6b5

6) 在钱包里面添加我们刚刚的新币

3.开放的在线工具(适合小白用户)

3.1 CATs Founder

如果我想创建自己的Chia Assert Token,但没有任何编程基础,我该如何创建它?不用担心,CATs Founder 已经开启了CAT发行功能,用户可以轻松在线创建Chia资产代币(CAT)。

 填写接收地址,发行数量,币种名称

 发行成功后可以看到Assert ID 

3.2 把Assert ID添加到钱包(同之前chia钱包添加新币的 *** 作 这里省略)

3.3 linux环境下添加Assert ID

 chia wallet add_token -id 6661d443c742055835e055c3ddd9c4f516086f261005fcd98a32711ef5e4c6b5 -n CFD -f 345372340

参数介绍

Usage: chia wallet add_token [OPTIONS]

Options:
  -wp, --wallet-rpc-port INTEGER  Set the port where the Wallet is hosting the
                                  RPC interface. See the rpc_port under wallet
                                  in config.yaml

  -id, --asset-id TEXT            The Asset ID of the coin you wish to
                                  add/rename (the treehash of the TAIL
                                  program)  [required]

  -n, --token-name TEXT           The name you wish to designate to the token
  -f, --fingerprint INTEGER       The wallet fingerprint you wish to add the
                                  token to

  -h, --help                      Show this message and exit.

最后我们执行 chia wallet show 查看一下新币是否到账

chia wallet show

Wallet height: 1834731
Sync status: Synced
Balances, fingerprint: 345372340
Wallet ID 1 type STANDARD_WALLET Chia Wallet
   -Total Balance: 3.173013e-05 xch (31730130 mojo)
   -Pending Total Balance: 3.173013e-05 xch (31730130 mojo)
   -Spendable: 3.173013e-05 xch (31730130 mojo)
Wallet ID 2 type CAT CFD
   -Total Balance: 1000000.0  (1000000000 mojo)
   -Pending Total Balance: 1000000.0  (1000000000 mojo)
   -Spendable: 1000000.0  (1000000000 mojo)

可以看到 Wallet ID 2 type CAT CFD 就是我们新铸造的代币了

注意事项:

1) 发行之前一定要确保钱包里面有足够的余额mojos

2) 小编亲自试过目前是不需要发行费用的,但以后不保证平台是否会收费

3) 如果这篇文章帮助到你,请给小编点赞吧~

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/925325.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存