Giter Club home page Giter Club logo

blockchain-application-using-fabric-java-sdk's Introduction

NOTE: This repository has been archived and no longer maintained!

Create and deploy a blockchain network using Hyperledger Fabric SDK for Java

Set up and initialize the channel, install and instantiate chaincode, and perform invoke and query on your blockchain network

Blockchain is a shared, immutable ledger for recording the history of transactions. The Linux Foundation’s Hyperledger Fabric, the software implementation of blockchain IBM is committed to, is a permissioned network. Hyperledger Fabric is a platform for distributed ledger solutions underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability.

In a Blockchain solution, the Blockchain network works as a back-end with an application front-end to communicate with the network using a SDK. To set up the communication between front-end and back-end, Hyperledger Fabric community offers a number of SDKs for a wide variety of programming languages like the NodeJS SDK and Java SDK. This code pattern explains the methodology to create, deploy and test the blockchain network using Hyperledger Fabric SDK Java.

It would be helpful for the Java developers, who started to look into Hyperledger Fabric platform and would like to use Fabric SDK Java for their projects. The SDK helps facilitate Java applications to manage the lifecycle of Hyperledger channels and user chaincode. The SDK also provides a means to execute user chaincode, query blocks and transactions on the channel, and monitor events on the channel. This code pattern will help to get the process started to build a Hyperledger Fabric v1.4.1 Java application.

When the reader has completed this pattern, they will understand how to create, deploy and test a blockchain network using Hyperledger Fabric SDK Java. This pattern will provision a Hyperledger Fabric 1.4.1 network consisting of two organizations, each maintaining two peer node, two certificate authorities (ca) for each organization and a solo ordering service. The following aspects will be demonstrated in this code pattern:

  • Create and initialize channel
  • Install and instantiate chain code
  • Register and enroll the users
  • Perform invoke and query on the blockchain network.

Note: This code pattern builds a Hyperledger Fabric 1.4.1 network and uses Hyperledger Fabric SDK java 1.4.1 .

Flow

  1. Generate the artifacts using cryptogen and configtx for peers and channel in network. Currently these are already generated and provided in the code repository to use as-is.
  2. Build the network using docker-compose and the generated artifacts.
  3. Use Hyperledger Fabric Java SDK APIs to work with and manage the network.
    • Create and initialize the channel
    • Install and instantiate the chaincode
    • Register and enroll the users
    • Perform invoke and query to test the network

Included Components

  • Hyperledger Fabric: Hyperledger Fabric is a platform for distributed ledger solutions underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability.

  • Docker: Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.

  • Hyperledger Fabric Java SDK

Featured Technologies

  • Blockchain: A blockchain is a digitized, decentralized, public ledger of all transactions in a network.

  • Java: Java is a general-purpose computer-programming language that is concurrent, class-based and object-oriented.

Watch the Video

]

Pre-requisites

  • Docker
  • Docker Compose
  • Git Client - needed for clone commands
  • Maven - needed to build the client. Maven is a build automation tool used primarily for Java projects. Maven addresses two aspects of building software: first, it describes how software is built, and second, it describes its dependencies.

Steps

Follow these steps to setup and run this code pattern.

  1. Setup the Blockchain Network
  2. Build the client based on Fabric Java SDK
  3. Create and Initialize the channel
  4. Deploy and Instantiate the chaincode
  5. Register and enroll users
  6. Perform Invoke and Query on network

1. Setup the Blockchain Network

Clone this repo using the following command.

$ git clone https://github.com/IBM/blockchain-application-using-fabric-java-sdk

To build the blockchain network, the first step is to generate artifacts for peers and channels using cryptogen and configtx. The utilities used and steps to generate artifacts are explained here. In this pattern all required artifacts for the peers and channel of the network are already generated and provided to use as-is. Artifacts can be located at:

network_resources/crypto-config
network_resources/config

The automated scripts to build the network are provided under network directory. The network/docker-compose.yaml file defines the blockchain network topology. This pattern provisions a Hyperledger Fabric 1.4.1 network consisting of two organizations, each maintaining two peer node, two certificate authorities for each organization and a solo ordering service. Need to run the script as follows to build the network.

Note: Please clean up the old docker images (if any) from your environment otherwise you may get errors while setting up network.

cd network
chmod +x build.sh
./build.sh

To stop the running network, run the following script.

cd network
chmod +x stop.sh
./stop.sh

To delete the network completely, following script need to execute.

cd network
chmod +x teardown.sh
./teardown.sh

2. Build the client based on Fabric Java SDK

The previous step creates all required docker images with the appropriate configuration.

Java Client

  • The java client sources are present in the folder java of the repo.
  • Check your environment before executing the next step. Make sure, you are able to run mvn commands properly.

    If mvn commands fails, please refer to Pre-requisites to install maven.

To work with the deployed network using Hyperledger Fabric SDK java 1.4.1, perform the following steps.

  • Open a command terminal and navigate to the java directory in the repo. Run the command mvn install.

    cd ../java
    mvn install
    
  • A jar file blockchain-java-sdk-0.0.1-SNAPSHOT-jar-with-dependencies.jar is built and can be found under the target folder. This jar can be renamed to blockchain-client.jar to keep the name short.

    cd target
    cp blockchain-java-sdk-0.0.1-SNAPSHOT-jar-with-dependencies.jar blockchain-client.jar
    
  • Copy this built jar into network_resources directory. This is required as the java code can access required artifacts during execution.

    cp blockchain-client.jar ../../network_resources
    

3. Create and Initialize the channel

In this code pattern, we create one channel mychannel which is joined by all four peers. The java source code can be seen at src/main/java/org/example/network/CreateChannel.java. To create and initialize the channel, run the following command.

cd ../../network_resources
java -cp blockchain-client.jar org.example.network.CreateChannel

