【EOS】cleos命令

eos文档

version

// 检索客户端的版本信息
$ ./cleos version client

convert

打包和解包transaction

  • pack_transaction
  • unpack_transaction
  • pack_action_data
  • unpack_action_data

create

create key
创建密钥对

$ ./cleos create key -f myKey.txt
$ ./cleos create key --to-console

create account
在区块链上创建新的账户
如果加载了系统合约(例如生产网络),则使用cleos system newaccount代替

Positionals:
  creator TEXT                The name of the account creating the new account
  name TEXT                   The name of the new account
  OwnerKey TEXT               The owner public key for the new account
  ActiveKey TEXT              The active public key for the new account

Options:
  -x,--expiration             set the time in seconds before a transaction expires, defaults to 30s
  -f,--force-unique           force the transaction to be unique. this will consume extra bandwidth and remove any protections against accidently issuing the same transaction multiple times
  -s,--skip-sign              Specify if unlocked wallet keys should be used to sign transaction
  -d,--dont-broadcast         don't broadcast transaction to the network (just print to stdout)
  -p,--permission TEXT ...    An account and permission level to authorize, as in 'account@permission' (defaults to 'creator@active')
$ ./cleos create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA

get

从区块链检索各种项目和信息。

// 简单地返回当前的区块链状态信息。
$ ./cleos get info

$ ./cleos get block 1

$ cleos get account eosio --json

$ cleos get code eosio.token

$ cleos get table eosio eosio namebids --key-type i64 --index 2 -r -l 1

$ cleos get currency balance eosio.token eosio SYS
$ cleos get currency stats eosio.token SYS

// 检索与已定义公钥关联的所有帐户。
$ cleos get accounts EOS8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt

// 返回此账号创建的账号
$ cleos get servants eosio

$ ./cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703

// 检索范围内引用特定帐户名称的所有操作。
$ ./cleos get actions eosio.token

set

设置或者更新区块链状态

$ ./cleos set contract currency ../../../contracts/currency/currency.wast ../../../contracts/currency/currency.abi

transfer

$ ./cleos transfer useraaaaaaaa useraaaaaaac "1.0000 SYS" "hello world"
$ ./cleos transfer useraaaaaaaa useraaaaaaac -c eosio.token "1.0000 SYS" "hello world"

net

$ cleos net connect http://somehost.com:1234
$ cleos net disconnect http://somehost.com:1234
$ cleos net status http://somepeer:1234
$ cleos net peers 

wallet

# 创建账户,默认创建default
$ ./cleos wallet create --to-console
$ ./cleos wallet create -n second-wallet --to-console
$ ./cleos wallet create --name my-new-wallet --file my-new-wallet.txt

# 默认打开default,有open没有close
$ ./cleos wallet open
$ ./cleos wallet open -n second-wallet

$ ./cleos wallet lock
$ ./cleos wallet lock -n second-wallet

$ ./cleos wallet lock_all

$ ./cleos wallet unlock -n second-wallet --password PW5Ji6JUrLjhKAVn68nmacLxwhvtqUAV18J7iycZppsPKeoGGgBEw

$ ./cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

# Lists opened wallets
$ ./cleos wallet list

# 所有解锁钱包的公钥列表。这些键可以用来签署transaction。
$ ./cleos wallet keys

# 在钱包中创建一个密钥对,这样您就不需要像使用cleos创建密钥那样手动导入它了。默认情况下,这将创建钱包的密钥是K1密钥。但是这个命令也允许您创建R1格式的键。
$ cleos wallet create_key K1

# 可以查询单个钱包的公钥对和私钥对。钱包必须已经打开,你必须再次输入密码。
$ cleos wallet private_keys K1
    原文作者:jincheng828
    原文地址: https://segmentfault.com/a/1190000017755644
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