hyperledger-labs / minifabric

Do fabric network the right and easy way.
Apache License 2.0
301 stars 166 forks source link

Problem on joining another organization #81

Closed alirezaght closed 3 years ago

alirezaght commented 3 years ago

First I wanted to thank you for this great tool. I think this is a must have tool if you wanna use hyperledger fabric. I have two servers. one of them has following spec:

fabric:
  cas:
  - "ca.n1.h.com"
  peers: 
  - "i1.n1.h.com"
  - "i2.n1.h.com"
  orderers:
  - "o1.h.com"
  settings:
    ca:
      FABRIC_LOGGING_SPEC: INFO
    peer:
      FABRIC_LOGGING_SPEC: INFO
    orderer:
      FABRIC_LOGGING_SPEC: INFO

and the other one has this spec:

fabric:
  cas:
  - "ca.n2.h.com"
  peers: 
  - "i1.n2.h.com"
  - "i2.n2.h.com"
  orderers:
  - "o2.h.com"
  settings:
    ca:
      FABRIC_LOGGING_SPEC: INFO
    peer:
      FABRIC_LOGGING_SPEC: INFO
    orderer:
      FABRIC_LOGGING_SPEC: INFO

on server 1 I tried these commands:

minifab netup -c hchannel -e true -o n1.h.com -s couchdb

after evereything is up:

minifab create,join,anchorupdate,profilegen,channelquery

on server 2:

minifab netup -c hchannel -e true -o n2.h.com -s couchdb

then I wanted to join server 2 network to the first one. so I copied vars/profiles/endpoints.yaml to server 2. then on server 2 I did minifab nodeimport then on server 1 I edited vars/hchannel_config.json file and copied the contents of vars/JoinRequest_n2-h-com.json to the groups element and I increase the version of the groups element. then I did minifab channelsign,channelupdate on server 1

I did see this line on one of the peers log on server 1. learnAnchorPeers -> INFO 041 No configured anchor peers of n2-h-com for channel hchannel to learn about so I think everything is good by now. but these 2 organizations are not correctly joined to the hchannel. when I tried running minifab channelquery on server 2 I get an empty file for hchannel_config.json and I think it should not be empty. Can you please help what I'm doing wrong? And I have another question. I tried to change the Endorsement policy after this, so I changed the rule from MAJORITY to ANY but after running minifab channelsign,channelupdate on server 1 I get following error:

 2020-09-24 22:36:01.566 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
  Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'hchannel': error authorizing update: error validating DeltaSet: policy for [Policy] /Channel/Application/Endorsement not satisfied: implicit policy evaluation failed - 1 sub-policies were satisfied, but this policy requires 2 of the 'Admins' sub-policies to be satisfied
alirezaght commented 3 years ago

And if I do minifab join on server 2 I get following error: 2020-09-24 22:48:21.290 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized 2020-09-24 22:48:21.296 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND} Error: can't read the block: &{NOT_FOUND} 2020-09-24 22:48:21.411 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized Error: genesis block file not found open /vars/hchannel.genesis.block: no such file or directory

litong01 commented 3 years ago

With your spec files, you need to first to add orderers to your orderer system by changing the channel configuration, then you need to add new orgs to the network, it is rather complex. I suggest that you first stand up orderers on one machine with one peer org, then you can set up 2nd org with its peers on 2nd machine. Then add 2nd to the first machine. Try to figure out this process first and get a good understanding of the system.

litong01 commented 3 years ago

You will also need to import orderer nodes onto 2nd machine, then use discovery services to get all the channel info.

alirezaght commented 3 years ago

Thank you for your reply, It would be great if you provide a document or a video for this tool to add a new orderer to an existing network, because I can add peers but when I try adding an orderer I run into so many problems and documents on fabric are so confusing and complex.

litong01 commented 3 years ago

Please read docs/README.md and there are 6 videos for the tool, video 3 should be the video to add new org and also see the doc under docs directory specifically on adding new org.