EOS命令详解

cleos命令解析

查看客户端版本

cleos version client

 

wallet

创建钱包

cleos wallet create -n fish1208 --to-console

 

打开钱包

cleos wallet open

 

解锁钱包

cleos wallet unlock -n fish1208 --password PW5KiK9GU2TVo2TpA9Ragpzygj8s54AiCxBi2gDVzgUzWZCxbHZsS

 

锁定钱包

cleos wallet lock -n fish1208

 

锁定所有钱包

cleos wallet lock_all

 

将Private key导入钱包

cleos wallet import -n fish1208 --private-key 5JZEmy65HqCu1iobB98hA7ca1NYzRtK28gqWyonC25cUA54EmJS

 

查看钱包列表

cleos wallet list

 

查看Private key导入情况

cleos wallet keys

 

停止

cleos wallet stop

 

create

创建key

cleos create key --to-console

 

创建用户账户

cleos create account eosio fish EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X

 

get

获取信息

cleos get info

EOS命令详解_第1张图片

 

获取区块信息

cleos get block 128

EOS命令详解_第2张图片

 

获取账号信息

cleos get account fish

EOS命令详解_第3张图片

 

获取code

cleos get code fish

 

如果部署合约,则code hash会有变化

 

获取账号对应的abi

cleos get abi fish

EOS命令详解_第4张图片

获取动作

cleos get actions fish -j

 

获取账号列表

cleos get accounts EOS7ZcTmKesEKSjTXv4txEMSVvQoQNar9RNSQSQZ2namYg5qMkD9P

通过公钥来查询其“管辖”的账号列表

 

获取余额

cleos get currency balance eosio.token fish EOS

eosio.token 部署eosio.token合约的账户

fish普通账户

 

set

设置合约

cleos set contract fish hello -p fish

 

token

创建eosio.token账户

cleos create account eosio eosio.token EOS7ZcTmKesEKSjTXv4txEMSVvQoQNar9RNSQSQZ2namYg5qMkD9P EOS7ZcTmKesEKSjTXv4txEMSVvQoQNar9RNSQSQZ2namYg5qMkD9P

executed transaction: 2b6f62a00fbf2f139fb233e08bfe26448d1eb05b1b3b9543aa1abb3d80c6a37b  200 bytes  239 us

#         eosio <= eosio::newaccount            {"creator":"eosio","name":"eosio.token","owner":{"threshold":1,"keys":[{"key":"EOS7ZcTmKesEKSjTXv4tx...

warning: transaction executed locally, but may not be confirmed by the network yet    ]

 

编译wast

eosiocpp -o eosio.token.wast eosio.token.cpp

 

部署eosio.token智能合约

cleos set contract eosio.token eosio.token -p eosio.token

 

创建EOS的代币

cleos push action eosio.token create '[ "eosio", "1000000000.0000 EOS", 0, 0, 0]' -p eosio.token

executed transaction: 140e133e61b65ded514b9d0a39bf206d159c668da210d0dd12e524f138df067c  120 bytes  425 us

#   eosio.token <= eosio.token::create          {"issuer":"eosio","maximum_supply":"1000000000.0000 EOS"}

warning: transaction executed locally, but may not be confirmed by the network yet    ]

 

代币发放

cleos push action eosio.token issue '["fish","100.0000 EOS", "发给fish账户100个EOS"]' -p eosio

EOS命令详解_第5张图片

executed transaction: dfac1bfb8504f34403f977db7600140113cfc3587a89661c1ba0d25c86dd6810  144 bytes  1311 us

#   eosio.token <= eosio.token::issue           {"to":"fish","quantity":"100.0000 EOS","memo":"发给fish账户100个EOS"}

#   eosio.token <= eosio.token::transfer        {"from":"eosio","to":"fish","quantity":"100.0000 EOS","memo":"发给fish账户100个EOS"}

#         eosio <= eosio.token::transfer        {"from":"eosio","to":"fish","quantity":"100.0000 EOS","memo":"发给fish账户100个EOS"}

#          fish <= eosio.token::transfer        {"from":"eosio","to":"fish","quantity":"100.0000 EOS","memo":"发给fish账户100个EOS"}

warning: transaction executed locally, but may not be confirmed by the network yet    ]

 

查询fish账户余额

cleos get currency balance eosio.token fish EOS

eosio.token 部署eosio.token合约的账户

fish普通账户

 

代币交易

先创建testuer账户

cleos create account eosio testuer EOS7ZcTmKesEKSjTXv4txEMSVvQoQNar9RNSQSQZ2namYg5qMkD9P EOS7ZcTmKesEKSjTXv4txEMSVvQoQNar9RNSQSQZ2namYg5qMkD9P

 

转给testuser账户25个代币

cleos push action eosio.token transfer '["fish","testuer","25.0000 EOS", "fish转25个testuer"]' -p fish

executed transaction: fd4761bf4ae71a5fefd853a0e8b29f561ef9caf70179e60a3c72c9480be0378a  144 bytes  723 us

#   eosio.token <= eosio.token::transfer        {"from":"fish","to":"testuer","quantity":"25.0000 EOS","memo":"fish转25个testuer"}

#          fish <= eosio.token::transfer        {"from":"fish","to":"testuer","quantity":"25.0000 EOS","memo":"fish转25个testuer"}

#       testuer <= eosio.token::transfer        {"from":"fish","to":"testuer","quantity":"25.0000 EOS","memo":"fish转25个testuer"}

warning: transaction executed locally, but may not be confirmed by the network yet    ]

查看fish、testuer账户余额

 

参考:

https://mymonero.com/

https://blog.csdn.net/qq1169091731/article/details/79946032

https://blog.csdn.net/caokun_8341/article/details/80713851

https://eosfans.io/wiki/smart-contracts

https://www.cnblogs.com/paluano/p/cleos.html

https://eosfans.io/topics/435

 

你可能感兴趣的:(eos,区块链,eos)