铂链第3课 BOTTOS账户体系(密钥对/账号/钱包)的创建和管理

版权声明:如需转载,请私信联系作者。 https://blog.csdn.net/wangdenghui2005/article/details/87896694

1, 摘要

通过前一课《铂链第2课 如何部署节点并加入BOTTOS测试网络?》的学习,同学们知道了如何搭建BOTTOS本地节点环境。
本课继续讲解BOTTOS账户体系中的密钥对/账号/钱包,以便完成智能合约部署前的所有准备工作。
本文包含内容:
(1) 创建并查看系统账户
(2)创建并查看用户钥匙对,账户,钱包
(3)给用户账户获取并质押BTO

2,内容

2.1 前置条件

####(1)启动本地节点
本文假设你已经按照《铂链第2课 如何部署节点并加入BOTTOS测试网络?》完成了本地开发环境的部署。
如果重启电脑后,需要重启下本地节点。
在命令框输入启动本地节点。

./bottos --delegate=bottos --enable-wallet

启动成功的标识要有以下输出:

duncanwang@ubuntu64bit-server:~/go/src/github.com$ cd bottos
duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bottos --delegate bottos --enable-wallet
InsertBlock, number:1, time:2019-01-05 05:06:06, delegate:bottos, trxn:0, hash:c5ab0b995b95624021aa9bc9767038345a78d194e9e0543ea93d71ca92ac81b1, prevHash:caf2bae84f70412354211dd5028142eca6901b06b9a65dfbe9df065bcf56e291, version:1.0.0
InsertBlock, number:2, time:2019-01-05 05:06:09, delegate:bottos, trxn:0, hash:115167cfa97bd3d0eb494ef84ba90cc3f1ed5829a2fb14989415f5d9f5853593, prevHash:c5ab0b995b95624021aa9bc9767038345a78d194e9e0543ea93d71ca92ac81b1, version:1.0.0
InsertBlock, number:3, time:2019-01-05 05:0

【进程小知识】
辉哥此处提供一种方法用于查看和判断铂链本地节点有无运行的方法。
linux把ps的查询结果通过管道给grep查找包含特定字符串的进程。管道符“|”用来隔开两个命令,管道符左边命令的输出会作为管道符右边命令的输入。如果铂链节点启动异常,要杀死进程可以使用kill命令。
$kill -s 2 1576
【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ps -ef|grep bottos
duncanw+  1594  1576  1 07:13 pts/0    00:00:56 ./bottos --delegate=bottos --enable-wallet
duncanw+  2253  1776  0 08:34 pts/2    00:00:00 grep bottos

####(2)复制bcli程序到BIN目录
用cp命令复制bcli程序到BIN目录,可以避免每个工作目录都需要复制的麻烦。
【命令执行结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ sudo  cp ~/go/src/github.com/bottos/bcli  /usr/bin/.
[sudo] password for duncanwang: 

2.2 创建并查看系统账户

在创建用户账户前,要先创建BOTTOS系统账户。
新建一个命令窗口,进入铂链工作目录,例如~/go/src/github.com/bottos,
查看 config.toml文件的PrivateKey 和PublicKey信息。

PrivateKey = "b799ef616830cd7b8599ae7958fbee56d4c8168ffd5421a16025a398b8a4be45"
PublicKey = "0454f1c2223d553aa6ee53ea1ccea8b7bf78b8ca99f3ff622a3bb3e62dedc712089033d6091d77296547bc071022ca2838c9e86dec29667cf740e5c9e654b6127f"

再执行 ./bcli wallet create --account bottos 创建铂链账户,先输入2次包含一个大小字母和一个小写字母和一个数字,长度在6-20个字节的密码然后输入config.toml的PrivateKey,即"b799ef616830cd7b8599ae7958fbee56d4c8168ffd5421a16025a398b8a4be45"。

./bcli wallet create --account bottos

【成功结果】

扫描二维码关注公众号,回复: 5451156 查看本文章
duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet create --account bottos

Please input your password for your wallet: 


Please input your password again for your wallet: 

Input error. Password is not consistant from your input.
duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet create --account bottos

Please input your password for your wallet: 


Please input your password again for your wallet: 


Please input your private key for your wallet: 

{
    "wallet_name": "bottos.keystore"
}

