EOS帐户交易的构建命令
EOS版本:4.0
系统:Ubuntu 16.04 LTS
1.创建两对密匙
cleos create key
Private key:5JeTwSwKfpVRHGLqysakTXfkwnNDj4qJSxjLJJqE61iU7xWCdqC
Public key:EOS7qvZrtQ9FEvWL1mWffXJwDfdC2LTaYQRjVQ8wuJy6w5aAArKrn
cleos create key
Private key: 5Jmo7CLWa72BpakUtFNpuo6ynJYjGmdjwgDpuvxpct2MjgQnbKd
Public key:EOS8Cr9vyAZbWwpEf6r8M4cureNBHZ7Q2gN5t79oEM7mdCasYXgh2
2.创建一个钱包
cleos wallet create -n hmlwallet
回显包含钱包的密匙,在解锁钱包的时候需要,此时应该保存下来: PW5HzKFxhGieMwGt3RUSHz6raJKojupDFkAV5vavsuzvx3ehQEzEM
3.将私匙导入钱包
这里是把两把私匙放在同一个钱包,也可以放入不同的钱包。
cleos wallet import -n hmlwallet5JeTwSwKfpVRHGLqysakTXfkwnNDj4qJSxjLJJqE61iU7xWCdqC
4.运行单节点deos
./nodeos -e -p eosio--plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugineosio::history_api_plugin --resync-blockchain
5.创建帐户
其中eosio为创世者用户,hml为需要创建的用户,后面为两把公匙,分别对应用户的owner和active权限。
cleos create account eosio hml EOS7qvZrtQ9FEvWL1mWffXJwDfdC2LTaYQRjVQ8wuJy6w5aAArKrn EOS8Cr9vyAZbWwpEf6r8M4cureNBHZ7Q2gN5t79oEM7mdCasYXgh2
6.创建智能合约
使用eosio.token创建智能合约,合约名称为hml,-p是权限允许标志,-x是最大消息长度。
cleos set contract hml /root/eos/build/contracts/eosio.token -p hml -x 1000
7.创建代币
这里的EOS应该是发放代币的单位。
cleos push action hml create '["hml", "100000000.0000 EOS", 0, 0, 0]' -p hml -x 3000
8.发放代币
cleos push action hml issue'["hml","10000.0000 EOS", "memo"]' -p hml
9.再创建一个帐号
cleos create key
Private key:5HtWDsHaaRdgnrMebyaMxq1gtjfE1t8zPXkqSbYg4vgqwonnA4f
Public key: EOS89xV854c1FVoDweYxgMbRa7Dr1y69WSNjueXy9n2jjEbMuqREQ
cleos create key
Private key:5JGqPwRHD2Dh5TLuGUbnMGBrEEWeoRmxAxJbM22itwiFtsQdEuY
Public key:EOS4wD9gk2etTeKm5nDh79AeLBR28StXDjibsLeFnd2Xo7LCnmdx1
cleos wallet create -n hmlwallet2
PW5HvvRLpEvAWtK6soCEHpybEjm1tTMxhbheJ7D15uueVyPa1XbcN
cleos wallet import -n hmlwallet5HtWDsHaaRdgnrMebyaMxq1gtjfE1t8zPXkqSbYg4vgqwonnA4f
cleoswallet import -n hmlwallet 5JGqPwRHD2Dh5TLuGUbnMGBrEEWeoRmxAxJbM22itwiFtsQdEuY
cleos create account eosio hml2 EOS89xV854c1FVoDweYxgMbRa7Dr1y69WSNjueXy9n2jjEbMuqREQ EOS4wD9gk2etTeKm5nDh79AeLBR28StXDjibsLeFnd2Xo7LCnmdx1
10.给第二个帐号发币
cleospush action hml issue '["hml2","10000.0000 EOS","memo"]' -p hml
11.查看两个帐户的EOS币
Cleos getcurrency balance hml hml EOS
12.交易
Hml向hml2转1000 EOS.
cleospush action hml transfer '["hml", "hml2", "1000.0000EOS", "m"]' -p hml
Nodeos结点收到交易
至此转帐成功,可以创建多个类似的用户进行转帐交易。