Code Monkey home page Code Monkey logo

trade-finance-logistics's People

Contributors

ldesrosi avatar pnovotnyic avatar vramakrishna avatar vramakrishnasg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trade-finance-logistics's Issues

Creation of genesis block needs a different channel id

Hello, it's me again. I followed your book and it was very clear in all the steps and more useful than the docs in getting started with fabric

I got an error a few days back, an error while passing nodejs commands to the blockchain (can't recollect which one but i guess it is channel/create or channel/join)

After many days of hunting around, solved it from the below link.

48 PM
@GowriR Thanks, changing the channel name fix the issue... very strange !

@antitoine Try creating the genesis.block and chaneel.tx with different channel names - i had a similar error a few days back
antitoine August 2, 2018 12:22 PM
Anyone can help me on this error ? Orderer Server Status Code: (400**) BAD_REQUEST**. Description: error authorizing update: error validating ReadSet: existing config does not contain element for [Group] /Channel/Application/Org1MSP but was in the read set

https://stackoverflow.com/questions/51590202/channel-creation-fails-in-hyperledger-fabric-v1-2

Could you help me understand why this happens and why creating the genesis.block with a different channel ID (in the book - no channel ID was specified), from the channel.tx creation, solves the issue?

Thanks

Issue with "--with-default-names"

I am having trouble with the "brew install gnu-tar --with-default-names command". When I run it, I get the error "Error: invalid option: --with-default-names". Subsequently, when I attempt to run the "make docker" command to build images for various network components, I get the following error:

Building docker peer-image
docker build -t hyperledger/fabric-peer .build/image/peer
Sending build context to Docker daemon 33.41MB
Step 1/7 : FROM hyperledger/fabric-baseos:amd64-0.4.14
---> 75f5fb1a0e0c
Step 2/7 : ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
---> Using cache
---> ea76af896881
Step 3/7 : RUN mkdir -p /var/hyperledger/production $FABRIC_CFG_PATH
---> Using cache
---> 89ba02a093ab
Step 4/7 : COPY payload/peer /usr/local/bin
---> Using cache
---> 7e2225b8badd
Step 5/7 : ADD payload/sampleconfig.tar.bz2 $FABRIC_CFG_PATH
failed to copy files: Error processing tar file(bzip2 data invalid: bad magic value in continuation file):
make: *** [.build/image/peer/.dummy-amd64-1.4.1-snapshot-02dace615] Error 1

Distinguish Banker From Client for Access Control

In the organization structure of the initial version of the network, a single organization encompasses banker and client for the importing as well as the exporting side (thereby conflating the role of Importer and ImporterBank, and Exporter and ExporterBank, respectively.)

Currently, the access control mechanisms that have been built cannot distinguish these two roles, neither in chaincode nor in the application.

There are two ways to fix this. We probably should implement both:

  1. Have the organization MSP issue certificates with different attributes to banker and client. Then change chaincode logic to check for the right attributes before executing the transaction.
  2. Have the web service (in application) associate different user IDs with different roles, and control access to chaincode functions at that level. We could also consider adding a role parameter to the chaincode arguments list (we would have to augment the chaincode too.)

Anyone want to take a shot at this? I don't think this is very urgent, as we can discuss access control theoretically in the book and even leave the implementation as a reader exercise. In an case, the code can have a (parallel) life of its own, independent of the book. We'll just need to make clear what version of the code the book is referring to.

Issue while running network in dev mode

Hello Experts,

I am referring to the book "Hands-On Blockchain with Hyperledger" (By Nitin Gaur, Salman Baset etc) to create a sample trade finance logistic network as given in the ebook.

I am able to run the below commands and start the network

./trade.sh up

docker ps -a will list below containers

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e636f0054fc hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.carrierorg.trade.com
28c18b76dbe8 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.importerorg.trade.com
9308ad203362 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:7054->7054/tcp ca_peerExporterOrg
754018a3875e hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:8054->7054/tcp ca_peerImporterOrg
09a45eca60d5 hyperledger/fabric-orderer:latest "orderer" 3 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp orderer.trade.com
f86e50e6fc76 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.exporterorg.trade.com
986c478a522a hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:9054->7054/tcp ca_peerCarrierOrg
66f90036956a hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer0.regulatororg.trade.com
a6478cd2ba6f hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:10054->7054/tcp ca_peerRegulatorOrg

But when I run it in Dev network I am not getting any list of containers.

$ ./trade.sh up -d true

docker ps -a will return an empty list

Even I also run clean command (./trade.sh clean -d true) but still, no container created. Please let me know where is the issue.

error invoke requestTrade

in page 106, I do $ peer chaincode invoke -n tw -c '{"Args":["requestTrade","50000","Wood for Toys"]}' -C tradechannel.
I get the following error: Incorrect number of arguments. Expecting 3: {ID, Amount, Description of Goods}. Found 2)

It seems logical to me as the in the go code of func requestTrade() (in tradeWorkflow.go), the args is only 2 elements long as the name of the function is not included.
But then also, I do not understand what you expect in line 206 in args[0] when you do tradeKey, err = getTradeKey(stub, args[0])

I use trade-finance-logistics master, fabric 1.1, trade_workflow_v1.

Thank you for your support.

Error when packaging a contract

Hi,

I run below script to package smart contract:

docker exec -e CHANNEL_NAME=tradechannel -e CC_LANGUAGE=node -e CC_LABEL=trade -e CC_VERSION=v1 trade_cli cli_scripts/chaincode.sh package

There is error as:

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "cli_scripts/chaincode.sh": stat cli_scripts/chaincode.sh: no such file or directory: unknown

Any idea how to fix this?

Thx in advance,

Containerize middleware and application

Currently the middleware scripts and application web server are configured to run on the host machine. For a cleaner launch, and for consistency with the network setup, we ought to run them in isolated containers too.

Error while setting up network

I'm trying to set up the network part.
I ran docker-compose -f docker-compose-e2e-template.yaml up but I receive the following errors:

ca_peerImporterOrg | Error: File specified by 'tls.keyfile' do
t exist: /etc/hyperledger/fabric-ca-server-config/IMPORTER_CA_PRIVATE_KEY
ca_peerExporterOrg | Error: File specified by 'tls.keyfile' do
t exist: /etc/hyperledger/fabric-ca-server-config/EXPORTER_CA_PRIVATE_KEY
ca_peerRegulatorOrg | Error: File specified by 'tls.keyfile' do
t exist: /etc/hyperledger/fabric-ca-server-config/REGULATOR_CA_PRIVATE_KEY

