Hyperledger、区块链浏览器启动失败。无法连接到我的频道
Hyperledger, blockchain explorer launching fails. Can't connect to mychannel
通过使用这个 tutorial 我已经通过这个命令下载了 fabric 的文件:
sudo curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh| sudo bash -s
我添加了 sudo
,因为我的系统中的 docker 命令只能以这种方式工作。
之后,我进入目录 fabric-samples/test-network
并启动 fabric:
sudo ./network up
启动成功。然后我创建了频道:
sudo ./network createChannel
这给了我这个结果:
Channel 'mychannel' joined
之后我像这样上传了 asset-transfer-basic
的链码:
sudo ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
然后我创建了单独的文件夹 explorer
并使用了这些命令:
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain- explorer/main/examples/net1/config.json
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/examples/net1/connection-profile/test-network.json -P connection-profile
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/docker-compose.yaml
sudo cp -r ../fabric-samples/test-network/organizations/ .
把docker-compose.yaml
改成这样:
volumes:
- ./config.json:/opt/explorer/app/platform/fabric/config.json
- ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
- ./organizations:/tmp/crypto
- walletstore:/opt/explorer/wallet
然后 test-network.json
我将这些字段更改为:
"adminPrivateKey": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org1.example.com"],
"signedCert": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"
}
所有这一切之后,我通过命令启动它 sudo docker-compose up
我在资源管理器中得到了那种错误:
[2022-04-21T16:32:34.374] [INFO] FabricConfig - FabricConfig, this.config.channels mychannel
2022-04-21T16:32:34.630Z - error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:access denied
[2022-04-21T16:32:34.631] [ERROR] FabricClient - Error: DiscoveryService: mychannel error: access denied
at DiscoveryService.send (/opt/explorer/node_modules/fabric-common/lib/DiscoveryService.js:363:11)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async NetworkImpl._initializeInternalChannel (/opt/explorer/node_modules/fabric-network/lib/network.js:279:13)
at async NetworkImpl._initialize (/opt/explorer/node_modules/fabric-network/lib/network.js:231:9)
at async Gateway.getNetwork (/opt/explorer/node_modules/fabric-network/lib/gateway.js:330:9)
为什么访问被拒绝?我错过了什么吗?
我要回答我自己的问题。我希望它能帮助别人。这个问题的解决方法很简单(有点尴尬)
我需要在这部分设置适当的音量:
volumes:
- walletstore:/opt/explorer/wallet
应该是
volumes:
- /path/to/somewhere:/opt/explorer/wallet
无法连接到我的频道,因为它无法分配钱包文件。
通过使用这个 tutorial 我已经通过这个命令下载了 fabric 的文件:
sudo curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh| sudo bash -s
我添加了 sudo
,因为我的系统中的 docker 命令只能以这种方式工作。
之后,我进入目录 fabric-samples/test-network
并启动 fabric:
sudo ./network up
启动成功。然后我创建了频道:
sudo ./network createChannel
这给了我这个结果:
Channel 'mychannel' joined
之后我像这样上传了 asset-transfer-basic
的链码:
sudo ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
然后我创建了单独的文件夹 explorer
并使用了这些命令:
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain- explorer/main/examples/net1/config.json
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/examples/net1/connection-profile/test-network.json -P connection-profile
sudo wget https://raw.githubusercontent.com/hyperledger/blockchain-explorer/main/docker-compose.yaml
sudo cp -r ../fabric-samples/test-network/organizations/ .
把docker-compose.yaml
改成这样:
volumes:
- ./config.json:/opt/explorer/app/platform/fabric/config.json
- ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
- ./organizations:/tmp/crypto
- walletstore:/opt/explorer/wallet
然后 test-network.json
我将这些字段更改为:
"adminPrivateKey": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org1.example.com"],
"signedCert": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"
}
所有这一切之后,我通过命令启动它 sudo docker-compose up
我在资源管理器中得到了那种错误:
[2022-04-21T16:32:34.374] [INFO] FabricConfig - FabricConfig, this.config.channels mychannel
2022-04-21T16:32:34.630Z - error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:access denied
[2022-04-21T16:32:34.631] [ERROR] FabricClient - Error: DiscoveryService: mychannel error: access denied
at DiscoveryService.send (/opt/explorer/node_modules/fabric-common/lib/DiscoveryService.js:363:11)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async NetworkImpl._initializeInternalChannel (/opt/explorer/node_modules/fabric-network/lib/network.js:279:13)
at async NetworkImpl._initialize (/opt/explorer/node_modules/fabric-network/lib/network.js:231:9)
at async Gateway.getNetwork (/opt/explorer/node_modules/fabric-network/lib/gateway.js:330:9)
为什么访问被拒绝?我错过了什么吗?
我要回答我自己的问题。我希望它能帮助别人。这个问题的解决方法很简单(有点尴尬)
我需要在这部分设置适当的音量:
volumes:
- walletstore:/opt/explorer/wallet
应该是
volumes:
- /path/to/somewhere:/opt/explorer/wallet
无法连接到我的频道,因为它无法分配钱包文件。