Добавить новую организацию в существующий консорциум? Hyperledger Fabric - PullRequest
1 голос
/ 30 октября 2019

Существует 3 организации: Org1, Org2 и Org3.
Org1 и Org2 создали консорциум с именем SampleConsortium

Теперь я хочу добавить Org3 к SampleConsortium. Канал еще не создан.

В документации есть руководство по добавлению организации в существующий канал. Я хочу, чтобы орг присоединился к консорциуму, а не к каналу.

Как я могу это сделать? Пожалуйста, добавьте ресурсы, которые будут очень полезны.

Спасибо!

Ответы [ 2 ]

1 голос
/ 30 октября 2019

Я написал скрипт для добавления / удаления org в консорциум и добавления / удаления org в канал.

## Make sure network is up
## Make sure certificates are generated using cryptogen
## Make sure you are executing this script in cli
## docker exec -it cli bash

export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export CHANNEL_NAME=byfn-sys-channel

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp
CORE_PEER_ADDRESS=orderer.example.com:7050
CORE_PEER_LOCALMSPID=OrdererMSP
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt


peer channel fetch config config_block.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA

configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json

#### Add Org into Consortium ######
jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups": {"SampleConsortium": {"groups": {"Org3MSP":.[1]}}}}}}}' config.json ./channel-artifacts/org3.json > modified_config.json

#### Delete Org from Consortium ######
 cat config.json | jq "del(.channel_group.groups.Consortiums.groups.SampleConsortium.groups.Org3MSP)" > modified_config.json

#### Add Organization to channel #####
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./channel-artifacts/org3.json > modified_config.json

#### Delete Oraganization from channel ####
jq 'del(.channel_group.groups.Application.groups.Org3MSP)' config.json > modified_config.json


configtxlator proto_encode --input config.json --type common.Config --output config.pb

configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb

configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output org3_update.pb

configtxlator proto_decode --input org3_update.pb --type common.ConfigUpdate | jq . > org3_update.json

echo '{"payload":{"header":{"channel_header":{"channel_id":"byfn-sys-channel", "type":2}},"data":{"config_update":'$(cat org3_update.json)'}}}' | jq . > org3_update_in_envelope.json

configtxlator proto_encode --input org3_update_in_envelope.json --type common.Envelope --output org3_update_in_envelope.pb


peer channel signconfigtx -f org3_update_in_envelope.pb

peer channel update -f org3_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA
0 голосов
/ 15 ноября 2019

Спасибо @ alexander за эту ссылку на учебник .

Учебное пособие написано Эллисон Ирвин

Обновление определения консорциума в Hyperledger Fabric

Ответ на этот вопрос:

Мы должны обновить блок системного генезиса, чтобы добавить новую организацию в консорциум. Тогда только новая организация может создать канал.

Введение в учебное пособие:
Создание каналов контролируется членами Консорциума, которые состоят из одной или нескольких организаций, определенных на уровне сети. По мере развития и роста сетей Fabric ожидается, что список организаций, которым требуется возможность создавать каналы, изменится. Поэтому нам нужна возможность добавлять или изменять определения Консорциума без прерывания работы любого из компонентов сети.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...