Output:

   INFO: Deleting - users
   Apr 20, 2018 5:11:45 PM org.example.network.CreateChannel main
   INFO: Channel created mychannel
   Apr 20, 2018 5:11:45 PM org.example.network.CreateChannel main
   INFO: peer0.org1.example.com at grpc://localhost:7051
   Apr 20, 2018 5:11:45 PM org.example.network.CreateChannel main
   INFO: peer1.org1.example.com at grpc://localhost:7056
   Apr 20, 2018 5:11:45 PM org.example.network.CreateChannel main
   INFO: peer0.org2.example.com at grpc://localhost:8051
   Apr 20, 2018 5:11:45 PM org.example.network.CreateChannel main
   INFO: peer1.org2.example.com at grpc://localhost:8056

4. Deploy and Instantiate the chaincode

This code pattern uses a sample chaincode fabcar to demo the usage of Hyperledger Fabric SDK Java APIs. To deploy and instantiate the chaincode, execute the following command.

java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode

Output:

   INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
   Apr 23, 2018 10:25:22 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code deployment SUCCESS
   Apr 23, 2018 10:25:22 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code deployment SUCCESS
   Apr 23, 2018 10:25:22 AM org.example.client.FabricClient deployChainCode
   INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
   Apr 23, 2018 10:25:22 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code deployment SUCCESS
   Apr 23, 2018 10:25:22 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code deployment SUCCESS
   Apr 23, 2018 10:25:22 AM org.example.client.ChannelClient instantiateChainCode
   INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
   Apr 23, 2018 10:25:22 AM org.example.client.ChannelClient instantiateChainCode
   INFO: Instantiating Chaincode ID fabcar on channel mychannel
   Apr 23, 2018 10:25:25 AM org.example.client.ChannelClient instantiateChainCode
   INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@723ca036[Not completed]
   Apr 23, 2018 10:25:25 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code instantiation SUCCESS
   Apr 23, 2018 10:25:25 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code instantiation SUCCESS
   Apr 23, 2018 10:25:25 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code instantiation SUCCESS
   Apr 23, 2018 10:25:25 AM org.example.network.DeployInstantiateChaincode main
   INFO: fabcar- Chain code instantiation SUCCESS

Note: The chaincode fabcar.go was taken from the fabric samples available at - https://github.com/hyperledger/fabric-samples/tree/release-1.4/chaincode/fabcar/go.

5. Register and enroll users

A new user can be registered and enrolled to an MSP. Execute the below command to register a new user and enroll to Org1MSP.

java -cp blockchain-client.jar org.example.user.RegisterEnrollUser

Output:

   INFO: Deleting - users
   log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
   log4j:WARN Please initialize the log4j system properly.
   log4j:WARN See https://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
   Apr 23, 2018 10:26:35 AM org.example.client.CAClient enrollAdminUser
   INFO: CA -http://localhost:7054 Enrolled Admin.
   Apr 23, 2018 10:26:35 AM org.example.client.CAClient registerUser
   INFO: CA -http://localhost:7054 Registered User - user1524459395783
   Apr 23, 2018 10:26:36 AM org.example.client.CAClient enrollUser
   INFO: CA -http://localhost:7054 Enrolled User - user1524459395783

6. Perform Invoke and Query on network

Blockchain network has been setup completely and is ready to use. Now we can test the network by performing invoke and query on the network. The fabcar chaincode allows us to create a new asset which is a car. For test purpose, invoke operation is performed to create a new asset in the network and query operation is performed to list the asset of the network. Perform the following steps to check the same.

java -cp blockchain-client.jar org.example.chaincode.invocation.InvokeChaincode

Output:

  INFO: CA -http://localhost:7054 Enrolled Admin.
  Apr 20, 2018 5:13:04 PM org.example.client.ChannelClient sendTransactionProposal
  INFO: Sending transaction proposal on channel mychannel
  Apr 20, 2018 5:13:04 PM org.example.client.ChannelClient sendTransactionProposal
  INFO: Transaction proposal on channel mychannel OK SUCCESS with transaction
  id:a298b9e27bdb0b6ca18b19f9c78a5371fb4d9b8dd199927baf37379537ca0d0f
  Apr 20, 2018 5:13:04 PM org.example.client.ChannelClient sendTransactionProposal
  INFO:
  Apr 20, 2018 5:13:04 PM org.example.client.ChannelClient sendTransactionProposal
  INFO: java.util.concurrent.CompletableFuture@22f31dec[Not completed]
  Apr 20, 2018 5:13:04 PM org.example.chaincode.invocation.InvokeChaincode main
  INFO: Invoked createCar on fabcar. Status - SUCCESS
java -cp blockchain-client.jar org.example.chaincode.invocation.QueryChaincode

Output:

    Apr 20, 2018 5:13:28 PM org.example.client.CAClient enrollAdminUser
    INFO: CA -http://localhost:7054 Enrolled Admin.
    Apr 20, 2018 5:13:29 PM org.example.chaincode.invocation.QueryChaincode main
    INFO: Querying for all cars ...
    Apr 20, 2018 5:13:29 PM org.example.client.ChannelClient queryByChainCode
    INFO: Querying queryAllCars on channel mychannel
    Apr 20, 2018 5:13:29 PM org.example.chaincode.invocation.QueryChaincode main
    INFO: [{"Key":"CAR1", "Record":{"make":"Chevy","model":"Volt","colour":"Red","owner":"Nick"}}]
    Apr 20, 2018 5:13:39 PM org.example.chaincode.invocation.QueryChaincode main
    INFO: Querying for a car - CAR1
    Apr 20, 2018 5:13:39 PM org.example.client.ChannelClient queryByChainCode
    INFO: Querying queryCar on channel mychannel
    Apr 20, 2018 5:13:39 PM org.example.chaincode.invocation.QueryChaincode main
    INFO: {"make":"Chevy","model":"Volt","colour":"Red","owner":"Nick"}
   

Troubleshooting

See DEBUGGING.md.

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

blockchain-application-using-fabric-java-sdk's People

Contributors

balajikadambi avatar dolph avatar horeaporutiu avatar imgbotapp avatar kant avatar ljbennett62 avatar maheshwarishikha avatar stevemart 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  avatar  avatar

