fisco-bcos-cli

Rust 版 FISCO BCOS 可交互式命令行工具。

安装

shell $ cargo install --force fisco-bcos-cli

此 crate 使用了 TASSL 来处理 TLS 连接,在 LinuxMacos 下无需做任何额外操作,其他环境下则需要指定以下环境变量:

LinuxMacos 下,如果你已经编译好了 TASSL,也可以通过指定以上环境变量来缩短编译时间。

使用

shell $ fisco-bcos-cli

执行上述命令,你将进入以下交互页面:

```shell Welcome to Command line tool for FISCO BCOS (V0.3.0). Type help to get help

> ```

输入 help,获取帮助信息:

```shell

help

  1. Use setconfig function to initialize the environment(e.g., setconfig ./config/config.json)
  2. Use the below functions to interact with the FISCO BCOS Service: "getclientversion", "getblocknumber", "getpbftview", "getsealerlist", "getobserverlist", "getconsensusstatus", "getsyncstatus", "getpeers", "getgrouppeers", "getnodeidlist", "getgrouplist", "getblockbyhash", "getblockbynumber", "getblockheaderbyhash", "getblockheaderbynumber", "getblockhashbynumber", "gettransactionbyhash", "gettransactionbyblockhashandindex", "gettransactionbyblocknumberandindex", "gettransactionreceipt", "getpendingtransactions", "getpendingtxsize", "getcode", "gettotaltransactioncount", "call", "sendrawtransaction", "sendrawtransactionandgetproof", "deploy", "compile", "getsystemconfigbykey", "gettransactionbyhashwithproof", "gettransactionreceiptbyhashwithproof", "generategroup", "startgroup", "stopgroup", "removegroup", "recovergroup", "querygroupstatus", "getnodeinfo", "getbatchreceiptsbyblocknumberandrange", "getbatchreceiptsbyblockhashandrange", "systemconfig:setvaluekey", "consensus:addsealer", "consensus:addobserver", "consensus:remove", "cns:insert", "cns:selectbyname", "cns:selectbynameandversion", "cns:getcontractaddress", "permission:insert", "permission:remove", "permission:querybyname", "permission:grantwrite", "permission:revokewrite", "permission:querypermission", "contractlifecycle:freeze", "contractlifecycle:unfreeze", "contractlifecycle:grantmanager", "contractlifecycle:getstatus", "contractlifecycle:listmanager", "chaingovernanceservice:grantcommitteemember", "chaingovernanceservice:revokecommitteemember", "chaingovernanceservice:listcommitteemembers", "chaingovernanceservice:querycommitteememberweight", "chaingovernanceservice:updatecommitteememberweight", "chaingovernanceservice:queryvotesofmember", "chaingovernanceservice:queryvotesofthreshold", "chaingovernanceservice:updatethreshold", "chaingovernanceservice:querythreshold", "chaingovernanceservice:grantoperator", "chaingovernanceservice:revokeoperator", "chaingovernanceservice:listoperators", "chaingovernanceservice:freezeaccount", "chaingovernanceservice:unfreezeaccount", "chaingovernanceservice:getaccount_status", "sql"
  3. Type help to get help
  4. Type CTRL-C or CTRL-D to quit
  5. Visit https://github.com/kkawakam/rustyline#actions to get more actions ```

首先调用 set_config 来设置环境信息(配置信息详情参见:服务配置),比如:

```shell

set_config ./configs/config.json ```

而后便可调用帮助信息中列出的方法对链上数据进行交互,比如:

``` shell

getclientversion

Object({"Build Time": String("20210201 10:15:37"), "Build Type": String("Darwin/appleclang/RelWithDebInfo"), "Chain Id": String("1"), "FISCO-BCOS Version": String("2.7.2"), "Git Branch": String("HEAD"), "Git Commit Hash": String("4c8a5bbe44c19db8a002017ff9dbb16d3d28e9da"), "Supported Version": String("2.7.2")}) ```

交互方法的参数信息参见:FISCO BCOS Service

注意事项:

License

Apache-2.0