在测试环境下,使用阿里云服务器即可,硬件配置如下:CPU: 4core Intel(R) Xeon(R) Platinum 8163 CPU @ 2 50GHz
一、测试环境搭建
1. 硬件环境
2. 操作系统及依赖软件
3. 编译安装
4. 运行及数据同步
二、测试流程
1. 配置本地钱包
2. 从BCH测试网络获取bch测试币
3. 燃烧bch测试币获取whc测试币
4. 创建token
5. 转移单一token
6. 增发token
7. 燃烧token
8. 空投token
9. 转移所有token
10. 更改token发行者地址
11. 购买token(众筹)
12. 手动结束token众筹
测试环境搭建
1. 硬件环境
在测试环境下,使用阿里云服务器即可,硬件配置如下:
CPU: 4core Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHzMemory: 8GBDisk: 300GBNetwork: 100M
2. 操作系统及软件依赖本次测试是在linux环境下进行的操作系统版本: Ubuntu 16.04.4 LTSboost库使用系统自带的1.58.0即可libdb使用系统自带的4.8即可在本次测试时使用的Ubuntu 16.04.4 LTS系统版本下,编译和安装wormhole时不需要再安装第三方软件包,如果在编译阶段提示缺失的软件包,使用apt-get install安装即可。
3. 编译安装(1) 从
https://github.com/copernet/wormhole/releases获取源码包,下载到本地并解压
(2) 在源码目录下,执行autogen.sh(3) 执行configure(4) 执行make 和 make install在/usr/local/bin目录下将会有4个可执行程序,wormholed,wormholed-cli, wormholed-seeder,wormholed-tx
4. 运行及数据同步安装完成后,可以使用以下命令在BCH测试网络启动和停止wormhole启动:wormholed -testnet停止:wormholed-cli stop或者使用kill命令杀死wormholed进程
wormholed启动后,需要在BCH测试网络里进行区块同步,视客户端带宽和网络状况,可能需要一段时间才能同步完成,可以用一下命令通过查看日志文件的方式来检查是否同步完成,
tail -f /root/.bitcoin/testnet3/debug.log
测试流程:
使用wormholed提供的rpc命令来进行各个业务流程的测试,提供的rpc命令列表可以使用wormholed-cli help来获得。BCH网络的地址就是wormhole的地址,被同一把私钥控制,下面的测试流程中不再区分BCH地址和wormhole地址。需要在/root/.bitcoin目录下编辑bitcoin.conf文件,配置rpcuser=”user”,rpcpassword=”password”,rpcport=18332,配置完成后,需要重新启动wormhole
1. 配置本地钱包
使用命令在用户user1下创建一个新的钱包地址,命令成功执行后,将会显示新的地址
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli getnewaddress u1
bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5
也可以随时使用以上命令来获得u1的所有地址
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli getaddressesbyaccount u1
[
"bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5"
]
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli getnewaddress u2
bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli walletpassphrase “your password” 6000
2. 从BCH测试网络获取bch测试币
将BCH测试网络中获取到的测试币转入u1的地址
bchtest: qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5中,确保u1最少有2个测试bch可用于燃烧3. 燃烧bch测试币获取whc测试币
使用以下命令燃烧2个bch测试币,wormhole会在经过若干确认数后将对应的WHC发送到u1的地址,WHC在主网上的确认数为1000,在测试网络的确认数为3个,BCH:WHC的比例为1:100,WHC的最小单位为C,1Satoshi=100C,1WHC=100000000C(10的8次方),每次燃烧的BCH数量必须大于1,小于1个BCH的燃烧将不会获得对应的WHC
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_burnbchgetwhc 2
b3cd81009ae23252d5d5d583661f3f7f3ff00b48af48ffb0511e44e94022f37f
该命令成功执行后,将会返回本次交易的id,示例中返回的交易id为b3cd81009ae23252d5d5d583661f3f7f3ff00b48af48ffb0511e44e94022f37f,可以使用以下命令来查询此次燃烧交易的确认数
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction b3cd81009ae23252d5d5d583661f3f7f3ff00b48af48ffb0511e44e94022f37f
{
“txid”: “b3cd81009ae23252d5d5d583661f3f7f3ff00b48af48ffb0511e44e94022f37f”,
“fee”: “0.00000289″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bitcoincash:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqu08dsyxz98whc”,
“ismine”: true,
“version”: 0,
“type_int”: 68,
“type”: “Burn BCH Get WHC”,
“propertyid”: 1,
“divisible”: false,
“mature”: true,
“amount”: “20000000000″,
“valid”: true,
“blockhash”: “000000008ef93148a0e085c13a3e530688b2b46c27befb44bf7504b1c91a8165″,
“blocktime”: 1531820287,
“positioninblock”: 2,
“block”: 1247093,
“confirmations”: 140
}
4. 创建token
创建token需要收取1WHC作为手续费,相当于0.01BCH,该手续费会直接从用户的WHC账户中扣除并燃烧掉,先确认是否有足够的WHC来创建token
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 1
{
“balance”: “49700000000″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_listproperties
[
{
"propertyid": 1,
"name": "WHC",
"category": "N/A",
"subcategory": "N/A",
"data": "WHC serve as the binding between Bitcoin, smart properties and contracts created on the Omni Layer.",
"url": "http://www.wormhole.cash",
"divisible": false
}
]
使用以上命令可以获取
bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5地址上的WHC数量;地址后的1代表要查询的是WHC(WHC的资产id为1, wormholed-cli whc_listproperties可以列出所有的资产信息)
确认有足够的WHC后,就可以创建token了,有3种类型的token可以创建,更详细的token种类信息可以参看wormhole白皮书,这里创建managed类型的token,使用以下命令:
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendissuancemanaged bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 1 1 0 “test” “u1 test” “test_token1″ “www.test_token1.com” “my data”
792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067
{
“txid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fee”: “0.00000320″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“ismine”: true,
“version”: 0,
“type_int”: 54,
“type”: “Create Property – Manual”,
“propertytype”: “indivisible”,
“ecosystem”: “main”,
“category”: “test”,
“subcategory”: “u1 test”,
“propertyname”: “test_token1″,
“data”: “my data”,
“url”: “www.test_token1.com”,
“amount”: “0″,
“confirmations”: 0
}
当创建该token的交易792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067被确认后,token将会被创建出来,同时地址bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5上将会被扣除1个WHC,可以查询到如下结果
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067
{
“txid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fee”: “0.00000320″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“ismine”: true,
“version”: 0,
“type_int”: 54,
“type”: “Create Property – Manual”,
“propertyid”: 12,
“divisible”: false,
“propertytype”: “indivisible”,
“ecosystem”: “main”,
“category”: “test”,
“subcategory”: “u1 test”,
“propertyname”: “test_token1″,
“data”: “my data”,
“url”: “www.test_token1.com”,
“amount”: “0″,
“valid”: true,
“blockhash”: “00000000000004a9f9953b15a2d5939b459a9b6fbdcedcbff4019f8a183c1524″,
“blocktime”: 1531896682,
“positioninblock”: 4,
“block”: 1247257,
“confirmations”: 1
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 1
{
”balance”: “49600000000″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “0″
}
创建Fixed类型的token
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendissuancefixed qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 1 1 0 “test” “test2″ “fixed-token” “fixed-token” “mydata” 100000000
bf8a2e94eba3ee0c42f14fb2e3a91d2b42e0f11222db9ba7804054b614f3ea16
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction bf8a2e94eba3ee0c42f14fb2e3a91d2b42e0f11222db9ba7804054b614f3ea16
{
“txid”: “bf8a2e94eba3ee0c42f14fb2e3a91d2b42e0f11222db9ba7804054b614f3ea16″,
“fee”: “0.00000317″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“ismine”: true,
“version”: 0,
“type_int”: 50,
“type”: “Create Property – Fixed”,
“propertyid”: 13,
“divisible”: false,
“ecosystem”: “main”,
“propertytype”: “indivisible”,
“category”: “test”,
“subcategory”: “test2″,
“propertyname”: “fixed-token”,
“data”: “mydata”,
“url”: “fixed-token”,
“amount”: “100000000″,
“valid”: true,
“blockhash”: “00000000000521f500f8e9726e8c5ab680e08ab273194f37b6b16ce4f640edcd”,
“blocktime”: 1531897899,
“positioninblock”: 5,
“block”: 1247258,
“confirmations”: 1
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 13
{
“propertyid”: 13,
“name”: “fixed-token”,
“category”: “test”,
“subcategory”: “test2″,
“data”: “mydata”,
“url”: “fixed-token”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “bf8a2e94eba3ee0c42f14fb2e3a91d2b42e0f11222db9ba7804054b614f3ea16″,
“fixedissuance”: true,
“managedissuance”: false,
“totaltokens”: “100000000″
}
现在我们可以看到在u1的地址bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5
发行了两种token,一种是managed类型,一种是fixed,token数量如下:
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 13
{
“propertyid”: 13,
“name”: “fixed-token”,
“category”: “test”,
“subcategory”: “test2″,
“data”: “mydata”,
“url”: “fixed-token”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “bf8a2e94eba3ee0c42f14fb2e3a91d2b42e0f11222db9ba7804054b614f3ea16″,
“fixedissuance”: true,
“managedissuance”: false,
“totaltokens”: “100000000″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12
{
“balance”: “0″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 13
{
“balance”: “100000000″,
“reserved”: “0″
}
5. 转移单一token
我们将token id为13的token转账10000000个到u2的地址
bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac上,使用如下命令
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_send bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 13 10000000
2c7183d31c4d19cf8d9fad8be372b396d8e95951653243a6889358115f181b68
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 2c7183d31c4d19cf8d9fad8be372b396d8e95951653243a6889358115f181b68
{
“txid”: “2c7183d31c4d19cf8d9fad8be372b396d8e95951653243a6889358115f181b68″,
“fee”: “0.00000304″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac”,
“ismine”: true,
“version”: 0,
“type_int”: 0,
“type”: “Simple Send”,
“propertyid”: 13,
“divisible”: false,
“amount”: “10000000″,
“confirmations”: 0
}
单一token转账在wormhole中并不收取手续费,只需要支付BCH网络矿工费即可,经过网络确认后到账,如下图所示
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 2c7183d31c4d19cf8d9fad8be372b396d8e95951653243a6889358115f181b68
{
“txid”: “2c7183d31c4d19cf8d9fad8be372b396d8e95951653243a6889358115f181b68″,
“fee”: “0.00000304″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac”,
“ismine”: true,
“version”: 0,
“type_int”: 0,
“type”: “Simple Send”,
“propertyid”: 13,
“divisible”: false,
“amount”: “10000000″,
“valid”: true,
“blockhash”: “000000000000038671ea5faa784a56aafb8dbdb24072ca5c2aad1e775512fbcf”,
“blocktime”: 1531900115,
“positioninblock”: 2,
“block”: 1247264,
“confirmations”: 1
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 13
{
“balance”: “90000000″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 13
{
“balance”: “10000000″,
“reserved”: “0″
}
6. 增发token
只有managed类型的token才可以进行增发,并且只能由token发行人进行增发,别人无权限增发,在上面的测试中,我们创建了id为12的token,其类型为managed,我们增发10000个给u2,增发前id 12的token,u1和u2余额如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12
{
“balance”: “0″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 12
{
“balance”: “0″,
“reserved”: “0″
}
增发命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendgrant bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 12 10000 “pay bill”
ef2d8d124a82abd41d10916155cec325a8510d565a9e14a7a0c37f0fe1a5fced
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction ef2d8d124a82abd41d10916155cec325a8510d565a9e14a7a0c37f0fe1a5fced
{
“txid”: “ef2d8d124a82abd41d10916155cec325a8510d565a9e14a7a0c37f0fe1a5fced”,
“fee”: “0.00000314″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac”,
“ismine”: true,
“version”: 0,
“type_int”: 55,
“type”: “Grant Property Tokens”,
“propertyid”: 12,
“divisible”: false,
“amount”: “10000″,
“confirmations”: 0
}
网络确认后,id 12的token,u1和u2余额如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “10000″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12
{
“balance”: “0″,
“reserved”: “0″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 12
{
“balance”: “10000″,
“reserved”: “0″
}
7. 燃烧token
只有managed类型的token才可以进行燃烧,并且只能由token发行人进行燃烧,别人无权限燃烧,燃烧前id 12的token,u1地址余额如下:
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “10000″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12
{
“balance”: “5000″,
“reserved”: “0″
}
现在我们燃烧3000个,燃烧后u1将剩余2000个token,并且token总量将减少3000个,燃烧命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendrevoke bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12 3000
d5966fd7568b29b19ba5400d94e4fa8adbc91040fd0261f1209db163518a0327
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction d5966fd7568b29b19ba5400d94e4fa8adbc91040fd0261f1209db163518a0327
{
“txid”: “d5966fd7568b29b19ba5400d94e4fa8adbc91040fd0261f1209db163518a0327″,
“fee”: “0.00000265″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“ismine”: true,
“version”: 0,
“type_int”: 56,
“type”: “Revoke Property Tokens”,
“propertyid”: 12,
“divisible”: false,
“amount”: “3000″,
“confirmations”: 0
}
燃烧命令经过网络确认后,token总量和u1地址余额如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getproperty 12
{
“propertyid”: 12,
“name”: “test_token1″,
“category”: “test”,
“subcategory”: “u1 test”,
“data”: “my data”,
“url”: “www.test_token1.com”,
“divisible”: false,
“issuer”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“creationtxid”: “792191b113bc239efc8da014441e68f2f79576d8efeb0e855dfaa5e3ef51c067″,
“fixedissuance”: false,
“managedissuance”: true,
“freezingenabled”: false,
“totaltokens”: “7000″
}
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getbalance bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12
{
“balance”: “2000″,
“reserved”: “0″
}
除发行者之外的地址进行燃烧操作时,将会返回错误如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendrevoke bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 12 3000
error code: -3
error message:
Sender is not authorized to manage the property
8. 空投token
任何人都可以发起一定数量token的空投,除空投者自己的地址外,任何拥有此token的地址按照持有的token比例都会收到一定数量的空投token,但空投会收取一定的whc作为手续费,手续费=接受地址数x1C;例如对100000000人进行空投,则手续费为100000000x1C=1WHC,若发起空投者账户里没有足够的WHC缴纳手续费,则空投失败,空投成功后收取的空投手续费在系统里将会立即被燃烧掉。
bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5使用id为12的token向所有持有该token的地址空投500个token时使用的命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendsto bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 12 500
403ec9b6f8b142485ea514d52bc4c782f008021a261f637028a28e1a64681d1b
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 403ec9b6f8b142485ea514d52bc4c782f008021a261f637028a28e1a64681d1b
{
“txid”: “403ec9b6f8b142485ea514d52bc4c782f008021a261f637028a28e1a64681d1b”,
“fee”: “0.00000268″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“ismine”: true,
“version”: 0,
“type_int”: 3,
“type”: “Send To Owners”,
“propertyid”: 12,
“divisible”: false,
“amount”: “500″,
“confirmations”: 0
}
9. 转移所有token
该命令将会把此地址下的所有类型token都转移到另一个地址上去,将地址bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5上的所有token都转移到地址bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac所使用的命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendall bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 1
8f4a11bb724139a43494b08da35beac1a53c34aec13eab22d188540f5cc0c164
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction 8f4a11bb724139a43494b08da35beac1a53c34aec13eab22d188540f5cc0c164
{
“txid”: “8f4a11bb724139a43494b08da35beac1a53c34aec13eab22d188540f5cc0c164″,
“fee”: “0.00000291″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac”,
“ismine”: true,
“version”: 0,
“type_int”: 4,
“type”: “Send All”,
“ecosystem”: “main”,
“confirmations”: 0
}
10. 更改token发行者地址
创建token后,token发行着可以调用次命令来改变发行者地址,将token id 12的token发行者地址由bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5
更改为bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac的命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendchangeissuer bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac 12
ce6877f4da9e627741cf087aa777917f5ecf5fb8ff47037b211140b68155d9eb
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_gettransaction ce6877f4da9e627741cf087aa777917f5ecf5fb8ff47037b211140b68155d9eb
{
“txid”: “ce6877f4da9e627741cf087aa777917f5ecf5fb8ff47037b211140b68155d9eb”,
“fee”: “0.00000294″,
“sendingaddress”: “bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5″,
“referenceaddress”: “bchtest:qzmeeak3j6vka2v0s7pyt5xvp73u6clsz54e9su3ac”,
“ismine”: true,
“version”: 0,
“type_int”: 70,
“type”: “Change Issuer Address”,
“propertyid”: 12,
“divisible”: false,
“confirmations”: 0
}
11. 购买token(众筹)
创建时类型为Variablel的token才可以进行众筹,且只能进行1次众筹,众筹方式为购买者向该token的发行者地址上使用WHC进行转账,系统会根据该token创建时设定的WHC与token的定价计算购买者应该获得的token,并立即发送到购买者地址上。
查询众筹
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_getcrowdsale 5
{
“propertyid”: 5,
“name”: “omnicash”,
“active”: true,
“issuer”: “bchtest:qq0ae7jqqvr87gex4yk3ukppvnm0w7ftqqpzv0lcqa”,
“propertyiddesired”: 1,
“tokensperunit”: “10000000000″,
“earlybonus”: 10,
“percenttoissuer”: 10,
“starttime”: 1531540512,
“deadline”: 1532448000,
“amountraised”: “0″,
“tokensissued”: “0″,
“addedissuertokens”: “0″
}
购买众筹
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_send bchtest:qz04wg2jj75x34tge2v8w0l6r0repfcvcygv3t7sg5 bchtest:qq0ae7jqqvr87gex4yk3ukppvnm0w7ftqqpzv0lcqa 5 100000000
以上命令中
bchtest:qq0ae7jqqvr87gex4yk3ukppvnm0w7ftqqpzv0lcqa为众筹地址,5是token id,100000000表示要购买1WHC的token
12. 手动结束token众筹
可以使用此命令在该token的众筹期内强行关闭众筹,众筹关闭后,购买者就不能再通过众筹方式购买该token了,token发行方也不能再重新开启该众筹或另1个众筹了,未众筹完的token将会自动转账到发行者地址上。只有该众筹token的发行者才可以关闭众筹,命令如下
root@iZhp3it3hc5z8ckevj0ytvZ:~# wormholed-cli whc_sendclosecrowdsale bchtest:qq0ae7jqqvr87gex4yk3ukppvnm0w7ftqqpzv0lcqa 5
以上命令中
bchtest:qq0ae7jqqvr87gex4yk3ukppvnm0w7ftqqpzv0lcqa为该众筹token的发行者地址,5为token id
【相关阅读】Wormhole: 一种基于Bitcoin Cash的智能合约实现方案
关键词: 手册测试Wormhole