Did anyone have the same issue? How to solve this?
I just need to get the app running without any modification.

Thanks in advance!

Problem in running the app

I have completed the network part followed by the middleware part. Then I am trying to run the application by running "node app.js", however I am getting the following error.

$node app.js

info: [ClientUtils]:



  • Using temp dir: ../network/client-certs


[2019-02-10 10:55:45.299] [INFO] TradeApp - ****************** SERVER STARTED ************************
[2019-02-10 10:55:45.300] [INFO] TradeApp - *************** http://localhost:4000 ******************
UnauthorizedError: No authorization token was found

Failed to generate orderer genesis block

While proceeding with the mentioned step: Build Channel and Crypto Artifacts, and Network Structure Using Docker Containers,the below error is raised on executing the below command.

Command:::: ./trade.sh generate -c tradechannel

Error::::::
hp@hp-HP-Notebook:~/go/src/github.com/hyperledger/fabric/network$ ./trade.sh generate -c tradechannel
Generating certs and genesis block with channel 'tradechannel'
Continue? [Y/n] Y
proceeding ...
/usr/local/bin/cryptogen

##########################################################

Generate certificates using cryptogen tool

##########################################################

  • cryptogen generate --config=./crypto-config.yaml
    exporterorg.trade.com
    importerorg.trade.com
    carrierorg.trade.com
    regulatororg.trade.com
  • res=0
  • set +x

