Hyperledger Fabric常用命令总结
Peer
常用命令:
- 1
- 2
- 3
- 4
- 5
peer命令包含五个不同的自命令:
peer chaincode [option] [flags]
peer chaincode install [flags]
将指定的链代码打包到部署规范中,并将其保存到peer路径中。参数:
-c:JSON字串的链代码构造函数消息(默认”{}”)
-h:帮助
-l:编写chaincode的语言,默认”golang”
-n:chaincode名
-p:chaincode路径
-v:chaincode版本
-o:orderer节点
peer chaincode instantiate [flags]
-C:channel ID string
-c:JSON字串的链代码构造函数消息(默认”{}”)
-h:帮助
-l:编写chaincode的语言,默认”golang”
-n:chaincode名
-E: The name of the endorsement system chaincode to be used for this chaincode
-P:与此代码相关的认可政策
-o:orderer节点
实例
- 1
- 2
peer chaincode invoke
调用指定的链代码,它将尝试提交指定的事务到网络中
-C:channel ID string
-c:JSON字串的链代码构造函数消息(默认”{}”)
-h:help
-n:chaincode名字
-o:orderer节点
实例
- 1
peer chaincode list
如果指定通道,则在通道中获取实例化的链代码,或在peer节点上获取已安装的链代码
-C:
-h:
-o:
peer chaincode package
将指定的链代码打包到部署规范中
-s:create CC deployment spec for owner endorsements instead of raw CC deployment spec
-c:JSON字串的链代码构造函数消息(默认”{}”)
-h:help
-n:chaincode名字
-o:orderer节点
-i:为chaincode初始化协议
-l:chaincode编写语言,默认”golang”
-p:chaincode路径
peer chaincode query
Get endorsed result of chaincode function call and print it. It won’t generate transaction.
-C:channelID string
-c:JSON字串的链代码构造函数消息(默认”{}”)
-h:help
-n:chaincode名字
-r:如果为true,则将查询值输出为原始字节,否则格式化为可打印字符串
实例:
- 1
peer chaincode signpackage
Sign the specified chaincode package
-h
-o
peer chaincode upgrade
使用指定得chaincode替换现有得chaincode,新的chaincode将在提交事务时立即替换现有的chaincode
实例
- 1
- 2
- 3
peer channel [command]
peer channel create
创建一个通道,并将创世块写入文件
-c:channelID string
-f:事务文件的配置信息
-o,–orderer:orderer节点
例子:
- 1
- 2
- 3
peer channel fetch
获取指定得块,将其写入文件
例子
- 1
- 2
peer channel getinfo
获取指定频道得区块链信息,需要’-c’
例子:
- 1
peer channel join
将peer节点加入通道中
例子
- 1
peer channel list
加入通道的节点列表
- 1
peer channel signconfigtx
在文件系统上签署配置的更新文件,需要’-f’
peer channel update
签署并将提供的配置文件更新发送到通道中,需要’-f’,’-o’,’-c’
例子:
- 1
- 2
peer logging [option] [flags]
允许用户动态观察和配置peer的日志级别
peer logging getlevel
返回peer节点的日志级别
- 1
peer logging revertlevels
将日志记录级别还原为对等启动结束时的级别
- 1
peer logging setlevel
设置正则表达式匹配的所有模块的日志记录级别
- 1
peer node [option] [flags]
该命令用于启动一个peer node节点或者改变peer node节点的状态
peer node start
启动与网络交互的节点
例子:
- 1
peer node status
返回正在运行的node节点的状态
peer version [option] [flags]
该命令用于显示peer的版本号和版本信息等
configtxgen
该命令用来为用户创建与检查配置相关的工作
输出一个创世块
- 1
输出一个创建通道的tx
- 1
检查一个起源块
- 1
检查频道创建tx
- 1
打印一个组织定义
- 1
输出anchor peer tx
- 1
configtxlator
允许用户在protobuf和JSON版本的数据结构之间进行转换并创建配置更新,该命令也可以启动REST服务器,通过HTTP公开其功能
start
Start the configtxlator REST server
- 1
- 2
- 3
- 4
- 5
proto_encode
Converts a JSON document to protobuf
- 1
- 2
- 3
- 4
- 5
proto_decode
Converts a proto message to JSON
- 1
- 2
- 3
- 4
- 5
compute_update
采用两个封送的common.Config消息并计算在两者之间转换的配置更新
- 1
- 2
- 3
- 4
- 5
- 6
version
显示版本信息
- 1
- 2
cryptogen
用于生成Hyperledger Fabric密钥材料的实用程序
cryptogen help
用于生成Hyperledger Fabric密钥材料的工具
cryptogen generate
生成密钥程序
cryptogen showtemplate
显示默认的配置模板
cryptogen extend
扩展已存在的网络
例子
- 1
cryptogen version
显示版本信息

