kalleknast / Microgrid

Hyperledger network for microgrids
GNU General Public License v3.0
4 stars 1 forks source link

Join a peer to the channel #2

Closed kalleknast closed 5 years ago

kalleknast commented 5 years ago

Join peer0.house01.microgrid.org to the channel (I renamed it to hachannel)

docker exec -e "CORE_PEER_LOCALMSPID=House01MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp" peer0.house01.microgrid.org peer channel join -b hachannel.block

ERROR!

2018-09-25 22:32:58.573 UTC [main] InitCmd -> ERRO 001 Cannot run peer because cannot init crypto, folder "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp" does not exist

However, if I enter cli, I can cd to the folder, i.e.:

# works fine:
cd /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp

hachannel.bloc is located in peer/

root@6197168cb161:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls
channel-artifacts  crypto  hachannel.block
erickzzh commented 5 years ago

that is weird I am able to join the channel just fine. I haven't seem your join command before maybe its a new way to join but I used a diff version. Here are the two examples for House01's peers.

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp CORE_PEER_ADDRESS=peer0.house01.microgrid.org:7051 CORE_PEER_LOCALMSPID="House01MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/peers/peer0.house01.microgrid.org/tls/ca.crt peer channel join -b hachannel.block

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp CORE_PEER_ADDRESS=peer1.house01.microgrid.org:7051 CORE_PEER_LOCALMSPID="House01MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/peers/peer1.house01.microgrid.org/tls/ca.crt peer channel join -b hachannel.block

Is it because you didnt change the channel name on this line? https://github.com/kalleknast/Microgrid/blob/bdf03edf96561db7335f49e64d90a7df59fb2b42/configtx.yaml#L216

erickzzh commented 5 years ago

if you want to join the peers without entering the cli here is the command

docker exec -ti cli sh -c "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/users/Admin@house01.microgrid.org/msp CORE_PEER_ADDRESS=peer0.house01.microgrid.org:7051 CORE_PEER_LOCALMSPID="House01MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/house01.microgrid.org/peers/peer0.house01.microgrid.org/tls/ca.crt peer channel join -b hachannel.block
"
kalleknast commented 5 years ago

Thanks! Both ways work fine. I think I got my command from some tutorial, but I don't remember which.