/usr/local/bin/configtxgen
###########################################################
######### Generating Orderer Genesis block ##############
###########################################################

  • configtxgen -profile FourOrgsTradeOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
    2019-02-04 19:26:14.133 IST [common.tools.configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated. Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
    2019-02-04 19:26:14.133 IST [common.tools.configtxgen] main -> INFO 002 Loading configuration
    2019-02-04 19:26:14.147 IST [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced
    2019-02-04 19:26:14.147 IST [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced
    panic: Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced [recovered]
    panic: Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced

goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc42011f970, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x4f4
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc4200b8240, 0xc420393804, 0xc420178460, 0x69, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0xf6
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(0xc4200b8240, 0xc420178460, 0x69, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159 +0x79
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panic(0xc4200b8248, 0xc420393918, 0x1, 0x1)
/home/hp/go/src/github.com/hyperledger/fabric/common/flogging/zap.go:73 +0x75
main.main.func1()
/home/hp/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:250 +0x1a7
panic(0xd1b520, 0xc420360f20)
/usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc42011f970, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x4f4
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc4200b8220, 0xc420393c04, 0xc420178310, 0x69, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0xf6
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(0xc4200b8220, 0xc420178310, 0x69, 0x0, 0x0, 0x0)
/home/hp/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159 +0x79
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panic(0xc4200b8228, 0xc420393da8, 0x2, 0x2)
/home/hp/go/src/github.com/hyperledger/fabric/common/flogging/zap.go:73 +0x75
github.com/hyperledger/fabric/common/tools/configtxgen/localconfig.Load(0x7fff8dc0c1af, 0x1b, 0x0, 0x0, 0x0, 0x1)
/home/hp/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/localconfig/config.go:275 +0x441
main.main()
/home/hp/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:261 +0xb3c

  • res=2
  • set +x
    Failed to generate orderer genesis block...

generateCert function's sed command issue for osx.

ISSUE: When running ./trade.sh generate -c tradechannel command for testing, I found sed command has issue on osx.

SOLVE: change [sed -i] with [sed -i ""].

REASON: Unlike Ubuntu, OS X requires the extension to be explicitly specified. The workaround is to set an empty string:
$ sed -i '' 's/megatron/pony/g' /path/to/file.txt
(ref: lmquang/til#18)

Error when invoking middleware/createTradeApp.js with release-1.4

Hi - I am attempting to run middleware/createTradeApp.js with release-1.4, but am getting an error (please see below)

I am following the instructions in the README.md at https://github.com/HyperledgerHandsOn/trade-finance-logistics/tree/release-1.4/middleware. I believe that all of my config parameters in the network and middleware directories are consistent.

I believe that my error is not related to Issue #3 (Race condition during channel join in createTradeApp.js). (As one attempt to debug, I extended the sleep time at line 196 of create-channel.js, but still getting same error.)

Here is the console output when I invoke createTradeApp.js:
++++++++++++++
rick@mac4hull middleware % node createTradeApp.js
2020-02-07T08:05:53.600Z - info: [ClientUtils]:



  • Using temp dir: ../network/client-certs


Successfully extracted the config update from the configtx envelope
Successfully enrolled user 'admin' for exporterorg
Successfully signed config as admin of exporterorg
Successfully enrolled user 'admin' for importerorg
Successfully signed config as admin of importerorg
Successfully enrolled user 'admin' for carrierorg
Successfully signed config as admin of carrierorg
Successfully enrolled user 'admin' for regulatororg
Successfully signed config as admin of regulatororg
Successfully enrolled user 'admin' for every org and obtained channel config signatures
Successfully enrolled user 'admin' for orderer
2020-02-07T08:05:53.987Z - error: [Orderer.js]: sendDeliver - rejecting - status:NOT_FOUND
Channel tradechannel does not exist yet (IGNORE ANY ORDERER ERROR MESSAGES YOU SEE ABOVE!!)
Successfully signed config update as orderer admin
{ status: 'BAD_REQUEST',
info: 'error validating channel creation transaction for new channel 'tradechannel', 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' }

"-------------------------"

CHANNEL CREATION FAILED: Error: Error: Failed to create the channel.
at Client.newDefaultKeyValueStore.then.then.then.then.then (/Users/rick/go/src/trade-finance-logistics/middleware/create-channel.js:201:10)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
at Client.newDefaultKeyValueStore.then.then.then.then.then.then (/Users/rick/go/src/trade-finance-logistics/middleware/create-channel.js:209:9)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
"-------------------------"

++++++++++++++

Any suggestions would be appreciated.

(In case it is useful, I have attached logs from 3 of the containers.)
ca_peerImporterOrg--log.txt
orderer.trade.com--log.txt
peer0.importerorg.trade.com--log.txt

Thanks

Error with creating docker image

I got an error while making docker image. (fabric v1.1)

Error log:

Building docker javaenv-image
docker build -t hyperledger/fabric-javaenv build/image/javaenv
Sending build context to Docker daemon 56.83kB
Step 1/15 : FROM hyperledger/fabric-baseimage:x86_64-0.4.6
x86_64-0.4.6: Pulling from hyperledger/fabric-baseimage
1be7f2b886e8: Pull complete
6fbc4a21b806: Pull complete
c71a6f8e1378: Pull complete
4be3072e5a37: Pull complete
06c6d2f59700: Pull complete
4d536120d8a5: Pull complete
0baaf9ec263e: Pull complete
3ea9b6cc6f21: Pull complete
6173b9a5fe5e: Pull complete
e73719e0bcbe: Pull complete
b55408c6ced5: Pull complete
Digest: sha256:4bd7a050fbd0470d47fe1eb983bc1e32a826d6b7e5f81a694ac3928375b2321f
Status: Downloaded newer image for hyperledger/fabric-baseimage:x86_64-0.4.6
---> dbe6787b5747
Step 2/15 : RUN curl -sSL https://services.gradle.org/distributions/gradle-2.12-bin.zip > /tmp/gradle-2.12-bin.zip
---> Running in 29d85ae02613
Removing intermediate container 29d85ae02613
---> ba09b3d9d047
Step 3/15 : RUN unzip -qo /tmp/gradle-2.12-bin.zip -d /opt && rm /tmp/gradle-2.12-bin.zip
---> Running in ada7cdbcbd60
Removing intermediate container ada7cdbcbd60
---> 7ea5761088e8
Step 4/15 : RUN ln -s /opt/gradle-2.12/bin/gradle /usr/bin
---> Running in 7599788dfcf0
Removing intermediate container 7599788dfcf0
---> 11e6893b6cfd
Step 5/15 : ENV MAVEN_VERSION=3.3.9
---> Running in 95aa96d69576
Removing intermediate container 95aa96d69576
---> 4cc6e601830b
Step 6/15 : ENV USER_HOME_DIR="/root"
---> Running in f696b1c0a8b0
Removing intermediate container f696b1c0a8b0
---> c97fe6ae1e69
Step 7/15 : RUN mkdir -p /usr/share/maven /usr/share/maven/ref && curl -fsSL https://nexus.hyperledger.org/content/repositories/hosted_installers/apache-maven/apache-maven/$MAVEN_VERSION/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
---> Running in a68701b248ca
Removing intermediate container a68701b248ca
---> 296e480c535d
Step 8/15 : ENV MAVEN_HOME /usr/share/maven
---> Running in e8587ba3613b
Removing intermediate container e8587ba3613b
---> 526320177290
Step 9/15 : ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
---> Running in 8b95519017ec
Removing intermediate container 8b95519017ec
---> 8b5aabab8a16
Step 10/15 : ADD payload/javashim.tar.bz2 /root
failed to copy files: Error processing tar file(bzip2 data invalid: bad magic value in continuation file):
make: *** [build/image/javaenv/.dummy-x86_64-1.1.2-snapshot-5cf10e92] Error 1

I tried the solution of issue #61 and confirmed that tar command executes gnu-tar by tar --version.

But the error still occurs. Why?

./startFabric.sh Failed to generate orderer genesis block...

$ ../bin/configtxgen -version
configtxgen:
Version: 2.0.0
Commit SHA: 0432c3e80
Go version: go1.13.4
OS/Arch: windows/amd64

byfn.sh not change why the ./startFabric.sh the conmands not have -profile args

$ ./startFabric.sh

  • export MSYS_NO_PATHCONV=1
  • MSYS_NO_PATHCONV=1
    ++ date +%s
  • starttime=1588070575
  • CC_SRC_LANGUAGE=go
    ++ echo go
    ++ tr '[:upper:]' '[:lower:]'
  • CC_SRC_LANGUAGE=go
  • '[' go = go -o go = golang ']'
  • CC_RUNTIME_LANGUAGE=golang
  • CC_SRC_PATH=github.com/hyperledger/fabric-samples/chaincode/fabcar/go
  • echo Vendoring Go dependencies ...
    Vendoring Go dependencies ...
  • pushd ../chaincode/fabcar/go
    /d/fabric/fabric-samples/chaincode/fabcar/go /d/fabric/fabric-samples/fabcar
  • GO111MODULE=on
  • go mod vendor
  • popd
    /d/fabric/fabric-samples/fabcar
  • echo Finished vendoring Go dependencies
    Finished vendoring Go dependencies
  • rm -rf ./hfc-key-store
  • pushd ../first-network
    /d/fabric/fabric-samples/first-network /d/fabric/fabric-samples/fabcar
  • echo y
  • ./byfn.sh down
    Stopping for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
    proceeding ...
    The BYFN_CA1_PRIVATE_KEY variable is not set. Defaulting to a blank string.
    The BYFN_CA2_PRIVATE_KEY variable is not set. Defaulting to a blank string.
    Removing network net_byfn
    Network net_byfn not found.
    Removing volume net_orderer.example.com
    Volume net_orderer.example.com not found.
    Removing volume net_peer0.org1.example.com
    Volume net_peer0.org1.example.com not found.
    Removing volume net_peer1.org1.example.com
    Volume net_peer1.org1.example.com not found.
    Removing volume net_peer0.org2.example.com
    Volume net_peer0.org2.example.com not found.
    Removing volume net_peer1.org2.example.com
    Volume net_peer1.org2.example.com not found.
    Removing volume net_orderer2.example.com
    Volume net_orderer2.example.com not found.
    Removing volume net_orderer3.example.com
    Volume net_orderer3.example.com not found.
    Removing volume net_orderer4.example.com
    Volume net_orderer4.example.com not found.
    Removing volume net_orderer5.example.com
    Volume net_orderer5.example.com not found.
    Removing volume net_peer0.org3.example.com
    Volume net_peer0.org3.example.com not found.
    Removing volume net_peer1.org3.example.com
    Volume net_peer1.org3.example.com not found.
    ---- No containers available for deletion ----
    ---- No images available for deletion ----
  • echo y
  • ./byfn.sh up -a -n -s couchdb

Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds and using database 'couchdb'
proceeding ...
LOCAL_VERSION=2.0.0
DOCKER_IMAGE_VERSION=2.0.0
/d/fabric/fabric-samples/bin/cryptogen

##########################################################

Generate certificates using cryptogen tool

##########################################################

  • cryptogen generate --config=./crypto-config.yaml
    org1.example.com
    org2.example.com
  • res=0
  • set +x

Generate CCP files for Org1 and Org2
/d/fabric/fabric-samples/bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
2020-04-28 18:43:08.035 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-04-28 18:43:08.054 CST [common.tools.configtxgen.localconfig] Load -> PANI 002 Error reading configuration: Unsupported Config Type ""
2020-04-28 18:43:08.054 CST [common.tools.configtxgen] func1 -> PANI 003 Error reading configuration: Unsupported Config Type ""
panic: Error reading configuration: Unsupported Config Type "" [recovered]
panic: Error reading configuration: Unsupported Config Type ""

goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0000b1e40, 0x0, 0x0, 0x0)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x54d
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc0001a8188, 0x4, 0xc00002d280, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0x107
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(...)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panic(0xc0001a8190, 0xc0003638e8, 0x1, 0x1)
/__w/1/go/src/github.com/hyperledger/fabric/common/flogging/zap.go:73 +0xa0
main.main.func1()
/__w/1/go/src/github.com/hyperledger/fabric/cmd/configtxgen/main.go:253 +0x17d
panic(0xa04cc0, 0xc000352e40)
/usr/local/go/src/runtime/panic.go:679 +0x1c0
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0000b1e40, 0x0, 0x0, 0x0)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x54d
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc0001a8168, 0x4, 0xc00002d180, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0x107
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(...)
/__w/1/go/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panic(0xc0001a8170, 0xc000363cd8, 0x2, 0x2)
/__w/1/go/src/github.com/hyperledger/fabric/common/flogging/zap.go:73 +0xa0
github.com/hyperledger/fabric/internal/configtxgen/genesisconfig.Load(0xc000030520, 0x17, 0x0, 0x0, 0x0, 0x0)
/__w/1/go/src/github.com/hyperledger/fabric/internal/configtxgen/genesisconfig/config.go:253 +0x22f
main.main()
/__w/1/go/src/github.com/hyperledger/fabric/cmd/configtxgen/main.go:268 +0xf4c
Failed to generate orderer genesis block...

Chaincode installation error

Hi,
While installing the chaincode , we are facing the below issue.
COMMAND:::
$node createTradeApp.js

BELOW IS THE ERROR:::::::
info: [ClientUtils]:



  • Using temp dir: ../network/client-certs


(node:14685) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead
Successfully extracted the config update from the configtx envelope
Successfully enrolled user 'admin' for exporterorg
Successfully signed config as admin of exporterorg
Successfully enrolled user 'admin' for importerorg
Successfully signed config as admin of importerorg
Successfully enrolled user 'admin' for carrierorg
Successfully signed config as admin of carrierorg
Successfully enrolled user 'admin' for regulatororg
Successfully signed config as admin of regulatororg
Successfully enrolled user 'admin' for every org and obtained channel config signatures
Successfully enrolled user 'admin' for orderer
error: [Orderer.js]: sendDeliver - rejecting - status:NOT_FOUND
Channel tradechannel does not exist yet (IGNORE ANY ORDERER ERROR MESSAGES YOU SEE ABOVE!!)
Successfully signed config update as orderer admin
Successfully created the channel.
Successfully waited to make sure new channel was created.


CHANNEL CREATION COMPLETE

Joining channel tradechannel
Successfully enrolled 'admin' user for org exporterorg
Successfully got the genesis block
TypeError: Cannot read property 'getConnectivityState' of undefined
at EventHub._checkConnection (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:479:39)
at EventHub.registerBlockEvent (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:658:8)
at Promise (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:161:8)
at new Promise ()
at eventhubs.forEach (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:158:20)
at Array.forEach ()
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:157:13)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
E0301 14:10:47.422452275 14685 ssl_transport_security.cc:1233] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0301 14:10:47.422647044 14685 ssl_transport_security.cc:1233] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream. (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:355:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at ClientDuplexStream._emitStatusIfDone (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client.js:234:12)
at ClientDuplexStream._receiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client.js:211:8)
at Object.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1306:15)
at InterceptingListener._callNext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:618:8)
at /home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1123:18
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 14 UNAVAILABLE: Connect Failed
at Object.exports.createStatusError (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1204:28)
at InterceptingListener._callNext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:845:24)
Successfully enrolled 'admin' user for org importerorg
Successfully got the genesis block
TypeError: Cannot read property 'getConnectivityState' of undefined
at EventHub._checkConnection (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:479:39)
at EventHub.registerBlockEvent (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:658:8)
at Promise (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:161:8)
at new Promise ()
at eventhubs.forEach (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:158:20)
at Array.forEach ()
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:157:13)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream. (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:308:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:208:10)
at Object.onReceiveMessage (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1292:19)
at InterceptingListener.recvMessageWithContext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:607:19)
at /home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:706:14
Successfully enrolled 'admin' user for org carrierorg
Successfully got the genesis block
TypeError: Cannot read property 'getConnectivityState' of undefined
at EventHub._checkConnection (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:479:39)
at EventHub.registerBlockEvent (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:658:8)
at Promise (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:161:8)
at new Promise ()
at eventhubs.forEach (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:158:20)
at Array.forEach ()
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:157:13)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
Successfully enrolled 'admin' user for org regulatororg
TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream. (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:308:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:208:10)
at Object.onReceiveMessage (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1292:19)
at InterceptingListener.recvMessageWithContext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:607:19)
at /home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:706:14
Successfully got the genesis block
TypeError: Cannot read property 'getConnectivityState' of undefined
at EventHub._checkConnection (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:479:39)
at EventHub.registerBlockEvent (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:658:8)
at Promise (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:161:8)
at new Promise ()
at eventhubs.forEach (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:158:20)
at Array.forEach ()
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:157:13)
at
at process._tickCallback (internal/process/next_tick.js:189:7)


