Setting up a Blockchain Business Network With Hyperledger Fabric & Composer Running in Multiple Physical Machine


(Baitanik Talukder) #22

Hi,
Thanks for reply .
From the following urls , I downloaded the files

https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz

https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip


(Varun Raj) #23

Yeah that’s why. Please use the files that I mentioned in my article.


(Baitanik Talukder) #24

Thanks… Got the the peer2 files …

Right now I am facing another issue . I was getting connection refused error .
connection error: desc = "transport: Error while dialing dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"; Reconnecting to {orderer.example.com:7050 <nil>} Error: Error connecting due to rpc error: code = Unavailable desc = grpc: the connection is unavailable

Although I had put the ipaddess in /etc/hosts file and was getting reply in ping.
10.148.0.2 orderer.example.com

blockchain@blockchain2:~/go/fabric-dev-servers-multipeer$ ping orderer.example.com PING orderer.example.com (10.148.0.2) 56(84) bytes of data. 64 bytes from orderer.example.com (10.148.0.2): icmp_seq=1 ttl=64 time=1.31 ms 64 bytes from orderer.example.com (10.148.0.2): icmp_seq=2 ttl=64 time=0.237 ms 64 bytes from orderer.example.com (10.148.0.2): icmp_seq=3 ttl=64 time=0.290 ms

===== Then I changed the config fetch command in host2 with IP address . and as you have already mentioned in earlier questions , i have changed the configtx.yaml.

Addresses: - orderer.example.com:7050

to

Addresses: - 10.148.0.2:7050
and regenerate the crypto-configs

But still I am getting FORBIDDEN error in host2

2018-02-04 10:59:30.041 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 02681A518D7A3ACFB6679BF9E40855AD40A6205DED9B1EEAEBD14D52636606B2 2018-02-04 10:59:30.045 UTC [channelCmd] readBlock -> DEBU 00a Got status: &{FORBIDDEN} Error: can't read the block: &{FORBIDDEN}

Kindly help please .


(Baitanik Talukder) #25

Okay… got it… we have to copy the generated crypto-config folder to the host2 …
then run the startFabric-Peer2.sh …

Thanks for all the help …
will try to deploy chaincode and make transaction.

Do you have any blog or document for instantiating and running chaincode in this architecture ( orderer,peer0,peer11 – host 1 , and peer2 – host2) … ?

Then it will be helpful …


(Baitanik Talukder) #26

Hello,

Thanks for this awesome article … I was able to successfully create the network .
from host2 machine i got success logs.

docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel join -b composerchannel_config.block
2018-02-04 11:52:31.527 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-04 11:52:31.527 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-04 11:52:31.529 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-04 11:52:31.530 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A86070A5C08011A0C08FFE7DBD30510...5CFCF75DB5F21A080A000A000A000A00
2018-02-04 11:52:31.530 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 9F70F149830008EA7A08296701DC11DE87ADF503A6998EA424C9C9C2753094D3
2018-02-04 11:52:31.667 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2018-02-04 11:52:31.667 UTC [main] main -> INFO 007 Exiting.....

right now I am trying to deploy a sample chancode from host1 …

