hyperledger-labs / minifabric

Do fabric network the right and easy way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing vars/profiles/ folder for new organizations

alphacybercom opened this issue · comments

I've created a blockchain network composed of two different nodes A (primary) and B (secondary), on two different hosts.
I also have a nodejs client application which connects to A trough the vars/profiles/mychannel_connection_for_nodesdk.json connection profile file.
Nevertheless, I'd need to generate the equivalent profile on B, in order to deploy the nodejs application also on the secondary host B, connecting to the local blockchain node running in B.

I've seen that by using in B the same connection profile file available on A, the nodejs application on B successfully interacts with the blockchain. Nevertheless, as such file does not include any information on B (just includes A's endpoints), it is not possible to interact with the blockchain locally on B.

Hence, I suppose I have to either export B information in the vars/profiles/mychannel_connection_for_nodesdk.json connection profile file of A, or directly generate a connection profile in B. Right? In case, how can I do that?

you can import B node into A.

What do you mean? Do you mean that it's possible to export B's profile into A's profile file?
In case, how to do that?

please run just minifab to see all possible commands. you will see both export and import commands.

Here is the output of ./minifab.

Usage: 
  minifab <mode> [options]
    <mode> - one of operations or combination of operations separated by comma

      - 'up' - bring up the network and do all default channel and chaincode operations
      - 'netup' - bring up the network only
      - 'down' - tear down the network
      - 'restart' - restart the network
      - 'generate' - generate required certificates and genesis block
      - 'profilegen' - generate channel based profiles
      - 'install'  - install chaincode
      - 'approve'  - approve chaincode
      - 'instantiate'  - instantiate chaincode for fabric release < 2.0
      - 'initialize'  - initialize chaincode for fabric release >= 2.0
      - 'commit'  - commit chaincode for fabric releases greater or equal to 2.0
      - 'invoke'  - run chaincode invoke method
      - 'query'  - run chaincode query method
      - 'create'  - create application channel
      - 'join'  - join all peers currently in the network to a channel
      - 'blockquery'  - do channel block query and produce a channel tx json file
      - 'channelquery'  - do channel query and produce a channel configuration json file
      - 'channelsign'  - do channel config update signoff
      - 'channelupdate'  - do channel update with a given new channel configuration json file
      - 'anchorupdate'  - do channel update which makes all peer nodes anchors for the all orgs
      - 'nodeimport' - import external node certs and endpoints
      - 'discover' - discover channel endorsement policy
      - 'cleanup'  - remove all the nodes and cleanup runtime files
      - 'stats'  - list all nodes and status
      - 'explorerup'  - start up Hyperledger explorer
      - 'explorerdown'  - shutdown Hyperledger explorer
      - 'portainerup'  - start up portainer web management
      - 'portainerdown'  - shutdown portainer web management
      - 'ccup'  - update or force re-install chaincode as specified version (alias to install,approve,commit,instantiate/initialize).
      - 'apprun'  - (experimental) run chaincode app if there is any
      - 'caliperrun'  - (experimental) run caliper test
      - 'orgjoin'  - (experimental) join an org to the current channel
      - 'update'  - (experimental) update minifabric to the latest version

    options:
    -c|--channel-name         - channel name to use (defaults to "mychannel")
    -s|--database-type        - the database backend to use: goleveldb (default) or couchdb
    -l|--chaincode-language   - the language of the chaincode: go (default), node, or java
    -i|--fabric-release       - the fabric release to be used to launch the network (defaults to "2.1")
    -n|--chaincode-name       - chaincode name to be installed/instantiated/approved
    -b|--block-number         - block number to be queried
    -v|--chaincode-version    - chaincode version to be installed
    -p|--chaincode-parameters - chaincode instantiation and invocation parameters
    -t|--transient-parameters - chaincode instantiation and invocation transient parameters
    -r|--chaincode-private    - flag if chaincode processes private data, default is false
    -e|--expose-endpoints     - flag if node endpoints should be exposed, default is false
    -o|--organization         - organization to be used for org specific operations
    -y|--chaincode-policy     - chaincode policy
    -d|--init-required        - chaincode initialization flag, default is true
    -f|--run-output           - minifabric run time output callback, can be 'minifab'(default), 'default', 'dense'
    -h|--help                 - print this message

As you can see, no import/export commands are returned.

Solved by running minifab profilegen on B. In this way, (local) connection profile files are generated on B.

I've noticed that, although minifab profilegen was executed on B, as reported above, without errors, my NodeJS application can't successfully execute queries on the blockchain and, for each query I execute/invocation I make, an error like the following one is returned.

{ TypeError: Cannot read property 'status' of undefined
    at Transaction.submit ($MYFOLDER/node_modules/fabric-network/lib/transaction.js:252:32)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  responses:
   [ { version: 1,
       timestamp: null,
       response: [Object],
       payload:
        <Buffer 0a [cut] ... >,
       endorsement: [Object],
       connection: [Object],
       peer: 'peer1.org2.mydomain.com' },
     { version: 1,
       timestamp: null,
       response: [Object],
       payload:
        <Buffer 0a [cut] ... >,
       endorsement: [Object],
       connection: [Object],
       peer: 'peer2.org2.mydomain.com' } ],
  errors: [] }

The same NodeJS code (linking to a different connection profile plus a different wallet file) works on A.