CHANNEL JOIN COMPLETE

TypeError: Cannot read property 'getConnectivityState' of undefined
at ClientDuplexStream. (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/fabric-client/lib/EventHub.js:308:56)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:208:10)
at Object.onReceiveMessage (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1292:19)
at InterceptingListener.recvMessageWithContext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:607:19)
at /home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:706:14
Successfully enrolled user 'admin'
info: [packager/Golang.js]: packaging GOLANG from github.com/trade_workflow
E0301 14:10:48.467319812 14685 ssl_transport_security.cc:1233] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 14 UNAVAILABLE: Connect Failed
at Object.exports.createStatusError (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:1204:28)
at InterceptingListener._callNext (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/hp/go/src/github.com/hyperledger/fabric/middleware/node_modules/grpc/src/client_interceptors.js:845:24)
error: [install-chaincode]: install proposal was bad from peer grpcs://localhost:7051 in org exporterorg
Failed to install chaincode in peers of organization "exporterorg". Error: Failed to send install Proposal or receive valid response from org exporterorg: Error: 14 UNAVAILABLE: Connect Failed
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/install-chaincode.js:136:10)
at
error: [install-chaincode]: Failed to install chaincode in peers of organization "exporterorg".
Error: Failed to send install Proposal or receive valid response from org exporterorg: Error: 14 UNAVAILABLE: Connect Failed
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/install-chaincode.js:136:10)
at