peer chaincode deploy -l java -n map -p /home/blockchain/go/fabric/examples/chaincode/java/chaincode_example02 -c '{"Function": "init", "Args": ["a","100", "b", "200"]}'`

This /home/blockchain/go/fabric/examples/chaincode/java/chaincode_example02 location is my host1 physical location ,where the sample chaincode is present …
But I am getting error

panic: Fatal error when initializing core config : Error when reading core config file: Unsupported Config Type ""
goroutine 1 [running]:
panic(0xbb4de0, 0xc4201c6470)
        /opt/go/go1.7.5.linux.amd64/src/runtime/panic.go:500 +0x1a1
main.main()
        /w/workspace/fabric-binaries-x86_64/gopath/src/github.com/hyperledger/fabric/peer/main.go:94 +0x852 .. 

Kindly please help me out…
How to deploy a chaincode with the network we have built.


(Pichayuth Kittisriswai) #27

thank you for replying @karthik

I took the code from Github that provide in this tutorial https://hyperledger.github.io/composer/installing/development-tools

On each server(separate server) btw, I have 2 org(2 servers), I have this code set up.
I start the services include orderer on org1 and I was trying to connect org2 to the network with org1 by using “channel fetch” to orderer org1


(Pichayuth Kittisriswai) #28

thank you for replying @varun

you mean i have to define all of the org i want in a crypto-config and generate all of them at the same time
and manually copy all the crypto-config and paste on other server ? and generate the conposer-genesis.block and composer-channel.tx from those crypto-config information.

If that is the case, what if in the future i have to add a new org to the network. Do i have to add new org information in crypto-config.yaml and configts.yaml and re-generate the crypto-config information along with create new composer-channel.tx ? BUT! use the same(old) composer-genesis.block that we generate from the first time

thank you in advance


(Haoxue Song) #29

I replaced the orderer.example.com with the ip address of the host machine, but I still get an error message:
"Error: can’t read the block: &{FORBIDDEN}”

This appears when I use peer channel fetch to join. Thank you so much for helping me in advance.


(Haoxue Song) #30

Also, what are the steps that Machine 2 needs to run? for example, does the machine 2 need to run the script and generate keys and certificates? Thanks.


(Varun Raj) #31

Nope. The certificate should be created only once. and you need to use the same certificates on both the machines. Maybe this is why you’re getting forbidden.


(Pranoti Bone) #32

Hi,
I have the same error. But I have done configuration in one machine only. Can you tell me how to fix it? I have 1 organisation and 4 peers in one physical machine only.

2018-02-15 12:43:26.528 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-15 12:43:26.528 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-15 12:43:26.598 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"; Reconnecting to {orderer.example.com:7050 <nil>}

(Varun Raj) #33

Have you mapped your orderer domain to the corresponding IP in your machine?


(Sreeharsha) #34


I am getting the following error after following the steps and while using startFabric.sh in peer1


(Pranoti Bone) #35

Its a localhost only…


(Pranoti Bone) #36

I have not created startPeer2 file because I have all my peers on the same machine. Is there anything else that has been missed?


(Pranoti Bone) #37

In configtx.yml file under orderer, I have changed the addresses part from orderer.example.com:7050 to 127.0.0.1:7050. But its still not working. Do I have to map the IP address anywhere else too?


(Haoxue Song) #38

So I should follow the instruction on machine 1 and then, copy the whole folder to machine 2, modify the Start Fabric-2.sh, and run it?

But you are not supposed to share the private key with anyone right? Does the machine 2 only needs the certificates to connect? does it need ca certificate or peer 2 certificate? Thanks.


(P B) #39

Hi
I’m following this tutorial and after executing this command,

docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c channel001 -f /etc/hyperledger/configtx/composer-channel.tx  it's throwing this error

2018-02-16 10:21:22.963 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-02-16 10:21:22.964 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 
2018-02-16 10:21:22.965 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-16 10:21:22.965 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-02-16 10:21:22.965 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-02-16 10:21:22.966 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-02-16 10:21:22.966 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-02-16 10:21:22.966 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...6D706F736572436F6E736F727469756D 
2018-02-16 10:21:22.966 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: BAF05B786F0F0F6B762A3D214949F22698D680B14C675DB9219D78930CDA90F5 
2018-02-16 10:21:22.966 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-02-16 10:21:22.966 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-02-16 10:21:22.966 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-02-16 10:21:22.966 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-02-16 10:21:22.966 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC4060A1608021A0608A2E19AD40522...B1E6F31A8B3ED86867033236EDC5720D 
2018-02-16 10:21:22.966 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 7A753EB23BE56D9F5C3F7EC1D82A463B014B75E158118B5F4EEC41B6A8E4213C 
Error: Got unexpected status: BAD_REQUEST
Usage:
  peer channel create [flags]

Flags:
  -c, --channelID string   In case of a newChain command, the channel ID to create.
  -f, --file string        Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
  -t, --timeout int        Channel creation timeout (default 5)

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint
  -v, --version                    Display current version of fabric peer server

I even tried changing the channel name twice. But its not working… what could be the reason? Any idea?


(Varun Raj) #40

Then it should be docker host issue. Since you’ve multiple docker-compose files you have to map everything with to the same host. You can use the following environment variable to do it. Use it in all the containers.

CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hostname


(Varun Raj) #41

Looks like the genisis block is missing. DId you run the following commands?

cd "$(dirname "$0")"
cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
configtxgen -profile ComposerOrdererGenesis -outputBlock ./composer-genesis.block
configtxgen -profile ComposerChannel -outputCreateChannelTx ./composer-channel.tx -channelID composerchannel```