blockchain-application-using-fabric-java-sdk's Issues

Is there a way to attach a listener for new data inserted into the channel?

How do I attach a listener to detect new data being pushed to the channel by any other client? In the example, its clear how to setup orgs, peers, users, channel, and finally, post and query data, however, I am not clear as to how to invoke a particular method when new data is added to a channel.

How do I start this project using byfn network?

I try to run this project using byfn network( which version is 1.4.3) so I start ./byfn.sh -m up, and copy artifacts like crypto-config, channel-artifacts. and I run java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode(I skip createChannel, because It already make 'mychannel'.) but this error comes out.

log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hyperledger.fabric.sdk.exception.TransactionException: INTERNAL
	at org.hyperledger.fabric.sdk.OrdererClient.sendDeliver(OrdererClient.java:286)
	at org.hyperledger.fabric.sdk.Orderer.sendDeliver(Orderer.java:165)
	at org.hyperledger.fabric.sdk.Channel.getLatestBlock(Channel.java:1074)
	at org.hyperledger.fabric.sdk.Channel.getConfigurationBlock(Channel.java:898)
	at org.hyperledger.fabric.sdk.Channel.parseConfigBlock(Channel.java:826)
	at org.hyperledger.fabric.sdk.Channel.initialize(Channel.java:526)
	at org.example.network.DeployInstantiateChaincode.main(DeployInstantiateChaincode.java:82)
Caused by: io.grpc.StatusRuntimeException: INTERNAL
	at io.grpc.Status.asRuntimeException(Status.java:540)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:392)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: io.netty.handler.codec.http2.Http2Exception: First received frame was not SETTINGS. Hex dump for first 5 bytes: 1503010002
	at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.verifyFirstFrameIsSettings(Http2ConnectionHandler.java:309)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:217)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:401)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:642)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:565)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:479)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	... 1 more

does anyone say about how I start this project using byfn network?

Error during channel creation

Hi....
I am facing the following issue while creating the channel. Please help me in this.
Thank you..

I created my own project with the help of this project
Steps I followed while running:

  • Go to network folder and issue the following command
  • cryptogen generate --config=./crypto-config.yaml
  • configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./config/genesis.block
  • configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./config/channel.tx -channelID lennahc
  • configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org1MSPanchors.tx channelID $CHANNEL_NAME -asOrg Org1MSP
  • configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org2MSPanchors.tx channelID $CHANNEL_NAME -asOrg Org2MSP
  • Updated docker-compose.yml
  • ./build.sh
  • cd ../java
  • mvn install
  • cd target
  • cp blockchain-java-sdk-0.0.1-SNAPSHOT-jar-with-dependencies.jar blockchain-client.jar
  • cp blockchain-client.jar ../../network_resources
  • cd ../../network_resources
  • java -cp blockchain-client.jar org.app.network.CreateChannel
    When I run this command I got the following

log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Sep 27, 2018 2:27:46 PM org.app.util.Util deleteDirectory
INFO: Deleting - users
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/administrator/eclipse-workspace/Peoplechain/network/blockchain-client.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
org.hyperledger.fabric.sdk.exception.TransactionException: New channel mychannel error. StatusValue 400. Status BAD_REQUEST
at org.hyperledger.fabric.sdk.Channel.(Channel.java:224)
at org.hyperledger.fabric.sdk.Channel.createNewInstance(Channel.java:1121)
at org.hyperledger.fabric.sdk.HFClient.newChannel(HFClient.java:135)
at org.app.network.CreateChannel.main(CreateChannel.java:60)

Cannot create channel

Hello,
I tried to creating the channel as follow java -cp blockchain-client.jar org.example.network.CreateChannel, but i keep getting this error :