CHAINCODE INSTALL FAILED: Error: Failed to send install Proposal or receive valid response from org exporterorg: Error: 14 UNAVAILABLE: Connect Failed
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/install-chaincode.js:136:10)
at

Can we get any solution to above error.

Thank you.

Invalid yaml definition in trade-finance-logistics/network/configtx.yaml

When i run configtxgen to generate genesis block i encountered the following errors

ubuntu@ubuntu:~/go/src/trade-finance-logistics/network$ configtxgen -profile FourOrgsTradeOrdererGenesis -outputBlock ./channelartifacts/genesis.block
2018-08-30 01:58:27.690 EDT [common/tools/configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen is deprecated. Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
2018-08-30 01:58:27.690 EDT [common/tools/configtxgen] main -> INFO 002 Loading configuration
2018-08-30 01:58:27.691 EDT [common/tools/configtxgen/localconfig] Load -> CRIT 003 Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced
2018-08-30 01:58:27.691 EDT [common/tools/configtxgen] func1 -> CRIT 004 Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced
panic: Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced [recovered]
panic: Error reading configuration: While parsing config: yaml: unknown anchor 'ChannelCapabilities' referenced

goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc4201abe00, 0xc42039dd00, 0x1, 0x1)
/home/ubuntu/go/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
main.main.func1()
/home/ubuntu/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:254 +0x1ae
panic(0xc6ea00, 0xc42039dcf0)
/usr/lib/go-1.10/src/runtime/panic.go:505 +0x229
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc4201abc50, 0xc4201a57a0, 0x2, 0x2)
/home/ubuntu/go/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
github.com/hyperledger/fabric/common/tools/configtxgen/localconfig.Load(0x7ffd1ef6d6d8, 0x1b, 0x0, 0x0, 0x0, 0x1)
/home/ubuntu/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/localconfig/config.go:277 +0x469
main.main()
/home/ubuntu/go/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:265 +0xce7

And after digging deeper, i thought it was caused by the wrong yaml definition, we used alias ChannelCapabilities before anchor ChannelCapabilities, so the parser thought it was invalid, and the following are the yaml specification about Anchor and Alias

3.3.1. Well-Formed Streams and Identified Aliases
A well-formed character stream must match the BNF productions specified in the following chapters. Successful loading also requires that each alias shall refer to a previous node identified by the anchor. A YAML processor should reject ill-formed streams and unidentified aliases. A YAML processor may recover from syntax errors, possibly by ignoring certain parts of the input, but it must provide a mechanism for reporting such errors.

And if we move the Profiles's definition to the bottom of the file, then it will be considered as a valid yaml file, and configtxgen succeed.

Cannot read property 'stack' of undefined

I am facing this issue when running node createTradeapp,js after starting the network using trade.sh,

please find the attached screenshot, here is the stack trace:

info: [ClientUtils]:



  • Using temp dir: ../network/client-certs


Successfully extracted the config update from the configtx envelope
Successfully enrolled user 'admin' for exporterorg
Successfully signed config as admin of exporterorg
Successfully enrolled user 'admin' for importerorg
Successfully signed config as admin of importerorg
Successfully enrolled user 'admin' for carrierorg
Successfully signed config as admin of carrierorg
Successfully enrolled user 'admin' for regulatororg
Successfully signed config as admin of regulatororg
Successfully enrolled user 'admin' for every org and obtained channel config signatures
Successfully enrolled user 'admin' for orderer
error: [Orderer.js]: sendDeliver - rejecting - status:NOT_FOUND
Channel tradechannel does not exist yet (IGNORE ANY ORDERER ERROR MESSAGES YOU SEE ABOVE!!)
Successfully signed config update as orderer admin
Successfully created the channel.
Successfully waited to make sure new channel was created.


CHANNEL CREATION COMPLETE

Joining channel tradechannel
Successfully enrolled 'admin' user for org exporterorg
Successfully got the genesis block
E0130 18:27:21.610882542 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:21.611012146 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 14 UNAVAILABLE: Connect Failed
at new createStatusError (/home/syed/go/src/github.com/naqvijafar91/digipramaan/middleware/node_modules/grpc/src/client.js:64:15)
at /home/syed/go/src/github.com/naqvijafar91/digipramaan/middleware/node_modules/grpc/src/client.js:583:15
E0130 18:27:22.612312296 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:24.264777422 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:26.866948386 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:30.193909661 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:35.872063050 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0130 18:27:45.935098922 13988 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
undefined
Failed join attempt: TypeError: Cannot read property 'stack' of undefined
at Client.newDefaultKeyValueStore.then.then.then.then (/home/syed/go/src/github.com/naqvijafar91/digipramaan/middleware/join-channel.js:206:61)
at
createtradeapperror

Implementation of BFT consensus in hyperledger fabric

Hi,

I try to understand from the book and exercises on understanding implementation of BFT consensus in hyperledger. So far i don't find any satisfactory explanations. I've found the explanation in the book is rather brief or i have misunderstood something. Could you give some pointers on this?

thanks.

Instantiate chaincode error - book Hands-On Blockchain with Hyperledger

Hi,
I've installed chaincode successfully but when I tried to instantiate the chaincode as per instruction on page 250 but received the following error:

