hyperledger / fabric-samples

Samples for Hyperledger Fabric
https://wiki.hyperledger.org/display/fabric
Apache License 2.0
2.81k stars 3.4k forks source link

Channel:mychannel received discovery error:access denied #1174

Open Seungzuu opened 10 months ago

Seungzuu commented 10 months ago
  1. I succeeded in operating the test-network provided by hyperledger fabric v2.2 itself. 1) Chaincode installation complete

    • ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript -ccl javascript

    2) Setting environment variables

    • export CORE_PEER_TLS_ENABLED=true
    • export CORE_PEER_LOCALMSPID="Org1MSP"
    • export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
    • export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
    • export CORE_PEER_ADDRESS=localhost:7051

    2) Chaincode (Invoke) InitLedger function execution

    • peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}'

    3) Execute chaincode (query) GetAllAssets function

    • It returned as follows.
    • [{"Key":"asset1","Record":{"ID":"asset1","Color":"blue","Size":5,"Owner":"Tomoko","AppraisedValue":300,"docType":"asset"}},{"Key":"asset2","Record":{"ID":"asset2","Color":"red","Size":5,"Owner":"Brad","AppraisedValue":400,"docType":"asset"}},{"Key":"asset3","Record":{"ID":"asset3","Color":"green","Size":10,"Owner":"Jin Soo","AppraisedValue":500,"docType":"asset"}},{"Key":"asset4","Record":{"ID":"asset4","Color":"yellow","Size":10,"Owner":"Max","AppraisedValue":600,"docType":"asset"}},{"Key":"asset5","Record":{"ID":"asset5","Color":"black","Size":15,"Owner":"Adriana","AppraisedValue":700,"docType":"asset"}},{"Key":"asset6","Record":{"ID":"asset6","Color":"white","Size":15,"Owner":"Michel","AppraisedValue":800,"docType":"asset"}}]
  2. Trying to access fabric-network using nodejs SDK 1) cd fabric-samples/test-network/docker

    2) Execute command => COMPOSE_PROJECT_NAME=fabric-test docker-compose -f docker-compose-ca.yaml up -d

    3) There are currently 9 containers in operation.

    • ca.org1
    • ca.org2
    • ca.orderer
    • orderer.example.com
    • peer0.org1.example.com
    • peer0.org2.example.com
    • dev-peer0.org1.example.com-basic_1.0
    • dev-peer0.org2.example.com-basic_1.0
    • cli

    4) cd fabric-sample/fabcar/javascript

    5) Execute command => node enrollAdmin.js, node registerUser.js

    • admin.id and appUser.id files were created in the wallet directory.

    6) An error occurred when running node query.js (the error details are written below.)

    • 2024-01-24T00:45:41.065Z - error: [DiscoveryResultsProcessor]: parseDiscoveryResults[mychannel] - Channel:mychannel received discovery error:access denied
    • Failed to evaluate transaction: Error: DiscoveryService: mychannel error: access denied
    • Below is the log of the org1 container (docker logs peer0.or1.example.com)
    • [discovery] processQuery -> WARN 0e2 got query for channel mychannel from 172.18.0.1:59762 but it isn't eligible: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied
  3. The same error occurs with hyperledger fabric v2.5, and the same error occurs even if you change the Ubuntu version. I'm curious what causes this problem. I'm also curious about the solution to this problem. I am waiting for your reply. please help me

Seungzuu commented 10 months ago

please help.....please