在超级账本结构中创建通道时出错

时间:2021-07-12 15:39:21

标签: docker-compose hyperledger-fabric blockchain hyperledger peer

hyperledger fabric 版本使用 v2.3.2 当我创建频道时,运行命令后出现此错误: 错误:获得意外状态:禁止 - 现有频道的配置更新未通过初始检查:隐式策略评估失败 - 满足 0 个子策略,但此策略需要 1 个“编写器”子策略满意:权限被拒绝

命令:

./scripts/start.sh

错误:

Error: got unexpected status: FORBIDDEN -- config update for existing channel did not pass initial checks: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied: permission denied

start.sh 文件

#!/bin/bash

echo "Creating containers... "
docker-compose -f docker-compose-cli.yaml up -d
echo 
echo "Containers started" 
echo 
docker ps

echo
#Creating channel and join mn
docker exec -it cli ./scripts/channel/createChannel.sh

createChannel.sh 文件

#!/bin/bash

echo "Creating channel..."
ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/myapp.com/orderers/orderer.myapp.com/msp/tlscacerts/tlsca.myapp.com-cert.pem
CORE_PEER_LOCALMSPID=MnMSP
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/mn.myapp.com/peers/peer0.mn.myapp.com/tls/ca.crt
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/mn.myapp.com/users/Admin@mn.myapp.com/msp
CORE_PEER_ADDRESS=peer0.mn.myapp.com:7051
CHANNEL_NAME=mychannel
CORE_PEER_TLS_ENABLED=true
ORDERER_SYSCHAN_ID=syschain

peer channel create -o orderer.myapp.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/mychannel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA 

echo 
echo "Channel created, joining Mn..."
peer channel join -b mychannel.block

configtx.yaml 文件

Organizations:
    - &OrdererOrg
        Name: OrdererOrg
        ID: OrdererMSP
        MSPDir: crypto-config/ordererOrganizations/myapp.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"

    - &Mn
        Name: MnMSP
        ID: MnMSP
        MSPDir: crypto-config/peerOrganizations/mn.myapp.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('MnMSP.admin', 'MnMSP.peer', 'MnMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('MnMSP.admin', 'MnMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('MnMSP.admin')"

Capabilities:
    Channel: &ChannelCapabilities
        V2_0: true
    Orderer: &OrdererCapabilities
        V2_0: true
    Application: &ApplicationCapabilities
        V2_0: true

Application: &ApplicationDefaults
    Organizations:
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ApplicationCapabilities

Orderer: &OrdererDefaults
    OrdererType: solo
    Addresses:
        - orderer.myapp.com:7050
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 10
        AbsoluteMaxBytes: 99 MB
        PreferredMaxBytes: 512 KB

    Kafka:
        Brokers:
            - 127.0.0.1:9092

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

Channel: &ChannelDefaults
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
    Capabilities:
        <<: *ChannelCapabilities

Profiles:

    MnOrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Mn
    MnChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Mn
            Capabilities:
                <<: *ApplicationCapabilities

0 个答案:

没有答案
相关问题