...
2018-07-03 02:42:35.654 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 05f Using default vscc
2018-07-03 02:42:35.654 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 060 java chaincode enabled
2018-07-03 02:42:35.655 UTC [msp/identity] Sign -> DEBU 061 Sign: plaintext: 0AB0070A6A08031A0C089BC5EBD90510...6E740A000A04657363630A0476736363
2018-07-03 02:42:35.655 UTC [msp/identity] Sign -> DEBU 062 Sign: digest: 26532ECA4A0FFA52BA8554EB203C324CF77E9B2E888F0890954F5E8C5DD4F70F
Error: Error endorsing chaincode: rpc error: code = Unknown desc = failed to init chaincode: handler not found for chaincode tw:0
Usage:
peer chaincode instantiate [flags]

Background:
i started the network in development mode:
$> ./trade.sh up -d true

then i build the chaincode:
$> docker exec -it chaincode bash

go build

install chaincode:
$> docker exec -it cli bash

peer chaincode install -p chaincodedev/chaincode/trade_workflow_v1 -n tw -v 0

instantiate chaincode:

peer chaincode instantiate -n tw -v 0 -c '{"Args":["init","LumberInc","LumberBank","100000","WoodenToys","ToyBank","200000","UniversalFreight","ForestryDepartment"]}' -C tradechannel

then i got the above-mentioned errors..

Any suggestion on the cause of this error?

nizam

cryptogen: command not found

sugamxp@sugamxp:~/go/src/trade-finance-logistics/network$ cryptogen generate --config=./crypto-config.yaml
cryptogen: command not found

Please help

./trade.sh up -d true only starting two containers

executing the command
trade-finance-logistics/network/ # ./trade.sh up -d true
gives me no error but only starts the chaincode and orderer containers(as docker container ls shows me). So I am unable to follow chapter 4 in the Book. How to resolve this? Is there any way to start the missing peer and cli containers?

Instructions in ABAC.md not working with regards to changing calling identity from CLI

I am working with release-1.4, and focused on ABAC, using the ABAC.md page, specifically https://github.com/HyperledgerHandsOn/trade-finance-logistics/blob/release-1.4/chaincode/abac.md

I am running in dev mode as per Chapter 4 in the book. I believe that I am faithfully following the instructions about running " /opt/trade/createIdentity.sh" in the cli container.

However, when I attempt to invoke a trade request from the cli, presumably with the identity of "admin", it turns out that the creatorOrg, creatorCertIssuer are 'DevOrgMSP' and 'ca.devorg.trade.com'.

If I execute "export CORE_PEER_MSPCONFIGPATH=/root/.fabric-ca-client/importer" in the CLI and again invoke a trade request, it turns out that again the creatorOrg, creatorCertIssuer are 'DevOrgMSP' and 'ca.devorg.trade.com'.

Do you have any ideas what I am doing wrong or missing?

BTW, another small question is: If I follow your instructions using trade_workflow_v1, and then on page 106 I perform the two invoke steps, it turns out they are executed in test mode. But if I make a slight edit (or no edit) to tradeworkflow.go in my local machine and upload into the chaincode container and re-build go and etc, and then I perform the invoke steps, they are NOT in test mode anymore. How are you magically having it start in test mode the first time, but not after re-loading tradeworkflow.go.

Thanks

Create Application GUI

Currently, we need to use curl commands to exercise the web application wrapping the middleware and chaincode. Notifications of transaction commitment events can only be tracked by observing console logs. It would be useful and more user-friendly to build a basic JavaScript GUI (or set of GUIs) that can enable users to orchestrate trades, and notify users of ledger state changes using websockets.

create-channel.js had required a path change

I had to change it to

var

_commonProto = grpc.load(path.join(__dirname, '**../application/**node_modules/fabric-client/lib/protos/common/common.proto')).common;
var _configtxProto = grpc.load(path.join(__dirname,

'../application/node_modules/fabric-client/lib/protos/common/configtx.proto')).common;

to make it work. Please consider it if it is valid for all. Thanks

How to get all the assets related with client?

Now there are four org in the network. But as to every org, there are a number of entities. For each client, it should be assigned to a specified role and a specified identity, i.e. entity of exporter, importer, exporter bank, importer bank, regulator or carrier. If the client of a given importer wants to query all the assets of him, how to do it? It seems easy to identify the role but uneasy to identify the identity of the client.
And why set the identity when instantiating the chaincode? Does this mean there is only one instance for each role?
Thanks.

Document Chaincode API

Create a file called API.md in the chaincode folder, containing a listing of all chaincode functions, their expected arguments lists', and respective access constraints. Create listings for both versions of the chaincode.

Chaincode Invocation Failure

Sir,
We are working on this project. When we are trying to execute the createTradeApp.js in the middleware, we are getting the chaincode invocation failure error.
Command:::::node createTradeApp.js

Error:::::::::
2019-03-14T04:48:26.138Z - info: [ClientUtils]:



  • Using temp dir: ../network/client-certs


(node:10257) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead
Successfully extracted the config update from the configtx envelope
Successfully enrolled user 'admin' for exporterorg
Successfully signed config as admin of exporterorg
Successfully enrolled user 'admin' for importerorg
Successfully signed config as admin of importerorg
Successfully enrolled user 'admin' for carrierorg
Successfully signed config as admin of carrierorg
Successfully enrolled user 'admin' for regulatororg
Successfully signed config as admin of regulatororg
Successfully enrolled user 'admin' for every org and obtained channel config signatures
Successfully enrolled user 'admin' for orderer
2019-03-14T04:48:26.587Z - error: [Orderer.js]: sendDeliver - rejecting - status:NOT_FOUND
Channel tradechannel does not exist yet (IGNORE ANY ORDERER ERROR MESSAGES YOU SEE ABOVE!!)
Successfully signed config update as orderer admin
Successfully created the channel.
Successfully waited to make sure new channel was created.


CHANNEL CREATION COMPLETE

Joining channel tradechannel
Successfully enrolled 'admin' user for org exporterorg
Successfully got the genesis block
TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:141:22)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
Successfully enrolled 'admin' user for org importerorg
Successfully got the genesis block
TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:141:22)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
Successfully enrolled 'admin' user for org carrierorg
Successfully got the genesis block
TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:141:22)
at
at process._tickCallback (internal/process/next_tick.js:189:7)
Joining channel tradechannel
Successfully enrolled 'admin' user for org regulatororg
Successfully got the genesis block
TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/join-channel.js:141:22)
at
at process._tickCallback (internal/process/next_tick.js:189:7)


CHANNEL JOIN COMPLETE

