EOS Cleos 命令汇总

获取所有命令

命令格式:$ cleos

cleos包含所有命令的文档。有关cleos已知的所有命令的列表,只需简单地运行它,不带任何参数:

$ cleos
ERROR: RequiredError: Subcommand required
Command Line Interface to EOSIO Client
Usage: cleos [OPTIONS] SUBCOMMAND
Options:
  -h,--help                   打印帮助信息并且退出
  -u,--url TEXT=http://localhost:8888/
                              nodeos 运行的http/https URL
  --wallet-url TEXT=http://localhost:8888/
                              keosd运行的 http/https URL
  -v,--verbose                输出对错误的详细操作
子命令:
  version                     返回版本信息
  create                      在区块链上和区域外创建数据
  get                         从区块链中检索各种数据和信息
  set                         设置或更新区块链状态
  transfer                    从账户到账户转移EOS
  net                         与本地p2p网络连接进行交互
  wallet                      与本地钱包互动
  sign                        签署交易
  push                        将任意事务推送到区块链
  multisig                    Multisig合约命令
  system                      将eosio.system合约行为发送到区块链。

获取所有子命令

命令格式: $ cleos ${command}

要获得有关任何特定子命令的帮助,请使用无参数运行它:

$ cleos create
ERROR: RequiredError: Subcommand required
Create various items, on and off the blockchain
Usage: ./cleos create SUBCOMMAND
Subcommands:
  key                         Create a new keypair and print the public and private keys
  account                     Create a new account on the blockchain
  producer                    Create a new producer on the blockchain
$ cleos create account
ERROR: RequiredError: creator
Create a new account on the blockchain
Usage: ./cleos create account creator name OwnerKey ActiveKey
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 account
  ActiveKey TEXT              The active public key for the account

链接节点

命令格式:$ cleos --url ${node}:${port}

这会将你连接到本地节点

$ cleos -u localhost:8889 
$ cleos --url localhost:8889 

你还可以调整节点参数以连接到其他节点,例如公共测试网

$ cleos -H test1.eos.io -p 80 

注意 你需要在每个请求中包含-H和-p参数来解决问题

查询区块链状态

命令格式:$ cleos get info

$ cleos get info
{
  "server_version": "7451e092",
  "head_block_num": 6980,
  "last_irreversible_block_num": 6963,
  "head_block_id": "00001b4490e32b84861230871bb1c25fb8ee777153f4f82c5f3e4ca2b9877712",
  "head_block_time": "2017-12-07T09:18:48",
  "head_block_producer": "initp",
  "recent_slots": "1111111111111111111111111111111111111111111111111111111111111111",
  "participation_rate": "1.00000000000000000"
}

通过transaction_id获取交易

命令格式:$ cleos get transaction ${transaction_id}

通过在nodeos中加载account_history_api_plugin,我们可以使用transaciton_id查询特定事务

$ cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703
{
  "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703",
  "processed": {
    "refBlockNum": 2206,
    "refBlockPrefix": 221394282,
    "expiration": "2017-09-05T08:03:58",
    "scope": [
      "inita",
      "tester"
    ],
    "signatures": [
      "1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312"
    ],
    "messages": [{
        "code": "eos",
        "type": "transfer",
        "authorization": [{
            "account": "inita",
            "permission": "active"
          }
        ],
        "data": {
          "from": "inita",
          "to": "tester",
          "amount": 1000,
          "memo": ""
        },
        "hex_data": "000000008040934b00000000c84267a1e80300000000000000"
      }
    ],
    "output": [{
        "notify": [{
            "name": "tester",
            "output": {
              "notify": [],
              "sync_transactions": [],
              "async_transactions": []
            }
          },{
            "name": "inita",
            "output": {
              "notify": [],
              "sync_transactions": [],
              "async_transactions": []
            }
          }
        ],
        "sync_transactions": [],
        "async_transactions": []
      }
    ]
  }
}

通过帐户获取交易

命令格式:$ cleos get transaction ${account}

我们也可以查询某个账户从最近一个账户开始执行的交易清单

$ cleos get transactions inita
[
  {
    "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703",
    ...
  },
  {
 
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值