Hyperledger Explorer with Fabric v2.4.2 enable to find other peer

181 Views Asked by At

I try to use two connection-profile to setup the explorer. But I find there is always only 1 nodes, and in the "NETWORK" can only find orderer and the network I loggin. Here's the file I config.

only one peer

I use docker logs and find

[ERROR] FabricClient - Error: DiscoveryService has failed to return results
  at DiscoveryService.send (/opt/explorer/node_modules/fabric-common/lib/DiscoveryService.js:370:10)
  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)

config.json

{
"network-configs": {
    "org1-network": {
        "name": "org1-Network",
        "profile": "./connection-profile/org1-network.json"
    },
    "org2-network": {
        "name": "org2-Network",
        "profile": "./connection-profile/org2-network.json"
    }
},
"license": "Apache-2.0"

}

org1-network.json

{
"name": "org1-network",
"version": "1.0.0",
"client": {
    "tlsEnable": true,
    "adminCredential": {
        "id": "exploreradmin1",
        "password": "exploreradminpw"
    },
    "enableAuthentication": true,
    "organization": "Org1MSP",
    "connection": {
        "timeout": {
            "peer": {
                "endorser": "300"
            },
            "orderer": "300"
        }
    }
},
"channels": {
    "mychannel": {
        "peers": {
            "peer0.org1.example.com": {}
        }
    }
},
"organizations": {
    "Org1MSP": {
        "mspid": "Org1MSP",
        "adminPrivateKey": {
            "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk"
        },
        "peers": ["peer0.org1.example.com"],
        "signedCert": {
            "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]"
        }
    }
},
"peers": {
    "peer0.org1.example.com": {
        "tlsCACerts": {
            "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
        },
        "url": "grpcs://peer0.org1.example.com:7051"
    }
}

}

org2-network.json

{
"name": "org2-network",
"version": "1.0.0",
"client": {
    "tlsEnable": true,
    "adminCredential": {
        "id": "exploreradmin2",
        "password": "exploreradminpw"
    },
    "enableAuthentication": true,
    "organization": "Org2MSP",
    "connection": {
        "timeout": {
            "peer": {
                "endorser": "300"
            },
            "orderer": "300"
        }
    }
},
"channels": {
    "mychannel": {
        "peers": {
            "peer0.org2.example.com": {}
        }
    }
},
"organizations": {
    "Org2MSP": {
        "mspid": "Org2MSP",
        "adminPrivateKey": {
            "path": "/tmp/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore/priv_sk"
        },
        "peers": ["peer0.org2.example.com"],
        "signedCert": {
            "path": "/tmp/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected]"
        }
    }
},
"peers": {
    "peer0.org2.example.com": {
        "tlsCACerts": {
            "path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
        },
        "url": "grpcs://peer0.org2.example.com:9051"
    }
}

}

docker-compose.yaml

docker-compose.yaml

1

There are 1 best solutions below

0
On

As you are using Org1 and Org2, I assume that you have used the existing tutorial scripts to create your network. However, if you want to have two separate networks running side by side, you will have to start a new network under a new folder - this is just so that you can make changes without getting confused.

Running two networks means that you have to start again with your scripts and change everything, e.g. conflicting names, port numbers, etc. If you want Org2 to belong to org2-network, then you should ensure that no other peers are defined along the way e.g. docker files, config files, etc. Your Org2 will need a separate Orderer running on a different port.

Try to get one network running first, then try building the second one while the first is running. If you get no errors, then you will eventually have two separate networks running. After that, you should be able to point to them in your config file as long as you are using the correct connection profile settings for each network.