Successfully enrolled user 'admin'
2019-03-14T04:48:33.018Z - info: [install-chaincode]: install proposal was good from peer grpcs://localhost:7051 in org exporterorg
Successfully sent install Proposal and received ProposalResponses to peers of org exporterorg
Successfully installed chaincode in peers of organization "exporterorg"
Successfully enrolled user 'admin'
2019-03-14T04:48:33.933Z - info: [install-chaincode]: install proposal was good from peer grpcs://localhost:8051 in org importerorg
Successfully sent install Proposal and received ProposalResponses to peers of org importerorg
Successfully installed chaincode in peers of organization "importerorg"
Successfully enrolled user 'admin'
2019-03-14T04:48:34.845Z - info: [install-chaincode]: install proposal was good from peer grpcs://localhost:9051 in org carrierorg
Successfully sent install Proposal and received ProposalResponses to peers of org carrierorg
Successfully installed chaincode in peers of organization "carrierorg"
Successfully enrolled user 'admin'
2019-03-14T04:48:35.725Z - info: [install-chaincode]: install proposal was good from peer grpcs://localhost:10051 in org regulatororg
Successfully sent install Proposal and received ProposalResponses to peers of org regulatororg
Successfully installed chaincode in peers of organization "regulatororg"
Installations succeeded


CHAINCODE INSTALL COMPLETE

Successfully enrolled user 'admin'
Failed to initialize the channel. TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:124:19)
at
Error: Failed to initialize the channel
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:169:9)
at
Error: Error: Failed to initialize the channel
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:169:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:243:9)
at


CHAINCODE INSTANTIATE COMPLETE

Error: Error: Error: Failed to initialize the channel
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:169:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:243:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/instantiate-chaincode.js:261:18)
at
Successfully loaded user Importer from persistence
Successfully enrolled user Importer
Failed to get submitter Importer. Error: TypeError: client.newEventHub is not a function
Error: Failed to get submitter Importer. Error: TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:145:9)
at
Error: Error: Failed to get submitter Importer. Error: TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:145:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:241:9)
at


CHAINCODE INVOCATION FAILED: Error: Error: Error: Failed to get submitter Importer. Error: TypeError: client.newEventHub is not a function
at Client.newDefaultKeyValueStore.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:145:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:241:9)
at
at Client.newDefaultKeyValueStore.then.then.then.then.then (/home/hp/go/src/github.com/hyperledger/fabric/middleware/invoke-chaincode.js:267:9)
at

#####################################################
#####################################################
And we are running the Fabric version 1.1

We request you to help in this issue.

Thanks.

make chaincode failing

Failing to build chaincode from the root directory. But I'm able to do the go build in trade_workflow directory manually.

screen shot 2018-07-14 at 1 25 20 am

upgrade chain code - help on the right process

Hello Sir,
Hello again. I am back to this work after a long break of reading up on energy related papers.
I want to work on incremental changes in my chaincode, deploy and test it to see consensus happening.

Following is what I do -

I installed and instantiated the chaincode with v0 on the ledger.

curl -s -X POST http://localhost:4000/chaincode/instantiate -H "authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzM4OTQ4OTIsInVzZXJuYW1lIjoiYWRtaW4iLCJvcmdOYW1lIjoidXRpbGl0eW9yZyIsImlhdCI6MTUzMzg5MDc1Mn0.ckS82mBlP424VmiKRZlpZPVwdlcop5YEc72fBwVJv-s" -H "content-type: application/json" -d '{"ccpath": "github.com/utility_workflow", "ccversion": "v0", "args": ["2kmqtt", "100", "REQUESTED"]}'
{"success":true,"message":"Chaincode instantiated"}

Now i wish to upgrade the chaincode. I have two docker containers created with the dev prefix for running the chaincode.

I copy the same code to another directory and rename it with a suffix v1 and
run the command

curl -s -X POST http://localhost:4000/chaincode/upgrade -H "authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzYyNzgwMzQsInVzZXJuYW1lIjoiYWRtaW4iLCJvcmdOYW1lIjoidXRpbGl0eW9yZyIsImlhdCI6MTUzNjI3Mzg5NH0.CV4rjs-QgA1G62D7OGbwQz98n2Ydr_1T8SB5khJlm40" -H "content-type: application/json" -d '{"ccpath": "github.com**/utility_workflow_v1"**, "ccversion": "v1", "args": ["2kmqtt", "100", "REQUESTED"]}'
{"success":false,"message":"Failed to send install Proposal or receive valid response from org consumerorg: [object Object]"}

The error messages are on the node.js terminal are as follows. I have changed the config_upgrade.json and constants.json in the middleware to accomodate my network