Create wallet done. Now unlock the wallet within 300 seconds.
{
    "unlock": true
}

查看系统钱包

./bcli wallet list显示系统所有的账号和钱包文件路径。

【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet list
[
    {
        "account_name": "bottos",
        "wallet_path": "/home/duncanwang/bot/bottos.keystore"
    }
]

查看账号

./bcli account get --account bottos该命令成功后将返回用户所持有的BTO及质押和解质押信息。

【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account get --account bottos
^[[3~
    Account: bottos
    Balance: 936000000.00000000 BTO
    Pubkey: 0454f1c2223d553aa6ee53ea1ccea8b7bf78b8ca99f3ff622a3bb3e62dedc712089033d6091d77296547bc071022ca2838c9e86dec29667cf740e5c9e654b6127f

    StakedBalance: 0.00000000 BTO
    UnStakingBalance: 0.00000000 BTO
    StakedSpaceBalance: 0.00000000 BTO
    StakedTimeBalance: 0.00000000 BTO
    UnStakingTimestamp: 0

    AvailableSpaceBalance: 0
    UsedSpaceBalance: 0
    AvailableTimeBalance: 0
    UsedTimeBalance: 0

    UnClaimedReward: 0.00000000 BTO

    Vote: N/A

    Contracts: N/

常见失败场景及解决方法

(1) 失败结果1-输入密码不符合要求

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet create --account bottos

Please input your password for your wallet: 


Please input your password again for your wallet: 

Input error! Your password must meet following rules.
1. Must contains at least one uppercase character and at least one lowercase and at least one numeric character in your password.
2. Password length must be within 6-20.

【解决方案】
密码必须是包含一个大小字母和一个小写字母和一个数字,长度在6-20个字节,否则会报错。

(2) 失败结果2-账户已创建

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet create --account bottos

Please input your password for your wallet: 


Please input your password again for your wallet: 


Please input your private key for your wallet: 


Create wallet fail: Account already exists

【分析及解决方案】
这个账号是之前创建的,重建账号需要把原bottos系统账号删除。

把当前账户根目录的/bot的账户文件删除。见图例描述。

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ rm -rf ~/bot/*.*

2.3 创建并查看用户钥匙对/账户/钱包

####(1)【创建公私钥密钥对】

./bcli wallet generatekey用于创建一对新生成的公私钥对。

【创建成功结果】

duncanwang@ubuntu64bit-server:~/go/work/contract-tool-cpp/testHelloWorld$ ./bcli wallet generatekey
public_key: 049b98b5f5eea7fd5145842d08f8cd25052f69e731f9f550ac8a2e37792e165cf13fbc52ad7dad32eaa192799601b4cc35eab1923e007048f9d47c80aa4bf9cb8d
private_key: 1d2533b83d5c811b53b7503aad9488310631b705e9df12bbce8c03149be559fd
常见失败提示
duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet generatekey
public_key: 04307dbb6b301f90d25bc5561af354605e1a6b851ec81ae21c0260b8e26d2623702fb69edd0fa4cc0aa9b8a245aba9d0570ff08df0e72ca55845750270939f9634
private_key: 3cc3b2c01b388c160df073e84c4aabdaf0905ab7e48f8464eb75b9726626682f
duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account create --account wangdenghui --pubkey 04307dbb6b301f90d25bc5561af354605e1a6b851ec81ae21c0260b8e26d2623702fb69edd0fa4cc0aa9b8a245aba9d0570ff08df0e72ca55845750270939f9634

Your wallet of account [bottos] is locked. Please unlock it first.

【分析及解决方法】
BOTTOS默认300秒就lock了。
目前钱包有一个机制,解锁一个钱包,前一个被解锁的账号钱包就会自动锁定了。用下面命令把系统账号解锁。

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet unlock --account bottos

Please input your password for your wallet: 

{
    "unlock": true
}

(2)创建用户账户

1)用公钥创建account

./bcli account create - create account

用于创建新的用户账户,成功讲返回BCLI发送的Transaction信息。

参数说明:
–account 创建的用户名
–pubkey 新建用户的公钥,不填则使用内置缺省pubkey
–referrer 引荐人,不填则使用缺省内置账户进行签名,否则使用引荐人做签名

【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account create --account wangdenghui --pubkey 049b98b5f5eea7fd5145842d08f8cd25052f69e731f9f550ac8a2e37792e165cf13fbc52ad7dad32eaa192799601b4cc35eab1923e007048f9d47c80aa4bf9cb8d

TrxHash: 362500bf1cd37622983d135d93cb478e4cfb425ea757e4988bbd1bdd0cf69da6

This transaction is sent. Please check its result by command : bcli transaction get --trxhash  <hash>

Please create wallet for your new account.
2)查看账户创建是否成功

./bcli transaction get

该命令成功后将返回指定Trxhash对应的Transaction信息。
参数说明:
–trxhash Transaction hash索引值

【成功结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ bcli transaction get --trxhash  362500bf1cd37622983d135d93cb478e4cfb425ea757e4988bbd1bdd0cf69da6
{
    "ResourceReceipt": null,
    "Transaction": {
        "contract": "bottos",
        "cursor_label": 671186852,
        "cursor_num": 3076,
        "lifetime": 1546674406,
        "method": "newaccount",
        "param": {
            "name": "wangdenghui",
            "pubkey": "04307dbb6b301f90d25bc5561af354605e1a6b851ec81ae21c0260b8e26d2623702fb69edd0fa4cc0aa9b8a245aba9d0570ff08df0e72ca55845750270939f9634"
        },
        "sender": "bottos",
        "sig_alg": 1,
        "signature": "66b50e786ee161baac21469c166b02187fbf7bd51000f812ffbedde257570ab7010e1ae8225098fa74d354c2915dd64981b21dcca180cbf4b88f938281611303",
        "version": 65536
    },
    "TrxHash": "362500bf1cd37622983d135d93cb478e4cfb425ea757e4988bbd1bdd0cf69da6"
}

<<<Transaction Status>>> : commited

【分析】可以看出,用bottos账号创建了"wangdenghui"的账户。

3)为用户账户创建新钱包

./bcli wallet create --account

该命令用户创建钱包。该命令成功后将返回用户的钱包文件keystore信息,路径位于/home/bottos/bot下, 文件格式为 用户.keystore 文件。

本案例中, 为用户账户“wangdenghui”创建钱包,钱包使用上一个步骤创建的私钥 “1d2533b83d5c811b53b7503aad9488310631b705e9df12bbce8c03149be559fd”,密码需要包含一个大小字母和一个小写字母和一个数字,长度在6-20个字节。命令样例:./bcli wallet create --account wangdenghui

【辉哥理解】
在BOTTOS账户体系中,账号和钱包是唯一绑定关系的,必须同时存在。
就如中国改革开放早期实行计划生育,每个家庭只能生一个小孩,这密钥对就是小孩的准生证,拿到这个准生证就可以有一个小孩账户(户口),这个家庭组织服务就是小孩的生活来源,就是其唯一的钱包。

【成功结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet create --account wangdenghui

Please input your password for your wallet: 


Please input your password again for your wallet: 


Please input your private key for your wallet: 

{
    "wallet_name": "wangdenghui.keystore"
}

Create wallet done. Now unlock the wallet within 300 seconds.
{
    "unlock": true
}
4)【查看系统钱包列表】

./bcli wallet list

可以看到,系统有2个账号和2个钱包文件了。

【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli wallet list
[
    {
        "account_name": "bottos",
        "wallet_path": "/home/duncanwang/bot/bottos.keystore"
    },
    {
        "account_name": "wangdenghui",
        "wallet_path": "/home/duncanwang/bot/wangdenghui.keystore"
    }
]
5)【查看用户账号信息】

./bcli account get --account wangdenghui

【执行结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account get --account wangdenghui

    Account: wangdenghui
    Balance: 0.00000000 BTO
    Pubkey: 04307dbb6b301f90d25bc5561af354605e1a6b851ec81ae21c0260b8e26d2623702fb69edd0fa4cc0aa9b8a245aba9d0570ff08df0e72ca55845750270939f9634

    StakedBalance: 0.00000000 BTO
    UnStakingBalance: 0.00000000 BTO
    StakedSpaceBalance: 0.00000000 BTO
    StakedTimeBalance: 0.00000000 BTO
    UnStakingTimestamp: 0

    AvailableSpaceBalance: 0
    UsedSpaceBalance: 0
    AvailableTimeBalance: 0
    UsedTimeBalance: 0

    UnClaimedReward: 0.00000000 BTO

    Vote: N/A

    Contracts: N/A
常见问题1:账户查询不到

现象:

duncanwang@ubuntu64bit-server:~/go/work/contract-tool-cpp/testHelloWorld$ ./bcli account get --account wangdenghui
Error: get_or_post: POST , resp: <nil> ,err:  Post http://127.0.0.1:8689/v1/account/info: dial tcp 127.0.0.1:8689: connect: connection refused
Error. httpRspBody:  [] , err:  Error: send http failed

【问题分析】
因为节点已经关闭了。重启本地节点即可。

2.4 给用户账户获取并质押BTO

铂链的生态体系就如同市场经济,消耗资源的操作都需要质押BTO。

####(1)系统账户bottos转账给用户账户wangdenghui

./bcli transfer

用户用于从源账号from给目标账号to进行BTO转账,需要保证源账号处于unlock状态,有足够的余额。
参数说明:
–from 转账者
–to 转账目的人
–amount 转账BTO个数

样例为从系统账号bottos向目标账号wangdenghui转账1000个BTO,

【执行成功结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli transfer --from bottos --to wangdenghui --amount 1000

TrxHash: f67896d429fe381d5a01bc35ca3ce796198cabea8958db52c5d4c74631e19f25

This transaction is sent. Please check its result by command : bcli transaction get --trxhash  <hash>

【查询交易结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli transaction get --trxhash  f67896d429fe381d5a01bc35ca3ce796198cabea8958db52c5d4c74631e19f25
{
    "ResourceReceipt": null,
    "Transaction": {
        "contract": "bottos",
        "cursor_label": 996052131,
        "cursor_num": 3634,
        "lifetime": 1546676080,
        "method": "transfer",
        "param": {
            "from": "bottos",
            "memo": "",
            "to": "wangdenghui",
            "value": 100000000000
        },
        "sender": "bottos",
        "sig_alg": 1,
        "signature": "7a1f020ee66e004168017731ad1b900d1a7e6b7b26eb78a871c671f5e755dc0328081fde964cfba6f885c1ede270a0c5aad13b3171d9cd84609e5d9c3cf80e2e",
        "version": 65536
    },
    "TrxHash": "f67896d429fe381d5a01bc35ca3ce796198cabea8958db52c5d4c74631e19f25"
}

<<<Transaction Status>>> : commited

说明:铂链的小数点最多为8位,1000个BTO的值为 “value”: 100000000000。

(2)为空间质押100个BTO

./bcli account stake

用于质押BTO用于发起交易,投票等交易活动,该命令成功后将返回BCLI成功发送的Transaction信息。
参数说明:
–account 用户名
–amount 质押BTO个数
–target 资源配置类型:vote,space,time (缺省: “vote”), stake 参数选择

如果需要部署合约,则至少需要质押目的为space,time的BTO一定数量。样例中,我们为space,time 各质押100个BTO,以便后期部署合约事宜。

为space质押100个BTO

./bcli account stake --account wangdenghui --amount 100 --target space

【结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account stake --account wangdenghui --amount 100 --target space

TrxHash: f35f13a05ac0e81d8e2ea8ff70f034229e8697485fed1df27b342f395a472042

This transaction is sent. Please check its result by command : bcli transaction get --trxhash  <hash>

【查询结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli transaction get --trxhash  "f35f13a05ac0e81d8e2ea8ff70f034229e8697485fed1df27b342f395a472042"
{
    "ResourceReceipt": {
        "account_name": "wangdenghui",
        "space_token_cost": 229,
        "time_token_cost": 100
    },
    "Transaction": {
        "contract": "bottos",
        "cursor_label": 1447741936,
        "cursor_num": 3903,
        "lifetime": 1546676887,
        "method": "stake",
        "param": {
            "amount": 10000000000,
            "target": "space"
        },
        "sender": "wangdenghui",
        "sig_alg": 1,
        "signature": "b9af36f46e2561c6f4cfdd9d38a7a9070881490df71ac94e97f9092ccd8e69b96557148d012fa9e6448fa9ab76020c932dd61a8267d42908a0e984aac769d958",
        "version": 65536
    },
    "TrxHash": "f35f13a05ac0e81d8e2ea8ff70f034229e8697485fed1df27b342f395a472042"
}

<<<Transaction Status>>> : commited
(3) 为时间质押100个BTO

为time质押100个BTO

./bcli account stake --account wangdenghui --amount 100 --target time

【成功结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account stake --account wangdenghui --amount 100 --target time

TrxHash: be7982be3d05322968615ee37593893a11d1f8c4faa8ca8a282724d87e4e7f84

This transaction is sent. Please check its result by command : bcli transaction get --trxhash  <hash>

【查询结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli transaction get --trxhash  "be7982be3d05322968615ee37593893a11d1f8c4faa8ca8a282724d87e4e7f84"
{
    "ResourceReceipt": {
        "account_name": "wangdenghui",
        "space_token_cost": 227,
        "time_token_cost": 100
    },
    "Transaction": {
        "contract": "bottos",
        "cursor_label": 1827735533,
        "cursor_num": 3964,
        "lifetime": 1546677070,
        "method": "stake",
        "param": {
            "amount": 10000000000,
            "target": "time"
        },
        "sender": "wangdenghui",
        "sig_alg": 1,
        "signature": "cab2aa82e80a7779c97e7845fb23212a277588fdbac356c800218b678107202d1ab9a4c57ef911112f6aa71d0fa8a4388349fe89e17edb6ff48817f46f787aa9",
        "version": 65536
    },
    "TrxHash": "be7982be3d05322968615ee37593893a11d1f8c4faa8ca8a282724d87e4e7f84"
}

<<<Transaction Status>>> : commited

####(4)查询用户账户状态
可知,wangdenghui账户还有800个BTO可用余额,空间和时间质押余额各有100个。

【成功结果】

duncanwang@ubuntu64bit-server:~/go/src/github.com/bottos$ ./bcli account get --account wangdenghui

    Account: wangdenghui
    Balance: 800.00000000 BTO
    Pubkey: 04307dbb6b301f90d25bc5561af354605e1a6b851ec81ae21c0260b8e26d2623702fb69edd0fa4cc0aa9b8a245aba9d0570ff08df0e72ca55845750270939f9634

    StakedBalance: 0.00000000 BTO
    UnStakingBalance: 0.00000000 BTO
    StakedSpaceBalance: 100.00000000 BTO
    StakedTimeBalance: 100.00000000 BTO
    UnStakingTimestamp: 0

    AvailableSpaceBalance: 151142400348
    UsedSpaceBalance: 452
    AvailableTimeBalance: 28800000202
    UsedTimeBalance: 198

    UnClaimedReward: 0.00000000 BTO

    Vote: N/A

    Contracts: N/A

#####(5)BOTTOS生态空间资源和时间资源的知识普及

1)空间资源(SPACE)

空间资源包含网络资源及存储资源的消耗,每次投票vote/cancelvote 以及发任何transaction和交易等行为,都会消耗一定的空间资源,需注意当用户的空间资源所质押的BTO消耗完毕后,当天内还有约3次的Transaction(等价转账交易)使用额度,当空间及时间资源任一耗尽则停止额度(vote投票在占用免费额度的情形下将无法执行),并于次日恢复额度。

**免费额度:**每24小时系统为每个账户免费提供一定量的资源, 空间资源大小:800,时间大小:400。当帐户未质押任何余额或已质押的空间资源用完时,可以使用免费空间资源。 每个转账交易大约是260字节,合约执行100us,因此每个帐户每天免费享受大约3笔交易(等价转账的交易)。**注意:**当账户的余额大于1时才可使用免费额度,避免恶意注册呆死账户。

**质押空间:**在任意时间段内,整个网络处理能力有限的,系统默认等价了固定数量的资源量。 帐户中的资源量与Bottos链网络的资源总量之比等于该帐户质押给资源的BTO 数量与整个网络的质押BTO数量之比。公式如下:

配额 = 为空间资源质押的BTO数 /网络中为空间资源质押的总BTO数 * 151,142,400,000,基于质押BTO的所有用户的按质押比例分配空间资源。

例如,如果整个网络上的质押空间资产总计1,000,000 BTO,而一个帐户质押了1,000 BTO(占总质押数的0.1%),则该帐户的可用空间资源为151,142,400。 注意: 由于整个网络和某个帐户的质押资产金额可能会发生变化,因此帐户持有的空间资源并不总是固定的;质押空间资源也是一次交易,需消耗一次免费额度;

说明:
1、单个普通交易最大可使用的空间大小为 2048 Byte;
2、部署合约交易最大可使用的空间大小为 51200 Byte;

2)时间资源(TIME)

time资源指 transaction 合约执行的时间,视服务器的硬件优劣会有所差异,一般内置合约执行的时间为几十 微妙(us),单次交易时间资源扣除门槛为100us,即小于100us 按照100us计算。一般为用户提供的一天内免费额度为400微秒的time使用额度 (相应的,空间资源对应的免费额度为800Bytes)。当用户质押了BTO给空间(space)后,每次投票vote/cancelvote 以及发任何transaction和交易等行为,都会消耗一定的空间资源。

**免费额度:**每24小时系统为每个账户免费提供一定量的资源, 空间资源大小:800,时间大小:400。当帐户未质押任何余额或已质押的空间资源用完时,可以使用免费空间资源。 每个转账交易大约是260字节,合约执行100us,因此每个帐户每天免费享受大约3笔交易(等价转账的交易)。**注意:**当账户的余额大于1时才可使用免费额度,避免恶意注册呆死账户。

**质押时间:**在任意时间段内,整个网络处理能力有限的,系统默认等价了固定数量的资源量。 帐户中的时间资源量与Bottos链网络的时间资源总量之比等于该帐户质押给时间资源的BTO 数量与整个网络的时间质押BTO数量之比。公式如下:

配额=为时间资源质押的BTO数 /网络中为时间资源质押的总BTO数 * 28,800,000,000,基于质押BTO的所有用户的按质押比例分配空间资源。

例如,如果整个网络上的质押时间资产总计1,000,000 BTO,而一个帐户质押了1,000 BTO(占总质押数的0.1%),则该帐户的可用时间资源为28,800,000。 注意: 由于整个网络和某个帐户的质押资产金额可能会发生变化,因此帐户持有的空间资源并不总是固定的;质押时间资源也是一次交易,需消耗一次免费额度;

说明:
1、单交易最大可使用的时间大小为 550000 us;

3)投票

对资源进行质押有两种渠道:
普通用户使用手机端钱包为本账号资源进行质押:
1.登录用户或导入用户;
2.在“资产详情”界面,点击 BTO 资产行,进入质押界面;
3.点击“质押”按钮,在“质押BTO数”,输入质押数量,“质押目标”根据需要,选择“空间”或“时间”;
4.输入密码进行质押操作。

如果是开发者,也可使用BCLI命令行进行质押操作;

# ./bcli account stake --account bottostest --amount 100 --target vote
# ./bcli account stake --account bottostest --amount 100 --target space #空间资源,
# ./bcli account stake --account bottostest --amount 100 --target time #时间资源,

也可以用BCLI进行解质押操作(3天后才可“赎回”):

# ./bcli account unstake --account bottostest --amount 100 --source vote vote #解质押也可只解质押部分BTO
# ./bcli account unstake --account bottostest --amount 100 --source space #解质押也可只解质押部分BTO
# ./bcli account unstake --account bottostest --amount 100 --source time #解质押也可只解质押部分BTO

说明:每个账号每24小时拥有3次 PUSTH transaction的免费额度(单次衡量标准为 转账交易 所消耗的资源量)

3,参考

1) 铂链官网
http://www.bottos.org/
2)铂链开发手册
https://docs.botfans.org/en/
3)铂链GITHUB
https://github.com/bottos-project
4)研发帮助文档
https://github.com/bottos-project/Documentation/tree/master/resource_cn
5)BCLI使用说明
https://github.com/bottos-project/Documentation/blob/master/resource_cn/BCLI使用说明.md
6)以太坊RPC机制与API实例
https://www.cnblogs.com/Evsward/p/eth-rpc.html

文档编写过程中,得到BOTTOS技术专家大妞妞的及时支持和答复,深表感谢。


猜你喜欢

转载自blog.csdn.net/wangdenghui2005/article/details/87896694