airvin / fabric-dynamic-network

Hyperledger Fabric network with bash scripts to automate dynamically creating a new organisation and adding to a new consortium definition.
8 stars 8 forks source link

channel create error #1

Open b-rohit opened 5 years ago

b-rohit commented 5 years ago

I encountered problem while starting the network. Creating the channel 'channel1' 2019-11-07 10:17:32.217 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'channel1', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied

airvin commented 5 years ago

Hi @b-rohit, Can you give me a little more information? I assume this is when you are running the 2-start.sh script? If you run docker ps -a after running that script does it show all of the container statuses as "Up" or have any of them exited?

b-rohit commented 5 years ago

yes, it happened when I ran the 2-start.sh script. all docker containers were up and running. these are the logs from the script.

`Digest: sha256:c467d1c2a172bf0c8172b2e1c760686d0c7656d786e6874a9de12f2d0a3a38e7
Status: Downloaded newer image for couchdb:2.1.1
Creating orderer.example.com ... done
Creating couchdb1            ... done
Creating ca.org1.example.com ... done
Creating cliOrderer             ... done
Creating peer0.org1.example.com ... done
Creating cli1                   ... done
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                  PORTS                                            NAMES
20ddc1db1f6a        hyperledger/fabric-tools     "/bin/bash"              2 seconds ago       Up Less than a second                                                    cli1
17542e178446        hyperledger/fabric-peer      "peer node start"        4 seconds ago       Up 1 second             0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.example.com
80b6f8077d49        hyperledger/fabric-tools     "/bin/bash"              5 seconds ago       Up 2 seconds                                                             cliOrderer
dd5d4a9f9fc1        couchdb:2.1.1                "tini -- /docker-ent…"   8 seconds ago       Up 3 seconds            4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp       couchdb1
e726fc9c98e5        hyperledger/fabric-ca        "sh -c 'fabric-ca-se…"   8 seconds ago       Up 5 seconds            0.0.0.0:7054->7054/tcp                           ca.org1.example.com
bb491a3ebfb3        hyperledger/fabric-orderer   "orderer"                8 seconds ago       Up 4 seconds            0.0.0.0:7050->7050/tcp                           orderer.example.com
Sleep for 10s to allow Fabric network to start
Creating the channel 'channel1'
2019-11-08 09:36:21.623 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'channel1', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied
Joining peer0.org1 to channel1
2019-11-08 09:36:22.060 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: genesis block file not found open channel1.block: no such file or directory
Check that peer0.org1 was able to join channel1
2019-11-08 09:36:22.535 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Channels peers has joined: 

` I could share you the logs of specific container if you want.

b-rohit commented 5 years ago

I see there are multiple differences between your git repository code and blog post for instance you update application channel here not system channel. Here the code is similar to adding new org to existing channel.

airvin commented 5 years ago

@b-rohit can you check that the peers are running Fabric version 1.4.x? Use docker exec -it peer0.org1.example.com bash and then peer version to find the version number. I am using version 1.4.3: image There were some changes to the channel capabilities in v1.4 that mean that specifying policies the way they are in the configtx.yaml isn't backwards compatible. The other thing I can suggest is removing all of the policies definitions from the configtx.yaml file and trying again.

You are right that script 4-add-org-to-channel.sh updates the application channel by adding a new org to an existing channel. Script 5-add-org-to-consortium then shows how to update the ordering service channel with a new consortium definition. This was the script that was stepped through in my blog post.

Is there anything else specific that you have found that is different between this repo and the blog post?

b-rohit commented 5 years ago

I am also using the same version.

root@0f025a69e2f4:/opt/gopath/src/github.com/hyperledger/fabric# peer version
peer:
 Version: 1.4.3
 Commit SHA: b8c4a6a
 Go version: go1.11.5
 OS/Arch: linux/amd64
 Chaincode:
  Base Image Version: 0.4.15
  Base Docker Namespace: hyperledger
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger

Still it doesn't work. 2-start.sh fails while creating the channel. I see that you use couchdb image instead of fabric-couchdb .

airvin commented 5 years ago

Could you try replacing the configtx.yaml with the following? And run the 7-stop, 8-teardown and 1-generate scripts before you try the start script again.

Organizations:
  - &OrdererOrg
    Name: OrdererOrg
    ID: OrdererMSP
    MSPDir: crypto-config/ordererOrganizations/example.com/msp

  - &Org1
    Name: Org1MSP
    ID: Org1MSP
    MSPDir: crypto-config/peerOrganizations/org1.example.com/msp

Orderer: &OrdererDefaults
  OrdererType: solo
  Addresses:
    - orderer.example.com:7050
  BatchTimeout: 2s
  BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB
  Kafka:
    Brokers:
      - 127.0.0.1:9092
  Organizations:

Profiles:
  OneOrgOrdererGenesis:
    Orderer:
      <<: *OrdererDefaults
      Organizations:
        - *OrdererOrg
    Consortiums:
      SampleConsortium1:
        Organizations:
          - *Org1
  Org1Channel:
    Consortium: SampleConsortium1
    Application:
      Organizations:
        - *Org1

Other than that, I'm running out of things to suggest. I know that Fabric can be very difficult to debug sometimes, which can be very frustrating.

I used the couchdb:2.1.1 image because that worked with both Fabric 1.4 and Fabric 1.3 that a colleague of mine was using. You could also try changing the image to hyperledger/fabric-couchdb in the docker-compose.yaml and the org2-docker-compose.yaml. But if the peer container is not crashing, I don't think that that will be the issue.

GuillaumeCisco commented 4 years ago

I got the same error with 1.4.3 or 1.4.4

Iremoved EnableNodeOUs: true in crypto-config.yaml for correctly creating the channel1 in 2-start.sh.

I had to to the same thing with the org2-artifacts folder for 6-create-new-channel.sh to run.

No need to remove policies.

It looks like with the EnableNodeOUs parameter, the admin sign cert passed for crating the channel is not recognized as an admin when trying to create the channel. Is there something we are missing there?

Are you be able you reproduce the issue?

airvin commented 4 years ago

Thanks for the feedback @GuillaumeCisco. I still wasn't able to reproduce the issue but seeing as removing the EnableNodeOUs flag worked for you, I've pushed those changes to the crypto-config.yaml files. Hopefully that should prevent the error for others in future!