log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. oct. 17, 2019 12:38:37 AM org.example.util.Util deleteDirectory INFOS: Deleting - users org.hyperledger.fabric.sdk.exception.TransactionException: Channel mychannel, send transaction failed on orderer OrdererClient{id: 4, channel: mychannel, name: orderer.example.com, url: grpc://localhost:7050}. Reason: UNAVAILABLE: io exception at org.hyperledger.fabric.sdk.OrdererClient.sendTransaction(OrdererClient.java:236) at org.hyperledger.fabric.sdk.Orderer.sendTransaction(Orderer.java:161) at org.hyperledger.fabric.sdk.Channel.sendUpdateChannel(Channel.java:531) at org.hyperledger.fabric.sdk.Channel.<init>(Channel.java:247) at org.hyperledger.fabric.sdk.Channel.createNewInstance(Channel.java:340) at org.hyperledger.fabric.sdk.HFClient.newChannel(HFClient.java:222) at org.example.network.CreateChannel.main(CreateChannel.java:76) Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at io.grpc.Status.asRuntimeException(Status.java:530) at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:434) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:694) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:397) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:459) at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:546) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:467) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:584) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/0:0:0:0:0:0:0:1:7050 at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source) at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:632) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 more Caused by: java.net.ConnectException: Connection refused: no further information
thanks for your help,

Error Input byte array has incorrect ending byte at 1748

We are using the SDK to connect to Amazon Managed Blockchain but the following error occurs:

java.lang.Exception: java.lang.IllegalArgumentException: Input byte array has incorrect ending byte at 1748
at org.hyperledger.fabric.sdk.Channel.sendProposalToPeers(Channel.java:4140)
at org.hyperledger.fabric.sdk.Channel.getConfigBlock(Channel.java:858)
at org.hyperledger.fabric.sdk.Channel.parseConfigBlock(Channel.java:1781)
at org.hyperledger.fabric.sdk.Channel.loadCACertificates(Channel.java:1618)
at org.hyperledger.fabric.sdk.Channel.initialize(Channel.java:1107)
atcom.transfesa.traceability.providers.DefaultChannelProvider.getLogisticChannelClient(DefaultChannelProvider.java:81)
at com.transfesa.traceability.services.ChannelService.getChainInfo(ChannelService.java:99)
at com.transfesa.traceability.controllers.ChainInfoController.getChainInfo(ChainInfoController.java:25)

We think that the error is because the certificate file supplied by Amazon (managedblockchain-tls-chain.pem) has two certificates when the normal is one. But this is a file supplied by Amazon.

Is it possible that the SDK is not able to handle a file with two certificates and needs only one?

Thanks

Losing actual error message sent by chaincode.

I am using fabric-gateway-java as dependency in my project which internally uses fabric-sdk-java.
In fabric-java-sdk we are losing actual error message that is sent by chaincode. Instead of actual error message we always get error like
"org.hyperledger.fabric.sdk.exception.ProposalException: org.hyperledger.fabric.sdk.exception.ServiceDiscoveryException: Could not meet endorsement policy for chaincode "

You can see it in Channel.java line number 4561 and 4698.
How can I get the original error message sent by chaincode?

CreateChannel Error!

Hello,
I tried to make fabric-network in five server, one order, four peer, and I change the config and docker-compose.yml files , when I use jar to CreateChannel on one peer, I get ERROR MESSAGE like that :
org.hyperledger.fabric.sdk.exception.TransactionException: Send transactions failed. Reason: timeout
at org.hyperledger.fabric.sdk.OrdererClient.sendTransaction(OrdererClient.java:163)
at org.hyperledger.fabric.sdk.Orderer.sendTransaction(Orderer.java:133)
at org.hyperledger.fabric.sdk.Channel.(Channel.java:222)
at org.hyperledger.fabric.sdk.Channel.createNewInstance(Channel.java:1121)
at org.hyperledger.fabric.sdk.HFClient.newChannel(HFClient.java:135)
at main.java.org.app.network.CreateChannel.main(CreateChannel.java:76)

Docker failed under Windows 10

I was using the latest Docker Toolbox 2018.06.1 under Windows 10 x64.

Following the steps in the README of this repo, when I tried to create the network by running the following command:

sh build.sh

The output info is ok, but when I ran docker ps -a and got the following info:

   docker ps  -a                                                                      
ONTAINER ID        IMAGE                                     COMMAND                
 CREATED             STATUS                      PORTS                    NAMES     
a548b8b0c91        hyperledger/fabric-peer:x86_64-1.1.0      "peer node start"      
 24 seconds ago      Exited (1) 21 seconds ago                            peer0.org2
example.com                                                                         
a4c3ab4baa8        hyperledger/fabric-peer:x86_64-1.1.0      "peer node start"      
 24 seconds ago      Exited (1) 21 seconds ago                            peer1.org1
example.com                                                                         
6029c9bd1b6        hyperledger/fabric-peer:x86_64-1.1.0      "peer node start"      
 24 seconds ago      Exited (1) 22 seconds ago                            peer1.org2
example.com                                                                         
03a8be35f58        hyperledger/fabric-peer:x86_64-1.1.0      "peer node start"      
 24 seconds ago      Exited (1) 22 seconds ago                            peer0.org1
example.com                                                                         
bf4f0888380        hyperledger/fabric-orderer:x86_64-1.1.0   "orderer"              
 26 seconds ago      Exited (1) 23 seconds ago                            orderer.ex
mple.com                                                                            
35b11a85b11        hyperledger/fabric-ca:x86_64-1.1.0        "sh -c 'fabric-ca-se…" 
 26 seconds ago      Up 24 seconds               0.0.0.0:7054->7054/tcp   ca_peerOrg
                                                                                    
903462614f0        hyperledger/fabric-ca:x86_64-1.1.0        "sh -c 'fabric-ca-se…" 
 26 seconds ago      Up 24 seconds               0.0.0.0:8054->7054/tcp   ca_peerOrg

Some services are not running.

PS: I assigned 4G mem to the virtulbox vm when I created the machine.

How do I modify the java source code and apply it?

After modifying the config.java file, I ran the java -cp blockchain-client.jar org.app.network.CreateChannel command. However, it says that it can not find or load the base class org.app.network.CreateChannel.

If I want to use the changed source, can you tell me what the process should be?

how to create new organization and peers?

May I ask how to create new organization and peers?

How to create new organization and add new peer?

Can I change the pear name? like change peer0.org1.example.com to userName.projectName.myCompanyName.com?

Thank you for your help!

Error when invoke chaincode

Hi team,
I get error "java.lang.NullPointerException" when Invoke or query chaincode.
The output:
$ java -cp blockchain-client.jar org.app.chaincode.invocation.InvokeChaincode
Mar 01, 2019 4:35:09 PM org.app.util.Util deleteDirectory INFO: Deleting - admin.ser Mar 01, 2019 4:35:09 PM org.app.util.Util deleteDirectory INFO: Deleting - org1 Mar 01, 2019 4:35:09 PM org.app.util.Util deleteDirectory INFO: Deleting - users log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Mar 01, 2019 4:35:11 PM org.app.client.CAClient enrollAdminUser INFO: CA -http://localhost:7054 Enrolled Admin. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/Users/bapvn/blockchain-application-using-fabric-java-sdk/network_resources/blockchain-client.jar) to field java.nio.Buffer.address WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Mar 01, 2019 4:35:12 PM org.app.client.ChannelClient sendTransactionProposal INFO: Sending transaction proposal on channel mychannel org.hyperledger.fabric.sdk.exception.InvalidArgumentException: java.lang.NullPointerException at org.hyperledger.fabric.sdk.ProposalResponse.getProposalResponsePayloadDeserializer(ProposalResponse.java:59) at org.hyperledger.fabric.sdk.ProposalResponse.getChaincodeActionResponsePayload(ProposalResponse.java:200) at org.app.client.ChannelClient.sendTransactionProposal(ChannelClient.java:121) at org.app.chaincode.invocation.InvokeChaincode.main(InvokeChaincode.java:88) Caused by: java.lang.NullPointerException at org.hyperledger.fabric.sdk.ProposalResponse.getProposalResponsePayloadDeserializer(ProposalResponse.java:57) ... 3 more

Im using java version "11.0.1" 2018-10-16 LTS, hyperledger fabric v1.1 and fabric-sdk-java v1.0.0
Please help me.

Wrong 'package name' convention: org.app.*

I see that below package name is used.

package org.app.network;

The above package name to be used ONLY if the authors OWN the domain name app.org. Otherwise, please make use of something you all own OR org.example.*

The idea behind package naming is that the package name must be UNIQUE universally.
If somebody owns mycompany.com, then then have the RIGHTS to make use of the package name com.mycompany.*. Otherwise, they should not.

Since, the internet domain name hyperledger.org has already been registered and OWNED by the Linux Foundation, they've the RIGHTS to make use of the domain name.

Create/Enroll User Eclipse Problem

Hi
I tried to run (for a project) some class of this code on Eclipse. In particular i copied RegisterEnrollUser.java and all import that it needs ( CAClient.java - CAEnrollment.java - Config.java - Util.java - UserContext.java that i rename UserImpl.java and other class).
Now i change caUrl with my IP address with :7054 port and i disabled the firewall of that port.
Now if i run the code i get the following error and i don't know what can i do for fix it:

INFORMAZIONI: Deleting - users
log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hyperledger.fabric_ca.sdk.exception.EnrollmentException: Url:http://51.68.95.34:7054, Failed to enroll user admin
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:518)
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:422)
at it.ivert.bctest.CAClient.enrollAdminUser(CAClient.java:80)
at it.ivert.bctest.App.main(App.java:219)
Caused by: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.hyperledger.fabric_ca.sdk.HFCAClient.httpPost(HFCAClient.java:1319)
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:478)
... 3 more
Caused by: org.apache.http.ProtocolException: The server failed to respond with a valid HTTP response
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:149)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
... 7 more
some one can help me pls?

Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced

