bitxhub¶
中继链命令描述如下:
bitxhub -h
NAME:
BitXHub - A leading inter-blockchain platform
USAGE:
bitxhub [global options] command [command options] [arguments...]
COMMANDS:
config Operate bitxhub config
init Initialize BitXHub local configuration
start Start a long-running start process
key Create and show key information
version BitXHub version
cert Certification tools
client BitXHub client command
help, h Shows a list of commands or help for one command
参数解释
repo
: 可选参数,指定bitxhub节点配置文件所在目录,如果不指定,默认使用$HOME/.bitxhub目录。 子命令描述
bitxhub config¶
显示当前节点配置:如未指定repo
则默认使用~/.bitxhub/
路径,若路径下存在旧配置,则提示覆盖与否。
$ bitxhub config
{
"cert": {
"agency_cert_path": "certs/agency.cert",
"ca_cert_path": "certs/ca.cert",
"node_cert_path": "certs/node.cert",
"verify": true
},
"executor": {
"type": "serial"
},
"gateway": {
"AllowedOrigins": [
"*"
]
},
"genesis": {
"admins": [
{
"address": "0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013",
"weight": 2
},
{
"address": "0x79a1215469FaB6f9c63c1816b45183AD3624bE34",
"weight": 2
},
{
"address": "0x97c8B516D19edBf575D72a172Af7F418BE498C37",
"weight": 2
},
{
"address": "0xc0Ff2e0b3189132D815b8eb325bE17285AC898f8",
"weight": 2
}
],
"strategy": {
"appchainmgr": "SimpleMajority",
"nodemgr": "SimpleMajority",
"rulemgr": "SimpleMajority",
"servicemgr": "SimpleMajority"
}
},
"license": {
"key": "133847740289a8dc5447bfbaedf10ed5ee9460110e4ba6b455e33cf941253527f18dd721515c5142fcea9b6415ddad6b3f1696011a4bbc86f35833ae9296a3ea",
"verifier": "https://172.16.5.3:11443/v1/validation"
},
"limiter": {
"capacity": 10000,
"interval": 50000000,
"quantum": 500
},
"log": {
"dir": "logs",
"filename": "bitxhub.log",
"level": "info",
"module": {
"api": "info",
"consensus": "info",
"coreapi": "info",
"executor": "info",
"p2p": "info",
"profile": "info",
"router": "info",
"storage": "info"
},
"report_caller": false
},
"monitor": {
"Enable": true
},
"order": {
"plugin": "plugins/raft.so"
},
"ping": {
"duration": 15000000000,
"enable": true
},
"port": {
"gateway": 9091,
"grpc": 60011,
"monitor": 40011,
"pprof": 53121
},
"pprof": {
"duration": 30000000000,
"enable": true,
"mode": "memory",
"ptype": "http"
},
"repo_root": "/Users/xxx/.bitxhub",
"security": {
"EnableTLS": false,
"pem_file_path": "certs/node.cert",
"server_key_path": "certs/node.priv"
},
"solo": false,
"title": "BitXHub configuration file",
"txpool": {
"batch_size": 500,
"batch_timeout": 500000000
}
}
bitxhub init¶
初始化节点配置:如未指定repo
则默认使用~/.bitxhub/
路径。
示例说明
$ bitxhub init
initializing bitxhub at /Users/xxx/.bitxhub
bitxhub configuration file already exists
reinitializing would overwrite your configuration, Y/N?
y
bitxhub start¶
该命令bitxhub start
显示BitXHub的版本信息。
它会在命令行显示版本、构建日期、操作系统/架构和Go编译器版本。
例如:
bitxhub --repo <node_config_path> start
BitXHub version: dev-fixx-1.6-2a2f39f
App build date: 2021-11-25T16:43:19
System version: darwin/amd64
Golang version: go1.14.15
time="2021-11-29T18:07:37.722" level=info msg="MemPool batch size = 200" module=order
time="2021-11-29T18:07:37.722" level=info msg="MemPool tx slice size = 200" module=order
time="2021-11-29T18:07:37.722" level=info msg="MemPool batch seqNo = 6" module=order
time="2021-11-29T18:07:37.723" level=info msg="MemPool pool size = 50000" module=order
time="2021-11-29T18:07:37.723" level=info msg="Raft localID = 1" module=order
time="2021-11-29T18:07:37.723" level=info msg="Raft lastExec = 6 " module=order
time="2021-11-29T18:07:37.723" level=info msg="Raft snapshotCount = 1000" module=order
time="2021-11-29T18:07:37.723" level=info msg="GRPC service started" module=api port=60011
time="2021-11-29T18:07:37.723" level=info msg="Gateway service started" module=api port=9091
参数解释
passwd
:指定节点私钥密码config
:指定节点配置路径,一般指bitxhub.tomlnetwork
:指定节点p2p网络配置文件,一般指network.tomlorder
:指定节点共识配置文件,一般指oeder.toml
若不指定以上配置,则默认至bitxhub --repo路径下寻找。
NAME:
bitxhub start - Start a long-running start process
USAGE:
bitxhub start [command options] [arguments...]
OPTIONS:
--passwd value bitxhub key password
--config value bitxhub config path
--network value bitxhub network config path
--order value bitxhub order config path
bitxhub key¶
功能
该命令bitxhub key
提供针对bitxhub节点的私钥管理。
它包含了私钥生成、私钥格式转换、私钥查看、地址查看。
子命令信息如下:
NAME:
BitXHub key - Create and show key information
USAGE:
BitXHub key command [command options] [arguments...]
COMMANDS:
gen Create new Secp256k1 private key in specified directory
convert Convert the Secp256k1 private key to BitXHub key format
show Show BitXHub key from repo
address Show address from Secp256k1 private key
子命令
bitxhub key gen¶
- 生成节点私钥
target
: 指定生成路径passwd
: 指定私钥密码
NAME:
BitXHub key gen - Create new Secp256k1 private key in specified directory
USAGE:
BitXHub key gen [command options] [arguments...]
OPTIONS:
--target value Specific target directory
--passwd value Specify password
样例:
bitxhub key convert¶
- 私钥格式转换
save
:是否同时保存目标私钥priv
: Secp256k1私钥地址,在bitxhub中一般指node.privpasswd
: Secp256k1私钥密码
NAME:
BitXHub key convert - Convert the Secp256k1 private key to BitXHub key format
USAGE:
BitXHub key convert [command options] [arguments...]
OPTIONS:
--save, -s Save BitXHub key into repo
--priv value Specify private key path
--passwd value Specify password
bitxhub key show¶
样例:
bitxhub key show
{
"type": 3,
"cipher": {
"data": "18bc2c685cc79d7098fa1f3b97f14541121b61b1d3492ef4f298c84844e7b380fa8e8a84dc44d910aa9dafddc0347c670bace2c74d8553a4c843ae58ce4aeb78",
"cipher": "AES-256"
}
}
bitxhub key address¶
样例:
bitxhub version¶
该命令 bitxhub version
不含参数.
该命令bitxhub version
显示BitXHub的版本信息。
它会在命令行显示版本、构建日期、操作系统/架构和Go编译器版本。
例如:
BitXHub version: dev-fixx-1.6-2a2f39f
App build date: 2021-11-25T15:01:28
System version: darwin/amd64
Golang version: go1.14.15
bitxhub cert¶
功能
该命令bitxhub cert
提供一系列x509标准的证书工具,服务于中继链节点的准入机制。
它包含了CA生成、CSR描述生成、证书签发、证书解析、证书私钥生成以及证书校验。
子命令信息如下:
bitxhub cert -h
NAME:
BitXHub cert - Certification tools
USAGE:
BitXHub cert command [command options] [arguments...]
COMMANDS:
ca Generate ca cert and private key
csr Generate csr file
issue Issue certification by ca
parse parse certification
priv Generate and show private key for certificate
verify verify cert
子命令
bitxhub cert ca¶
生成根CA证书
bitxhub cert ca -h
NAME:
BitXHub cert ca - Generate ca cert and private key
USAGE:
BitXHub cert ca [arguments...]
bitxhub cert csr¶
生成CSR描述
key
: 指定私钥路径org
: 指定被签发人组织名称target
: 指定目标CSR路径
NAME:
BitXHub cert csr - Generate csr file
USAGE:
BitXHub cert csr [command options] [arguments...]
OPTIONS:
--key value Specify Secp256r1 private key path
--org value Specify organization name
--target value Specific target directory
bitxhub cert issue¶
证书签发
csr
: 指定CSR描述文件路径is_ca
: 指定签发人是否为CA证书key
: 指定当前签发人私钥路径cert
: 指定当前签发人证书路径target
: 指定生成的证书路径
NAME:
BitXHub cert issue - Issue certification by ca
USAGE:
BitXHub cert issue [command options] [arguments...]
OPTIONS:
--csr value Specify csr path
--is_ca value Specify whether it's ca
--key value Specify ca's secp256r1 private key path
--cert value Specify ca certification path
--target value Specific target directory
bitxhub cert parse¶
证书解析
path
: 指定证书路径
NAME:
BitXHub cert parse - parse certification
USAGE:
BitXHub cert parse [command options] [arguments...]
OPTIONS:
--path value certification path
bitxhub cert priv¶
NAME:
BitXHub cert priv - Generate and show private key for certificate
USAGE:
BitXHub cert priv command [command options] [arguments...]
COMMANDS:
gen Create new private key
pid Show pid from private key
bitxhub cert priv gen¶
私钥生成
NAME:
BitXHub cert priv gen - Create new private key
USAGE:
BitXHub cert priv gen [command options] [arguments...]
OPTIONS:
--name value Specific private key name
--target value Specific target directory
样例:
bitxhub cert priv gen --name server --target ./
server.priv key is generated under directory /Users/xxx/GolandProjectsTest/bitxhub-docs
bitxhub cert priv pid¶
获取libp2p节点pid
NAME: BitXHub cert priv pid - Show pid from private keyUSAGE: BitXHub cert priv pid [command options] [arguments...]OPTIONS: --path value Specific private key path
样例:
bitxhub client¶
功能
该命令bitxhub client
提供中继链节点的客户端操作命令。
它包含了账户信息查询、中继链信息、区块查询、节点网络信息、回执查询、交易操作、验证者集查询、删除共识节点、提案治理。
子命令信息如下:
bitxhub client
NAME:
BitXHub client - BitXHub client command
USAGE:
BitXHub client command [command options] [arguments...]
COMMANDS:
account Query account information
chain Query bitxhub chain info
block Query block
network Query network info from node
receipt Query receipt
tx Transaction manipulation
validators Query validator address
delVPNode delete a vp node
governance governance command
参数解释
gateway
: 指定客户端http服务地址,如果节点开启了TLS功能,则需要传递https地址;cert
: 指定节点的CA证书,如果节点开始了TLS功能,需要传递; 子命令
bitxhub client account¶
账户信息查询
bitxhub client account 0x79a1215469FaB6f9c63c1816b45183AD3624bE34
{
"type": "normal",
"balance": 100000000,
"contract_count": 0,
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
bitxhub client chain¶
中继链信息查询
NAME:
BitXHub client chain - Query bitxhub chain info
USAGE:
BitXHub client chain command [command options] [arguments...]
COMMANDS:
meta Query bitxhub chain meta
status Query bitxhub chain status
OPTIONS:
--help, -h show help
normal
: 已处在共识状态
bitxhub client chain meta
{"height":"1","block_hash":"0x0BF41c03bE038e389470dBdC9ed53DF897F178921520AF37877188d1759A7068"}
bitxhub client chain status
normal
bitxhub client block¶
区块信息查询 - 可指定区块号或区块Hash
bitxhub client block 1
{"block_header":{"number":"1","state_root":"0xC3A3B54F593e638D8a9FAbf66b781EFcb14D0f013D7c3E3a02ef698294f6BBF5"},"block_hash":"0x0BF41c03bE038e389470dBdC9ed53DF897F178921520AF37877188d1759A7068","signature":"74DK6FeGnAYBJ0pJ4bLwIaT9cp9YwIscenKsRc7myXUBQfvvLKhIpZqPJkf8tAI7V8u89SLOAdz94fo/ajKi+wA="}
bitxhub client network¶
全网节点信息
bitxhub client network
{
"1": {
"id": 1,
"pid": "QmXi58fp9ZczF3Z5iz1yXAez3Hy5NYo1R8STHWKEM9XnTL",
"account": "0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013",
"hosts": [
"/ip4/127.0.0.1/tcp/4001/p2p/"
]
},
"2": {
"id": 2,
"pid": "QmbmD1kzdsxRiawxu7bRrteDgW1ituXupR8GH6E2EUAHY4",
"account": "0x79a1215469FaB6f9c63c1816b45183AD3624bE34",
"hosts": [
"/ip4/127.0.0.1/tcp/4002/p2p/"
]
},
"3": {
"id": 3,
"pid": "QmQUcDYCtqbpn5Nhaw4FAGxQaSSNvdWfAFcpQT9SPiezbS",
"account": "0x97c8B516D19edBf575D72a172Af7F418BE498C37",
"hosts": [
"/ip4/127.0.0.1/tcp/4003/p2p/"
]
},
"4": {
"id": 4,
"pid": "QmQW3bFn8XX1t4W14Pmn37bPJUpUVBrBjnPuBZwPog3Qdy",
"account": "0xc0Ff2e0b3189132D815b8eb325bE17285AC898f8",
"hosts": [
"/ip4/127.0.0.1/tcp/4004/p2p/"
]
}
}
bitxhub client receipt¶
交易回执查询
bitxhub client receipt 0x08ab0E9175ae67Aed7a085D6813C156e4ED3b49cDf902e02280F6a62d7AaD61E
{
"tx_hash": "0x08ab0E9175ae67Aed7a085D6813C156e4ED3b49cDf902e02280F6a62d7AaD61E",
"ret": null,
"status": 0,
"events": []
}
bitxhub client tx¶
简单交易
交易发送
bitxhub client tx send --key scripts/build/node1/key.json --to 0x97c8B516D19edBf575D72a172Af7F418BE498C37 --amount 2 --type 0
{"tx_hash":"0x08ab0E9175ae67Aed7a085D6813C156e4ED3b49cDf902e02280F6a62d7AaD61E"}
bitxhub client tx get 0x08ab0E9175ae67Aed7a085D6813C156e4ED3b49cDf902e02280F6a62d7AaD61E
{"tx":{"from":"0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013","to":"0x97c8B516D19edBf575D72a172Af7F418BE498C37","timestamp":"1638168425560507000","transaction_hash":"0x08ab0E9175ae67Aed7a085D6813C156e4ED3b49cDf902e02280F6a62d7AaD61E","payload":"EAI=","nonce":"2","signature":"mdOdSzAOTDxfZ0VphvyDyir1lE8w31rUaSTtnj1us9NMhtUPVHz5bLcOBdZrmUfnaVhL3xGQxK3/P7WHmihxIQA="},"tx_meta":{"block_hash":"HoMgbS+NeCRds5Qc/58NfHXA+jVCuhUcsc7p9IvJxMc=","block_height":"3"}}
bitxhub client validators¶
全网验证人信息
bitxhub client validators
[
"0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013",
"0x79a1215469FaB6f9c63c1816b45183AD3624bE34",
"0x97c8B516D19edBf575D72a172Af7F418BE498C37",
"0xc0Ff2e0b3189132D815b8eb325bE17285AC898f8"
]
bitxhub client delVPNode¶
动态删除共识节点
NAME:
BitXHub client delVPNode - delete a vp node
USAGE:
BitXHub client delVPNode [command options] [arguments...]
OPTIONS:
--pid value pid of vp node
bitxhub client governance¶
提案治理命令
NAME:
BitXHub client governance - governance command
USAGE:
BitXHub client governance command [command options] [arguments...]
COMMANDS:
vote vote to a proposal
proposals query proposals based on the condition
chain appchain manage command
bitxhub client governance vote¶
提案投票
- 命令参数
- 样例
bitxhub client governance proposals¶
提案查询
- id: 提案id
- type: 提案类型,当前支持应用链管理
- status: 提案状态,是否通过
- from: 提案者地址
NAME: BitXHub client governance proposals - query proposals based on the condition USAGE: BitXHub client governance proposals [command options] [arguments...] OPTIONS: --id value proposal id --type value proposal type, currently only AppchainMgr is supported --status value proposal status, one of proposed, approve or reject --from value the address of the account to which the proposal was made
bitxhub client governance chain¶
应用链管理
status
:查询应用链状态freeze
:应用链冻结activate
:应用链激活