My constants.js refers to : module.exports = {
networkConfig: networkConfig, (which is config.json and not config_upgrade.json)
And install-chaincode .js has
module.exports.installChaincode = installChaincode;

Is there some configuration that i need to change to make upgrade work using the middleware (i also tried deleting the image and containers created by the install and instantiate of the first version of chaincode)?

The error messages are below:

Successfully enrolled user 'admin'
info: [packager/Golang.js]: packaging GOLANG from github.com/utility_workflow_v1
500 {{{{{{{{{console.log(results[0][0].response.status);}}}}}}}}}}}}}}
error: [install-chaincode]: install proposal was bad from peer undefined in org consumerorg
Failed to install chaincode in peers of organization "consumerorg". Error: Failed to send install Proposal or receive valid response from org consumerorg: [object Object]
at Client.newDefaultKeyValueStore.then.then.then (/home/hypledvm/go/src/utilitypoc/middleware/install-chaincode.js:137:10)
at
error: [install-chaincode]: Failed to install chaincode in peers of organization "consumerorg".
Error: Failed to send install Proposal or receive valid response from org consumerorg: [object Object]
at Client.newDefaultKeyValueStore.then.then.then (/home/hypledvm/go/src/utilitypoc/middleware/install-chaincode.js:137:10)
at
(node:7080) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Can't set headers after they are sent.
(node:7080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Your assistance on this would be greatly appreciated.

Thanks

Chaincode instantiation in the non-dev mode

Hello, the instructions in the book have not been clear on the non-dev mode. I have been stuck in this part since a few days. I am new to GO, so am not clear, how the vendoring should happen.

I have a few errors that I am aware of but not sure how to solve them.

/trade_workflow$ go version
2018-07-29 11:34:52.889 IST [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO
2018-07-29 11:34:52.889 IST [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...
Error starting chaincode error chaincode id not provided

In the tradeWorkflow.go file, I get
Cannot use 'twc' (type "demandresponsepoc/chaincode/src/github.com/trade_workflow".*TradeWorkflowChaincode) as type "demandresponsepoc/chaincode/src/github.com/trade_workflow/vendor/github.com/hyperledger/fabric/core/chaincode/shim".Chaincode more... (Ctrl+F1)
This is due to improper vendoring but the directory paths to be followed for vendoring is not easy to follow and I could not install vendor.

On the blockchain terminal, I get
"er0.consumerorg.demandresponse.com | 2018-07-29 05:10:08.992 UTC [gossip/election] waitForInterrupt -> DEBU 1318 [30 112 164 231 20 133 158 245 221 229 92 19 179 28 208 91 151 183 210 167 106 250 148 222 114 36 161 220 234 241 236 74] : Entering
peer0.consumerorg.demandresponse.com | 2018-07-29 05:10:11.064 UTC [dev-peer0.consumerorg.demandresponse.com-utilitycc-v0] func2 -> INFO 1319 2018-07-29 05:10:11.063 UTC [grpc] Printf -> DEBU 002 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup peer0.consumerorg.demandresponse.com on 127.0.1.1:53: no such host"; Reconnecting to {peer0.consumerorg.demandresponse.com:7052 }
peer0.utilityorg.demandresponse.com | 2018-07-29 05:10:11.063 UTC [dev-peer0.utilityorg.demandresponse.com-utilitycc-v0] func2 -> INFO 133f 2018-07-29 05:10:11.062 UTC [grpc] Printf -> DEBU 002 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup peer0.utilityorg.demandresponse.com on 127.0.1.1:53: no such host"; Reconnecting to {peer0.utilityorg.demandresponse.com:7052 }
peer0.utilityorg.demandresponse.com | 2018-07-29 05:10:11.067 UTC [dev-peer0.utilityorg.demandresponse.com-utilitycc-v0] func2 -> INFO 1340 2018-07-29 05:10:11.067 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: lookup peer0.utilityorg.demandresponse.com on 127.0.1.1:53: no such host"; Reconnecting to {peer0.utilityorg.demandresponse.com:7052 }
peer0.consumerorg.demandresponse.com | 2018-07-29 05:10:11.510 UTC [gossip/discovery] periodicalSendAlive -> DEBU 131a Sleeping 5s
peer0.utilityorg.demandresponse.com | 2018-07-29 05:10:11.617 UTC [gossip/discovery] periodicalSendAlive -> DEBU 1341 Sleeping 5s
peer0.consumerorg.demandresponse.com | 2018-07-29 05:10:11.925 UTC [dev-peer0.consumerorg.demandresponse.com-utilitycc-v0] func2 -> INFO 131b 2018-07-29 05:10:11.914 UTC [shim] userChaincodeStreamGetter -> ERRO 003 context deadline exceeded"

Any help in this would be great. I followed the book and that explained to me a lot that was not clear to me from the fabric docs.

Looking forward to your help.

Thanks

CHANNEL JOIN FAILED: TypeError: Cannot read property 'stack' of undefined at Client.newDefaultKeyValueStore

Hello,

I didn't manage to run successfully the application createTradeApp.js.
My environment is the following

  • Ubuntu Version 16.04

  • Nodejs set to 9.8.0 as per README

  • Hyperledger branch 1.1

  • the versions of both fabric-client and fabric-ca-client installed are "1.1.2" and grpc "1.10.1

  • I run successfully the Dev environment exercise .

  • For the 9 container JS application I applied the following steps

  • Delete client_certs, channel-artifacts, crypto-config folders in network
    ./trade.sh generate -c tradechannel within network to generate the channel and crypto material
    ./trade.sh up to start the network ( the 9 containers indeed start)
    node createTradeApp.js

the error is

CHANNEL JOIN FAILED: TypeError: Cannot read property 'stack' of undefined
at Client.newDefaultKeyValueStore.then.then.then.then (/root/go/src/github.com/hyperledger/trade-finance-logistics/middleware/join-channel.js:205:61)
at

Please help , I strongly want to learn from your book.
Thanks
Germal

docker ps
error
network.log.txt

Receiving "cryptogen tool not found. exiting" upon running ./trade.sh generate -c tradechannel

Hello,

After having some difficulty following and executing the commands in the book on my instance of Ubuntu 16.04, I decided to attempt to follow the GitHub documentation. Unfortunately, after running "./trade.sh generate -c tradechannel" inside the network folder, I get:

$ ./trade.sh generate -c tradechannel
Generating certs and genesis block with channel 'tradechannel'
Continue? [Y/n] Y
proceeding ...
cryptogen tool not found. exiting

I believe I followed all of the setup as written, as well, I ran make configtxgen cryptogen configtxlator in the fabric directory, as well as export PATH=$PATH:$GOPATH/src/github.com/hyperledger/fabric/build/bin to add it to the PATH. To double-check, I ran the make command again and got:

$ make configtxgen cryptogen configtxlator
make: Nothing to be done for 'configtxgen'.
make: Nothing to be done for 'cryptogen'.
make: Nothing to be done for 'configtxlator'.

Is there something wrong I might be doing? Sorry if there's something obvious I'm overlooking, I am new to using Docker. Thank you!

Issues in running curl commands for the application module

Hi

I ran the following curl command

curl -s -X POST http://localhost:4000/channel/join -H "authorization: Bearer auth-token"

I am getting the following error.

{"success":false,"message":"Cannot read property 'stack' of undefined"}

When I checked the error I am getting the following. Am I missing something.

Joining channel tradechannel
Successfully enrolled 'admin' user for org exporterorg
Successfully got the genesis block
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Cannot create ledger from genesis block, due to LedgerID already exists
at /home/akkalia/go/src/trade-finance-logistics/middleware/node_modules/fabric-client/lib/Peer.js:114:16
at /home/akkalia/go/src/trade-finance-logistics/middleware/node_modules/grpc/src/client.js:586:7
Failed join attempt: TypeError: Cannot read property 'stack' of undefined
at Client.newDefaultKeyValueStore.then.then.then.then (/home/akkalia/go/src/trade-finance-logistics/middleware/join-channel.js:205:61)
at

run the server

hey ,

who with witch ablility could run this software?

it is important to know ,who I gave this program to setup?

i'll be glad if answer me asap .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.