Question

Hi, I re-generate materials with instructions as specified in build.sh file, but I came across error when I do configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./config/genesis.block under the directory $HOME/blockchain-application-using-fabric-java-sdk/network.

background

The configtxgen version is v1.4.1
The $Home/blockchain-application-using-fabric-java-sdk/network has 6 files and 2 directories as follows:
build.sh config configtx.yaml crypto-config crypto-config.yaml docker-compose.yml stop.sh teardown.sh

some logs

The following are printed log:
2019-10-08 06:03:44.367 EDT [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced 2019-10-08 06:03:44.367 EDT [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced panic: Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced [recovered] panic: Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced

Any help will be appreciated.

blockchain-application-using-fabric-java-sdk

after deploy the maven environment and build the network, I reach the 4th step, Deploy and Instantiate the chaincode, then I meet the tricky problem,
java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode
log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/Users/dongshengwang/Downloads/hf/blockchain/blockchain-application-using-fabric-java-sdk/network_resources/blockchain-client.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sep. 06, 2019 5:00:34 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
Sep. 06, 2019 5:00:35 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Sep. 06, 2019 5:00:35 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Sep. 06, 2019 5:00:35 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
Sep. 06, 2019 5:00:35 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Sep. 06, 2019 5:00:35 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Sep. 06, 2019 5:00:35 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
Sep. 06, 2019 5:00:35 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiating Chaincode ID fabcar on channel mychannel
Sep. 06, 2019 5:08:33 PM org.example.client.ChannelClient instantiateChainCode
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@58670130[Completed exceptionally: java.lang.IllegalArgumentException: The proposal responses have 0 inconsistent groups with 4 that are invalid. Expected all to be consistent and none to be invalid.]
Sep. 06, 2019 5:08:33 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 5:08:33 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 5:08:33 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 5:08:33 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE

then I type sudo dd if=/dev/zero
Password:
^
^C1715220+0 records in
1715219+0 records out
878192128 bytes transferred in 28.495019 secs (30819145 bytes/sec)

looks like the virtual memory has increased a lot, then I type:
java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode

log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/Users/dongshengwang/Downloads/hf/blockchain/blockchain-application-using-fabric-java-sdk/network_resources/blockchain-client.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sep. 06, 2019 10:37:59 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
Sep. 06, 2019 10:37:59 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:37:59 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:37:59 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
Sep. 06, 2019 10:37:59 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:37:59 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:37:59 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
Sep. 06, 2019 10:37:59 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiating Chaincode ID fabcar on channel mychannel
Sep. 06, 2019 10:38:05 PM org.example.client.ChannelClient instantiateChainCode
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@459f7aa3[Not completed]
Sep. 06, 2019 10:38:05 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation SUCCESS
Sep. 06, 2019 10:38:05 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation SUCCESS
Sep. 06, 2019 10:38:05 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation SUCCESS
Sep. 06, 2019 10:38:05 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation SUCCESS

Seems like the virtual memory contribute to this problem, then I just type:java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode

log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/Users/dongshengwang/Downloads/hf/blockchain/blockchain-application-using-fabric-java-sdk/network_resources/blockchain-client.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sep. 06, 2019 10:38:40 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:38:41 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment FAILURE
Sep. 06, 2019 10:38:41 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
Sep. 06, 2019 10:38:41 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiating Chaincode ID fabcar on channel mychannel
Sep. 06, 2019 10:38:41 PM org.example.client.ChannelClient instantiateChainCode
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@f27ea3[Completed exceptionally: java.lang.IllegalArgumentException: The proposal responses have 0 inconsistent groups with 4 that are invalid. Expected all to be consistent and none to be invalid.]
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Sep. 06, 2019 10:38:41 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE

then no matter how many times I type the same command, it just comes out FAILURE,
something happens inside the memory I guess.

My environment is: Majove 10.14.6 (18G87) 16 GB 1600 MHz DDR3
java version "12" 2019-03-19
Java(TM) SE Runtime Environment (build 12+33)
Java HotSpot(TM) 64-Bit Server VM (build 12+33, mixed mode, sharing)

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T06:00:29+11:00)
Java version: 12, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "Mac"

Docker version 19.03.2, build 6a30dfc

Register and enroll user

I'm sorry to bother you. When I executed RegisterEnrollUser.java, user-****.ser file is generated.What‘s the effect of the generated new file?

Looks like it does not support TLS enabled network

When I am using the grpcs other than grpc, it throws error like java.security.cert.CertificateException: No subject alternative DNS name matching localhost found.
Any ideas? Or do we have roadmap to support TLS and HTTPS? Thanks.

Deploy and Instantiate the chaincode when I run the command

java -cp blockchain-client.jar org.app.network.DeployInstantiateChaincode

When I run this command I met this error i can't solve:
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@8692d67[Completed exceptionally: org.hyperledger.fabric.sdk.exception.InvalidArgumentException: java.lang.NullPointerException]
Apr 28, 2019 1:22:06 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 28, 2019 1:22:06 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 28, 2019 1:22:06 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 28, 2019 1:22:06 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE

Problem enrolling when using Identity Mixer

Hi guys~

Have you ever tried the feature Identity Mixer added in version 1.3.0? When I modified this example to use this feature, I get this error on the fabric-ca side:

[ERROR] Failed to update level of user: No rows were affected when updating the state of identity

Below is the place where I modified this example:
In the function org.example.client.CAClient#enrollAdminUser, I added the second line

103		Enrollment adminEnrollmentTmp = instance.enroll(username, password);
104		Enrollment adminEnrollment = instance.idemixEnroll(adminEnrollmentTmp, "Org1MSPidemix");

Do you have any suggestions? Thanks~

DeployInstantiateChaincode problem

i try to create and deploy blockchain network using fabric-java-sdk, but got problems when run " java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode", and retry to stop and build the network again, but still failure.

any advice are appreciate!!!!

[root@localhost network]# ./build.sh

Stopping the previous network (if any)
Removing peer1.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer0.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing ca_peerOrg1 ... done
Removing ca_peerOrg2 ... done
Removing orderer.example.com ... done
Removing network network_custom

Setting up the Hyperledger Fabric 1.1 network
Creating network "network_custom" with the default driver
Creating ca_peerOrg1 ... done
Creating ca_peerOrg2 ... done
Creating orderer.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org1.example.com ... done
Creating peer0.org1.example.com ... done
Creating peer1.org2.example.com ... done

Network setup completed!!

[root@localhost network]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9fdc2a834577 hyperledger/fabric-peer:1.4.1 "peer node start" 20 seconds ago Up 18 seconds 0.0.0.0:8056->7051/tcp, 0.0.0.0:8058->7053/tcp peer1.org2.example.com
76c3c0da88b9 hyperledger/fabric-peer:1.4.1 "peer node start" 20 seconds ago Up 18 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
c3501becd945 hyperledger/fabric-peer:1.4.1 "peer node start" 20 seconds ago Up 18 seconds 0.0.0.0:7056->7051/tcp, 0.0.0.0:7058->7053/tcp peer1.org1.example.com
42538ad535b0 hyperledger/fabric-peer:1.4.1 "peer node start" 20 seconds ago Up 18 seconds 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.org2.example.com
c4030f410fe7 hyperledger/fabric-orderer:1.4.1 "orderer" 21 seconds ago Up 20 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
0dced0a6d00b hyperledger/fabric-ca:1.4.1 "sh -c 'fabric-ca-..." 21 seconds ago Up 20 seconds 0.0.0.0:8054->7054/tcp ca_peerOrg2
ecd36494b32f hyperledger/fabric-ca:1.4.1 "sh -c 'fabric-ca-..." 21 seconds ago Up 20 seconds 0.0.0.0:7054->7054/tcp ca_peerOrg1

[root@localhost network_resources]# java -cp blockchain-client.jar org.example.network.CreateChannel
log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Apr 12, 2021 5:05:35 PM org.example.util.Util deleteDirectory
INFO: Deleting - users
Apr 12, 2021 5:05:38 PM org.example.network.CreateChannel main
INFO: Channel created mychannel
Apr 12, 2021 5:05:38 PM org.example.network.CreateChannel main
INFO: peer0.org2.example.com at grpc://localhost:8051
Apr 12, 2021 5:05:38 PM org.example.network.CreateChannel main
INFO: peer1.org1.example.com at grpc://localhost:7056
Apr 12, 2021 5:05:38 PM org.example.network.CreateChannel main
INFO: peer1.org2.example.com at grpc://localhost:8056
Apr 12, 2021 5:05:38 PM org.example.network.CreateChannel main
INFO: peer0.org1.example.com at grpc://localhost:7051

[root@localhost network_resources]# java -cp blockchain-client.jar org.example.network.DeployInstantiateChaincode
log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Apr 12, 2021 5:05:49 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
Apr 12, 2021 5:05:50 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Apr 12, 2021 5:05:50 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Apr 12, 2021 5:05:50 PM org.example.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
Apr 12, 2021 5:05:50 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Apr 12, 2021 5:05:50 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Apr 12, 2021 5:05:50 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
Apr 12, 2021 5:05:50 PM org.example.client.ChannelClient instantiateChainCode
INFO: Instantiating Chaincode ID fabcar on channel mychannel
Apr 12, 2021 5:06:08 PM org.example.client.ChannelClient instantiateChainCode
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@4dd6fd0a[Completed exceptionally]
Apr 12, 2021 5:06:08 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 12, 2021 5:06:08 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 12, 2021 5:06:08 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE
Apr 12, 2021 5:06:08 PM org.example.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE

Output doesn't match with the data in the ledger

Thank you Balaji for share the resource. I have a query regarding the output I got.

Everything worked as said in the read me, but the output data is not the same as the ledger data. Am I doing anything wrong?
Output I got by running this chaincode "java -cp blockchain-client.jar org.app.chaincode.invocation.QueryChaincode" is
INFO: {"make":"Chevy","model":"Volt","colour":"Red","owner":"Nick"}
But I couldn't find the same in the init part of the .go code in the fabcar sample.
Do i need to persist the same into the ledger first? If yes, is there any API in the code sample to do that?
Thank you

endorsement policies

I'm sorry to bother you . I want to add an endorsement policies to the code. What should I do?

How to use CA?

I want to use CA, but I dont know how to make CA config . And I got this Error:
an 07, 2019 10:35:32 AM main.java.org.app.util.Util deleteDirectory
INFO: Deleting - users
org.hyperledger.fabric_ca.sdk.exception.EnrollmentException: Url:http://192.168.7.107:7054, Failed to enroll user admin
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:346)
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:254)
at main.java.org.app.client.CAClient.enrollAdminUser(CAClient.java:103)
at main.java.org.app.chaincode.invocation.InvokeChaincode.addRule(InvokeChaincode.java:302)
at main.java.org.app.chaincode.invocation.InvokeChaincode.main(InvokeChaincode.java:60)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 192.168.7.107:7054 [/192.168.7.107] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.hyperledger.fabric_ca.sdk.HFCAClient.httpPost(HFCAClient.java:565)
at org.hyperledger.fabric_ca.sdk.HFCAClient.enroll(HFCAClient.java:307)
... 4 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
... 15 more

