本文参考:Hyperledger Fabric系列之四:2.2.1部署-执行peer命令-Centos7 | 林栖云-微服务架构 的 低代码开发平台Fabric 低代码 微服务 林栖云 区块链http://www.linxyun.com/blog/article/7
1.设置环境变量:
export CORE_PEER_TLS_ENABLED=true
export PATH=/opt/workspace/gowork/hyperledger/fabric/scripts/fabric-samples/bin:$PATH
export FABRIC_CFG_PATH=/opt/workspace/gowork/hyperledger/fabric/scripts/fabric-samples/config/
export CORE_PEER_LOCALMSPID=Org1MSP
# export CORE_PEER_TLS_ROOTCERT_FILE=/opt/workspace/gowork/hyperledger/fabric/scripts/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/tls/ca.crt
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/workspace/gowork/hyperledger/fabric/scripts/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=/opt/workspace/gowork/hyperledger/fabric/scripts/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
# export CORE_PEER_ADDRESS=org1.example.com:7051
export CORE_PEER_ADDRESS=localhost:7051
这里设置的环境变量是指向org1的peer节点。
1.1查看当前peer节点的通道列表
peer channel list
--cafile // TLS证书的绝对路径
--orderer // 指定order节点
--tls // 使用TLS通信
1.2在当前节点创建通道:
peer channel create -c mychannel --orderer orderer.example.com:7050 -f \ ./createchannel.txn -t 30
1.3从order节点获取交易区块
peer channel fetch [flags]
newest: 最新交易的块
oldest :最早交易的块
config:最新的配置交易的块
block number:指定区块的号码
1.4加入通道
peer channel join
需要指定通道配置区块
1.5查看指定通道区块链的令牌
peer channel getinfo
1.6对交易通道签名
peer channel signconfigtx
1.7更新通道
peer channel update -c mychannel -f ./updatechannel.txn -o orderer.example.com:7050
2.碰到的问题及解决方案:
2.1执行peer命令报如下错:Error: error getting endorser client for channel: endorser client failed to connect to org1.example.com:7051: failed to create new connection: context deadline exceeded
环境变量缺失:
a.export CORE_PEER_TLS_ENABLED=true
b.环境变量配置错误:证书存放目录配置不正确。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)