通过EOS研究系列【mac下编译运行】将EOS的cleos也就是命令行钱包运行起来了,尝试一下基本命令,至少先得给自己创建个帐户吧。
和其它区块链一样,必须有公私钥对,cleos用以下命令创建公私钥:
(env3) Chaim:cleos Chaim$ ./cleos create key
Private key: 5HxJcoQ4LzRr1sQJtdLpesNWyNDVp44hC3GrG7fzuRkWofHPSb6
Public key: EOS5nSzURn8AoyCuphwqez5oot1ciHxX5WFmkU7dvr9PpM1HGTgpZ
钱包相关subcommand是wallet
(env3) Chaim:cleos Chaim$ ./cleos wallet create
Failed to connect to keosd at http://localhost:8900/; is keosd running?
直接这样调用会提示无法连接localhost:8900,让确认keosd是否运行?
keosd是什么呢?keosd运行在本地,用来存储私钥和交易签名。
keosd运行时会创建目录: ~/eosio-wallet,同时在目录下生成config.ini文件,配置文件可以通过 --config-dir 进行指定,数据目录可以通过 --data-dir 指定。
修改配置文件监听端口为8090,直接运行keosd程序,如下:
Chaim:keosd Chaim$ ./keosd
2614013ms thread-0 wallet_plugin.cpp:39 plugin_initialize ] initializing wallet plugin
2614014ms thread-0 http_plugin.cpp:290 plugin_initialize ] configured http to listen on 127.0.0.1:8900
可以用 keosd --help 查看更多说明。
再建立钱包,如下:
(env3) Chaim:cleos Chaim$ ./cleos wallet create
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
建立钱包会返回一个密码,保存好这个密码。
./cleos wallet unlock -n default --password xxxx
(env3) Chaim:cleos Chaim$ ./cleos wallet keys
[]
(env3) Chaim:cleos Chaim$ ./cleos wallet import 5HxJcoQ4LzRr1sQJtdLpesNWyNDVp44hC3GrG7fzuRkWofHPSb6
imported private key for: EOS5nSzURn8AoyCuphwqez5oot1ciHxX5WFmkU7dvr9PpM1HGTgpZ
据说“b1”是“blockone”的帐号,取信息看看:
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get account b1
permissions:
owner 1: 1 EOS5cujNHGMYZZ2tgByyNEUaoPLFhZVmGXbZc9BLJeQkKZFqGYEiQ
active 1: 1 EOS5cujNHGMYZZ2tgByyNEUaoPLFhZVmGXbZc9BLJeQkKZFqGYEiQ
memory:
quota: 7.966 KiB used: 3.475 KiB
net bandwidth:
staked: 49999995.0050 EOS (total stake delegated from account to self)
delegated: 0.0100 EOS (total staked delegated to account from others)
used: 0 bytes
available: 22.74 TiB
limit: 22.74 TiB
cpu bandwidth:
staked: 49999995.0050 EOS (total stake delegated from account to self)
delegated: 0.0100 EOS (total staked delegated to account from others)
used: 0 us
available: 1325 hr
limit: 1325 hr
EOS balances:
liquid: 11.2468 EOS
staked: 99999990.0100 EOS
unstaking: 0.0000 EOS
total: 100000001.2568 EOS
producers: <not voted>
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get currency balance eosio.token b1 EOS
11.2468 EOS
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get block 4058239
{
"timestamp": "2018-07-04T04:06:41.000",
"producer": "eosbeijingbp",
"confirmed": 0,
"previous": "003dec7e45c6bfb502c68414ca47e8036c81464cfdbf7668f0d8c53b7bc3a434",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "996f073e193785fd5d0f5cf71b8f311c14db5800ada22e084f24f186ebd87ab4",
"schedule_version": 105,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_JxUZWTtZ95QiNfeYGxVjLgTP1LokcC97opfo6FHNfFuk36yTaThJCov2nqVU5zyKt8jfqQFmCQpxg2Z8KiBaWHZjoTVMmj",
"transactions": [],
"block_extensions": [],
"id": "003dec7fb941f537db2b1b9d15bfbe5bbbaa56a64690f4e0bcde8b143a21f200",
"block_num": 4058239,
"ref_block_prefix": 2635803611
}
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get transaction 5c293faaec455bf2b26bf3b2eb05c320a2aa3956085a1ad428ae2e53ff5091c0
{
"id": "5c2947b27ab1baf1a2b8280a2183cb9b66fee18e42bbd43d0c1e149a7ea4aefe",
"trx": null,
"block_time": "2018-06-12T12:41:08.000",
"block_num": 357958,
"last_irreversible_block": 4060364,
"traces": []
}
卡在这了!EOS的RAM等价格现在这么贵,据说没有免费帐号了,那我怎么创建一个新帐号呢?
EOS这是就让参与ICO的用户玩吗?先小众人群把价格炒上去,舆论炒起来,再等着韭菜进去?所以才有说EOS不是EOS而是RAM吗?!
找朋友帮忙注册当韭菜去......请等待...
[下午]
没事去浏览下eos区块数据,看看RAM涨幅吧...
[晚上]
为了创建帐号找到Oflyhigh帮忙,据说创建帐号今天费用得100RMB以上了,再去EOS帐号群里都号称是45美元一个帐号,贫穷限制了我的想像力,没弄明白EOS的玩法!最后还是Oflyhigh给的一个钱包免费注册了个帐号,介绍下这个钱包名字叫“Starteos”,这个钱包无论是界面还是功能都是用心做了!
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get account steemchaimyu
permissions:
owner 1: 1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
active 1: 1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
memory:
quota: 3.497 KiB used: 2.926 KiB
net bandwidth:
delegated: 0.0500 EOS (total staked delegated to account from others)
used: 0 bytes
available: 25.9 KiB
limit: 25.9 KiB
cpu bandwidth:
delegated: 0.0500 EOS (total staked delegated to account from others)
used: 0 us
available: 5.059 ms
limit: 5.059 ms
用这个帐号调用创建命令试试:
(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com system newaccount -x 1000 --stake-net "0.1 EOS" --stake-cpu "0.1 EOS" --buy-ram-kbytes 8 --transfer steemchaimyu allforii4all EOS6fRahj4TDTxzr6xkTMABfPwy111eKMrH1gfP452fDPVjWbCskn EOS6fRahj4TDTxzr6xkTMABfPwy111eKMrH1gfP452fDPVjWbCskn
3586519ms thread-0 main.cpp:429 create_action ] result: {"binargs":"a0bd74a621a954c610a321ce5dba623400200000"} arg: {"code":"eosio","action":"buyrambytes","args":{"payer":"steemchaimyu","receiver":"allforii4all","bytes":8192}}
3589346ms thread-0 main.cpp:429 create_action ] result: {"binargs":"a0bd74a621a954c610a321ce5dba6234e80300000000000004454f5300000000e80300000000000004454f530000000001"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"steemchaimyu","receiver":"allforii4all","stake_net_quantity":"0.1000 EOS","stake_cpu_quantity":"0.1000 EOS","transfer":true}}
Error 3050003: eosio_assert_message assertion failure
创建帐号失败,理所当然,因为steemchaimyu这个帐号没有钱,大概知道创建命令就好了!这错误提示还是相当程序员化啊!
(env3) Chaim:cleos Chaim$ ./cleos -u https://eos.greymass.com get accounts EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
{
"account_names": [
"steemchaimyu"
]
}
https://blog.csdn.net/itleaks/article/details/80673417
http://liyuechun.org/2018/04/19/eos-cleos/
感谢您阅读 @chaimyu 的帖子,期待您能留言交流!