0

Help me please! I ran my hyperledger fabric network with:

  1. org0
  • orderer1-org0
  • peer1-org0
  • peer2-org0
  1. org1
  • peer1-org1
  • peer2-org1
  1. org2
  • peer1-org2
  • peer2-org2

My connection profile:

name: "Network"
version: "1.0"

channels:
  mychannel:
    orderers:
      - orderer1-org0
    peers:
      peer1-org0:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer2-org0:
        endorsingPeer: false
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer1-org1:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer2-org1:
        endorsingPeer: false
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer1-org2:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer2-org2:
        endorsingPeer: false
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true

organizations:
  org0: 
    mspid: org0MSP
    cryptoPath: path/org0/msp
    orderers:
      - orderer1-org0
    peers:
      - peer1-org0
      - peer2-org0
    certificateAuthorities:
      - rca-org1
    
  org1:
    mspid: org1MSP
    cryptoPath: path/org1/msp
    peers:
      - peer1-org1
      - peer2-org1
    certificateAuthorities:
      - rca-org1
   
  org2:
    mspid: org2MSP
    cryptoPath: path/org2/msp
    peers:
      - peer1-org2
      - peer2-org2
    certificateAuthorities:
      - rca-org1
    
orderers:
  orderer1-org0:
    url: grpc://XXXX:7050
    
peers:
  peer1-org0:
    url: grpc://XXXX:11051

  peer2-org0:
    url: grpc://XXXX:12051

  peer1-org1:
    url: grpc://XXXX:7051

  peer2-org1:
    url: grpc://XXXX:8051

  peer1-org2:
    url: grpc://XXXX:9051

  peer2-org2:
    url: grpc://XXXX:10051


certificateAuthorities:

  rca-org1:
    url: http://XXXX:7054
    httpOptions:
      verify: false
    registrar:
      - enrollId: XXXX
        enrollSecret: XXXX
    caName: rca-org1
  

My Node.js app:

async function getClientID(label) {
    let wallet = await Wallets.newCouchDBWallet("http://XXXX:5984");
    let user = await wallet.get(label);

    // connection profile
    let connectionProfile = yaml.safeLoad(readFileSync('path/to/config.yaml', 'utf-8'));
    // create new gateway
    let gateway = new Gateway();
    await gateway.connect(connectionProfile, {
        wallet,
        identity: label,
        gatewayDiscovery: { enabled: true, asLocalhost: true }
    });

    // get the network (channel) our contract is deployed to
    let network = await gateway.getNetwork('mychannel');

    if (network) {
        let tokenERC20Contract = network.getContract('token-erc-20');
        let clientID = await tokenERC20Contract.evaluateTransaction('ClientAccountID');
        console.log(`clientID for ${label}: `, clientID.toString('ascii'));
    }
}

I register some users and put their identities into the couchdb wallet successfully. Now I want to get client id from my network. I get this id successfully, but before I receive many error logs:

2022-09-28T12:42:25.128Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2-org0, url:grpc://XXXX:12051, connected:false, connectAttempted:true
2022-09-28T12:42:25.129Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2-org0 url:grpc://XXXX:12051 timeout:3000
2022-09-28T12:42:25.132Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2-org0 due to Error: Failed to connect before the deadline on Endorser- name: peer2-org0, url:grpc://XXXX:12051, connected:false, connectAttempted:true
Ivan
  • 303
  • 3
  • 13

0 Answers0