Something wrong when i use DeployInstantiateChaincode

When I run DeployInstantiateChaincode for the first time,i met this and i dont know why
16:47:27.894 [main] ERROR org.hyperledger.fabric.sdk.Channel - Channel Channel{id: 1, name: mychannel} sending proposal with transaction 858e3874edde327995944626218586baddb8100d9bafc1b1603e2e73a8887d2c to Peer{ id: 3, name: peer0.org1.example.com, channelName: mychannel, url: grpc://0.0.0.0:7051} failed because of timeout(10000 milliseconds) expiration java.util.concurrent.TimeoutException: Waited 10000 milliseconds for io.grpc.stub.ClientCalls$GrpcFuture@7d446ed1[status=PENDING, info=[GrpcFuture{clientCall={delegate={delegate=ClientCallImpl{method=MethodDescriptor{fullMethodName=protos.Endorser/ProcessProposal, type=UNARY, idempotent=false, safe=false, sampledToLocalTracing=true, requestMarshaller=io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@d771cc9, responseMarshaller=io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller@36b4091c, schemaDescriptor=org.hyperledger.fabric.protos.peer.EndorserGrpc$EndorserMethodDescriptorSupplier@4671115f}}}}}]] at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:471) at org.hyperledger.fabric.sdk.Channel.sendProposalToPeers(Channel.java:4108) at org.hyperledger.fabric.sdk.Channel.sendInstantiationProposal(Channel.java:2520) at org.hyperledger.fabric.sdk.Channel.sendInstantiationProposal(Channel.java:2480) at org.app.client.ChannelClient.instantiateChainCode(ChannelClient.java:198) at org.app.network.DeployInstantiateChaincode.main(DeployInstantiateChaincode.java:124) Sept 05, 2019 4:47:28 PM org.app.client.ChannelClient instantiateChainCode INFO: Chaincode mycc_test on channel mychannel instantiation java.util.concurrent.CompletableFuture@65b104b9[Completed exceptionally] Sept 05, 2019 4:47:28 PM org.app.network.DeployInstantiateChaincode main INFO: mycc_test- Chain code instantiation FAILURE Sept 05, 2019 4:47:28 PM org.app.network.DeployInstantiateChaincode main INFO: mycc_test- Chain code instantiation FAILURE Sept 05, 2019 4:47:28 PM org.app.network.DeployInstantiateChaincode main INFO: mycc_test- Chain code instantiation FAILURE Sept 05, 2019 4:47:28 PM org.app.network.DeployInstantiateChaincode main INFO: mycc_test- Chain code instantiation FAILURE
but when i try to run twice or more it can work.

Java Chaincode remote debug

I am looking for Java chaincode remote debugging setup/configuration
Expectation:

  1. Able to do hit breakpoint/ line debug java chaincode on my local machine.
  2. connect local code to remote chaincode via 'java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000'

Environment:

  1. Fabric networking running on local machine via docker compose (Fabcar) network
  2. Two Peer / each Org (Two Org), raft ordered, cli, couchdb
  3. Java chaincode deployment on peer.
  4. Able to call query on chaindode

Configuration:

  1. Peer compose yaml property set to : 'command: peer node start --peer-chaincodedev=true'
  2. Peer compose yaml property set to: CORE_CHAINCODE_LOGGING_LEVEL=DEBUG

Observation: on chaincode container 'dev-peer0.org1.example.com-fabcarv1-99a85fb372cb80ca5efcc11f7dc3debe3bcec4fd8b22b81cae9273ca43332265'
Files under location: /root/chaincode-java

  1. build.sh chaincode lib start
  2. Below is the script in above mentioned 'start' script
    #!/usr/bin/env bash
    set -ex

ROOT_DIR=/root/chaincode-java
LIB_DIR=${ROOT_DIR}/lib
CHAINCODE_DIR=${ROOT_DIR}/chaincode
LIB_JARS=$(find ${LIB_DIR} -name ".jar" | paste -s -d ":" -)
CHAINCODE_JARS=$(find ${CHAINCODE_DIR} -name "
.jar" | paste -s -d ":" -)
NUM_CHAINCODE_JARS=$(find ${CHAINCODE_DIR} -name "*.jar" | wc -l)

if [ -f ${CHAINCODE_DIR}/.uberjar ]; then
if [ ${NUM_CHAINCODE_JARS} -ne 1 ]; then
>&2 echo "Cannot start uber JAR as more than one JAR file was found in the chaincode directory"
exit 255
fi
exec java -jar ${CHAINCODE_JARS} "$@"
else
exec java -cp ${CHAINCODE_JARS}:${LIB_JARS} org.hyperledger.fabric.contract.ContractRouter "$@"
fi

How to perform the below steps:

  1. how to add jvm argument xdebug in start scrip? so that it will open debug port

Proposal response is invalid error when I invoke chaincode

when i execute java -cp blockchain-client.jar org.example.chaincode.invocation.InvokeChaincode, then
root@fabric-VirtualBox:~/go/src/IBM/blockchain-application-using-fabric-java-sdk/network_resources# java -cp blockchain-client.jar org.example.chaincode.invocation.InvokeChaincode Oct 03, 2019 9:38:44 PM org.example.util.Util deleteDirectory INFO: Deleting - admin.ser Oct 03, 2019 9:38:45 PM org.example.util.Util deleteDirectory INFO: Deleting - user1570109909538.ser Oct 03, 2019 9:38:45 PM org.example.util.Util deleteDirectory INFO: Deleting - org1 Oct 03, 2019 9:38:45 PM org.example.util.Util deleteDirectory INFO: Deleting - users log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Oct 03, 2019 9:38:47 PM org.example.client.CAClient enrollAdminUser INFO: CA -http://localhost:7054 Enrolled Admin. Oct 03, 2019 9:38:50 PM org.example.client.ChannelClient sendTransactionProposal INFO: Sending transaction proposal on channel mychannel org.hyperledger.fabric.sdk.exception.InvalidArgumentException: Proposal response is invalid. at org.hyperledger.fabric.sdk.ProposalResponse.getChaincodeActionResponsePayload(ProposalResponse.java:272) at org.example.client.ChannelClient.sendTransactionProposal(ChannelClient.java:121) at org.example.chaincode.invocation.InvokeChaincode.main(InvokeChaincode.java:88)

InvokeChaincode.java line 51 Util.cleanUp() empty the network_resources/users/

How to get cli installed?

  cli:
    container_name: cli
    image: hyperledger/fabric-tools:x86_64-1.1.0
    tty: true
    environment:
      - GOPATH=/Users/myUserName/go
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    ports:
      - 7050:7050
    volumes:
        - /var/run/:/host/var/run/
        - ../network_resources/config/:/etc/hyperledger/configtx
        - ../network_resources/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer
        - ../network_resources/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peerOrg1
        - ../network_resources/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peerOrg2
    volumes:
        ??
    depends_on:
      - orderer.example.com
      - peer0.org1.example.com
      - peer1.org1.example.com
      - peer0.org2.example.com
      - peer1.org2.example.com

I want to use cli container to execute some command, to get information from running fabric.
And I added config code above in network/docker-compose.yml.
But not sure about this docker-compose.yml config file, Is this right?

CreateChannel Error when I re-generate the artifacts

Hi....
I am facing the following issue while creating the channel. Please help me in this.
Thank you..

I created my own project with the help of this project
Steps I followed while running:

Go to network folder and issue the following command
cryptogen generate --config=./crypto-config.yaml
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./config/genesis.block
configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./config/channel.tx -channelID lennahc
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org1MSPanchors.tx channelID $CHANNEL_NAME -asOrg Org1MSP
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org2MSPanchors.tx channelID $CHANNEL_NAME -asOrg Org2MSP
Updated docker-compose.yml
./build.sh
cd ../java
mvn install
cd target
cp blockchain-java-sdk-0.0.1-SNAPSHOT-jar-with-dependencies.jar blockchain-client.jar
cp blockchain-client.jar ../../network_resources
cd ../../network_resources
java -cp blockchain-client.jar org.app.network.CreateChannel

When I run this command I met this error:
org.hyperledger.fabric.sdk.exception.TransactionException: New channel mychannel error. StatusValue 400. Status BAD_REQUEST
at org.hyperledger.fabric.sdk.Channel.(Channel.java:224)
at org.hyperledger.fabric.sdk.Channel.createNewInstance(Channel.java:1121)
at org.hyperledger.fabric.sdk.HFClient.newChannel(HFClient.java:135)
at org.app.network.CreateChannel.main(CreateChannel.java:60)

fabric 1.1 and 1.2 is not supported

hi:
thanks for the contribution of this java sdk demo, it is very helpfull.
unfortunately fabric 1.1.0 and 1.2.0 is not supported in this repo.
can you upgrade the code to 1.1.0 and 1.2.0?
cause when i change the version of fabric-sdk-java from 1.0.0 to 1.1.0 or 1.2.0
bad things happens like this:

screenshot from 2018-08-29 16-06-24

Memory leak in instantiateChainCode

Instantiating the chaincode causes program to hang and eating up all OS memory until in cause OS to become unresponsive. It seems that it is keeps allocating some memory till it is completely consumed. Below are the printout of the DeployInstantiateChaincode method execution..

$ java -cp blockchain-client.jar org.app.network.DeployInstantiateChaincode
log4j:WARN No appenders could be found for logger (org.hyperledger.fabric.sdk.helper.Config).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jul 30, 2018 12:41:20 AM org.app.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org1MSP admin
Jul 30, 2018 12:41:21 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Jul 30, 2018 12:41:21 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Jul 30, 2018 12:41:21 AM org.app.client.FabricClient deployChainCode
INFO: Deploying chaincode fabcar using Fabric client Org2MSP admin
Jul 30, 2018 12:41:21 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Jul 30, 2018 12:41:21 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code deployment SUCCESS
Jul 30, 2018 12:41:21 AM org.app.client.ChannelClient instantiateChainCode
INFO: Instantiate proposal request fabcar on channel mychannel with Fabric client Org2MSP admin
Jul 30, 2018 12:41:21 AM org.app.client.ChannelClient instantiateChainCode
INFO: Instantiating Chaincode ID fabcar on channel mychannel

hangs here and after a while it eats up all OS memory

Testing it on another setup (with bigger memory, 2GB) dips at the same point but after some time gives a failure as below

Jul 30, 2018 2:41:27 AM org.app.client.ChannelClient instantiateChainCode
INFO: Chaincode fabcar on channel mychannel instantiation java.util.concurrent.CompletableFuture@26d9b808[Completed exceptionally]
Jul 30, 2018 2:41:27 AM org.app.network.DeployInstantiateChaincode main
INFO: fabcar- Chain code instantiation FAILURE

Setup used in testing

RAM | 1GB and 2GB
java | "1.8.0_181"
Apache Maven | 3.5.0
Docker | 18.06.0-ce
Docker-compose |1.21.2

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.