farbic-sdk-java 学习部署

farbic-sdk-java 学习部署最近在学习fabric,用到了fabric-sdk-java,根据官网和网上资源发现部署的时候,多少会出现点小问题,写一点安装测试步骤记录自己的填坑历程。准备工作1.fabric基础网络环境2.环境准备(jdk环境、maven环境)3.启动fabric测试网络4.在idea中测试java-

大家好,欢迎来到IT知识分享网。

最近在学习fabric,用到了fabric-sdk-java,根据官网和网上资源发现部署的时候,多少会出现点小问题,写一点安装测试步骤记录自己的填坑历程。

准备工作

1.fabric基础网络环境

2.环境准备(jdk环境、maven环境)

3.启动fabric测试网络

4.在idea中测试java-sdk

1.fabric环境准备

1.fabric基础环境搭建可以参考

farbic-sdk-java 学习部署

2.farbic-sdk-java下载

1)Linux端下

使用git命令拉取fabric-sdk-java(可以参考下面的命令拉取fabric-sdk-java)

2)windows下

下载fabric-sdk-java到本地

fabric-sdk-java下载地址:

https://github.com/hyperledger/fabric-sdk-java

2.启动fabric测试网络

1.虚拟机操作

1)进入到hyperledger目录下

cd /opt/gopath/src/github.com/hyperledger/

2)拉取fabric-sdk-java

git clone https://github.com/hyperledger/fabric-sdk-java.git

3)fabric-sdk-java切换版本

前面配置fabric基础网络环境时版本是1.4,现在把fabric-sdk-java也切换到1.4

cd fabric-sdk-java/
git checkout release-1.4

 

进入到sdkimtergration目录下

cd fabric-sdk-java/src/test/fixture/sdkintegration

启动fabric运行网络

./fabric.sh up

3)查看网络是否启起来

[test@localhost sdkintegration]$ docker ps
CONTAINER ID        IMAGE                                                                                                         COMMAND                  CREATED             STATUS              PORTS                                            NAMES
8da8bace46ac        dev-peer1.org2.example.com-example_cc_go-1-1dbf3702231b0531018ca9897a018aeeeda328baf3231fc954eab3e4782abc37   "chaincode -peer.add…"   About an hour ago   Up About an hour                                                     dev-peer1.org2.example.com-example_cc_go-1
bd7d2f82cb03        dev-peer0.org2.example.com-example_cc_go-1-3c2a2377e528f3aae999f225b6e8a89e740e3a9ee5b9403c5810bcca3cb0ba58   "chaincode -peer.add…"   About an hour ago   Up About an hour                                                     dev-peer0.org2.example.com-example_cc_go-1
3ddb7e0948a0        dev-peer0.org1.example.com-example_cc_go-1-9048c042a4f98161a88838372c92cf78946523a4efcf5c7707e9507e0419e48d   "chaincode -peer.add…"   About an hour ago   Up About an hour                                                     dev-peer0.org1.example.com-example_cc_go-1
0f96b30335ad        dev-peer1.org1.example.com-example_cc_go-1-0af7027a19fe7e81c60a641169dd1deffbbd214aa1463c9793db5cbde6374f82   "chaincode -peer.add…"   About an hour ago   Up About an hour                                                     dev-peer1.org1.example.com-example_cc_go-1
5f8f1a54bbeb        hyperledger/fabric-peer:1.4                                                                                   "peer node start"        About an hour ago   Up About an hour    0.0.0.0:7056->7056/tcp, 0.0.0.0:7058->7058/tcp   peer1.org1.example.com
4593fd69c531        hyperledger/fabric-peer:1.4                                                                                   "peer node start"        About an hour ago   Up About an hour    0.0.0.0:8056->8056/tcp, 0.0.0.0:8058->8058/tcp   peer1.org2.example.com
ddb1504b45c0        hyperledger/fabric-peer:1.4                                                                                   "peer node start"        About an hour ago   Up About an hour    0.0.0.0:8051->8051/tcp, 0.0.0.0:8053->8053/tcp   peer0.org2.example.com
b3ab4e9410dc        hyperledger/fabric-peer:1.4                                                                                   "peer node start"        About an hour ago   Up About an hour    0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.example.com
44f9ffae2175        hyperledger/fabric-tools:1.4                                                                                  "/usr/local/bin/conf…"   About an hour ago   Up About an hour    0.0.0.0:7059->7059/tcp                           configtxlator
022fe88a7e7e        hyperledger/fabric-ca:1.4                                                                                     "bash -c 'cp -R /tmp…"   About an hour ago   Up About an hour    0.0.0.0:8054->7054/tcp                           ca_peerOrg2
ee1b66b3eb0d        hyperledger/fabric-ca:1.4                                                                                     "bash -c 'cp -R /tmp…"   About an hour ago   Up About an hour    0.0.0.0:7054->7054/tcp                           ca_peerOrg1
572dd38d767c        hyperledger/fabric-orderer:1.4                                                                                "orderer"                About an hour ago   Up About an hour    0.0.0.0:7050->7050/tcp       

fabric-sdk-java所需网络环境已经完成。

3.环境准备(windows环境要求)

1.jdk安装

找到cmd命令命令符,输入java -version

C:\Users\zzq>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed m

farbic-sdk-java 学习部署

2.maven安装

可以参考别人对maven的介绍和安装教程

farbic-sdk-java 学习部署

查看maven是否安装成功

farbic-sdk-java 学习部署

3.idea安装

4.idea导入fabric-sdk-java

把下载好的fabric-sdk-java包解压缩,然后把项目导入到idea中。

farbic-sdk-java 学习部署

 

点击file->settting,设置maven仓库路径

进入到Maven,分别设置Maven安装目录,settings.xml文件和repository。

farbic-sdk-java 学习部署

settings.xml文件在 安装的maven/conf目录下,如D:\apache-maven-3.6.3\conf

可以在maven目录下新建repository文件文件夹(首次使用maven)。

4.在idea中测试java-sdk

设置好maven仓库后,点击fabric-sdk-java下的pom.xml文件,把文件设置成maven项目

farbic-sdk-java 学习部署

此时,点击右边项目栏中的maven,编译complie

farbic-sdk-java 学习部署

编译完成后,会显示build success

farbic-sdk-java 学习部署

找到fabric-sdk-java\src\test\java\org\hyperledger\fabric\sdk\testutils\路径下的TestConfig.java文件

修改TestConfig.java代码中配置IP(源码是localhost,改成虚拟机服务器的IP)

farbic-sdk-java 学习部署

执行fabric-sdk-java\src\test\java\org\hyperledger\fabric\sdkintegration\End2endIT.java代码进行连接交易测试。

若控制台有下列输出,表示sdk测试成功。

"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:F:\Software\JetBrains\IntelliJ IDEA Community Edition 2020.2.2\lib\idea_rt.jar=54737:F:\Software\JetBrains\IntelliJ IDEA Community Edition 2020.2.2\bin" -Dfile.encoding=UTF-8 -classpath "F:\Software\JetBrains\IntelliJ IDEA Community Edition 2020.2.2\lib\idea_rt.jar;F:\Software\JetBrains\IntelliJ IDEA Community Edition 2020.2.2\plugins\junit\lib\junit5-rt.jar;F:\Software\JetBrains\IntelliJ IDEA Community Edition 2020.2.2\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;C:\Users\zzq\Desktop\fabric-sdk-java-master\fabric-sdk-java-master\target\test-classes;C:\Users\zzq\Desktop\fabric-sdk-java-master\fabric-sdk-java-master\target\classes;D:\apache-maven-3.6.3\repository\org\mockito\mockito-core\3.3.3\mockito-core-3.3.3.jar;D:\apache-maven-3.6.3\repository\net\bytebuddy\byte-buddy\1.10.5\byte-buddy-1.10.5.jar;D:\apache-maven-3.6.3\repository\net\bytebuddy\byte-buddy-agent\1.10.5\byte-buddy-agent-1.10.5.jar;D:\apache-maven-3.6.3\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;D:\apache-maven-3.6.3\repository\junit\junit\4.13\junit-4.13.jar;D:\apache-maven-3.6.3\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-netty\1.31.0\grpc-netty-1.31.0.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-core\1.31.0\grpc-core-1.31.0.jar;D:\apache-maven-3.6.3\repository\com\google\android\annotations\4.1.1.4\annotations-4.1.1.4.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-handler-proxy\4.1.48.Final\netty-handler-proxy-4.1.48.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-codec-socks\4.1.48.Final\netty-codec-socks-4.1.48.Final.jar;D:\apache-maven-3.6.3\repository\com\google\guava\guava\29.0-android\guava-29.0-android.jar;D:\apache-maven-3.6.3\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\apache-maven-3.6.3\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\apache-maven-3.6.3\repository\org\checkerframework\checker-compat-qual\2.5.5\checker-compat-qual-2.5.5.jar;D:\apache-maven-3.6.3\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;D:\apache-maven-3.6.3\repository\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;D:\apache-maven-3.6.3\repository\io\perfmark\perfmark-api\0.19.0\perfmark-api-0.19.0.jar;D:\apache-maven-3.6.3\repository\org\codehaus\mojo\animal-sniffer-annotations\1.18\animal-sniffer-annotations-1.18.jar;D:\apache-maven-3.6.3\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-protobuf\1.31.0\grpc-protobuf-1.31.0.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-api\1.31.0\grpc-api-1.31.0.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-context\1.31.0\grpc-context-1.31.0.jar;D:\apache-maven-3.6.3\repository\com\google\api\grpc\proto-google-common-protos\1.17.0\proto-google-common-protos-1.17.0.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-protobuf-lite\1.31.0\grpc-protobuf-lite-1.31.0.jar;D:\apache-maven-3.6.3\repository\io\grpc\grpc-stub\1.31.0\grpc-stub-1.31.0.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-tcnative-boringssl-static\2.0.30.Final\netty-tcnative-boringssl-static-2.0.30.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-codec-http2\4.1.49.Final\netty-codec-http2-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-common\4.1.49.Final\netty-common-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-buffer\4.1.49.Final\netty-buffer-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-transport\4.1.49.Final\netty-transport-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-resolver\4.1.49.Final\netty-resolver-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-codec\4.1.49.Final\netty-codec-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-handler\4.1.49.Final\netty-handler-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\io\netty\netty-codec-http\4.1.49.Final\netty-codec-http-4.1.49.Final.jar;D:\apache-maven-3.6.3\repository\com\google\protobuf\protobuf-java\3.12.4\protobuf-java-3.12.4.jar;D:\apache-maven-3.6.3\repository\com\google\protobuf\protobuf-java-util\3.12.4\protobuf-java-util-3.12.4.jar;D:\apache-maven-3.6.3\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar;D:\apache-maven-3.6.3\repository\org\bouncycastle\bcpkix-jdk15on\1.62\bcpkix-jdk15on-1.62.jar;D:\apache-maven-3.6.3\repository\org\bouncycastle\bcprov-jdk15on\1.62\bcprov-jdk15on-1.62.jar;D:\apache-maven-3.6.3\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\apache-maven-3.6.3\repository\commons-cli\commons-cli\1.4\commons-cli-1.4.jar;D:\apache-maven-3.6.3\repository\org\apache\commons\commons-compress\1.20\commons-compress-1.20.jar;D:\apache-maven-3.6.3\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;D:\apache-maven-3.6.3\repository\org\apache\logging\log4j\log4j-core\2.13.3\log4j-core-2.13.3.jar;D:\apache-maven-3.6.3\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\apache-maven-3.6.3\repository\org\apache\logging\log4j\log4j-1.2-api\2.13.3\log4j-1.2-api-2.13.3.jar;D:\apache-maven-3.6.3\repository\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar;D:\apache-maven-3.6.3\repository\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;D:\apache-maven-3.6.3\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\apache-maven-3.6.3\repository\org\apache\httpcomponents\httpmime\4.5.12\httpmime-4.5.12.jar;D:\apache-maven-3.6.3\repository\com\spotify\futures-extra\4.2.0\futures-extra-4.2.0.jar;D:\apache-maven-3.6.3\repository\com\google\api\api-common\1.9.0\api-common-1.9.0.jar;D:\apache-maven-3.6.3\repository\com\google\auto\value\auto-value-annotations\1.7\auto-value-annotations-1.7.jar;D:\apache-maven-3.6.3\repository\org\glassfish\javax.json\1.1.4\javax.json-1.1.4.jar;D:\apache-maven-3.6.3\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;D:\apache-maven-3.6.3\repository\org\miracl\milagro\amcl\milagro-crypto-java\0.4.0\milagro-crypto-java-0.4.0.jar;D:\apache-maven-3.6.3\repository\org\apache\commons\commons-math3\3.6.1\commons-math3-3.6.1.jar;D:\apache-maven-3.6.3\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;D:\apache-maven-3.6.3\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;D:\apache-maven-3.6.3\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 org.hyperledger.fabric.sdkintegration.End2endIT



RUNNING: End2endIT.

***** Enrolling Users *****
Constructing channel foo
Created channel foo
Peer peer0.org1.example.com joined channel foo
Peer peer1.org1.example.com joined channel foo
Finished initialization channel foo
Running channel foo
Creating install proposal
Sending install proposal
Successful install proposal response Txid: c8be487fac4adc7e4b2815ed27b37cf3009bfb423af091be98bf0aebc8d34b27 from peer peer0.org1.example.com
Successful install proposal response Txid: c8be487fac4adc7e4b2815ed27b37cf3009bfb423af091be98bf0aebc8d34b27 from peer peer1.org1.example.com
Received 2 install proposal responses. Successful+verified: 2 . Failed: 0
Sending instantiateProposalRequest to all peers with arguments: a and b set to 100 and 200 respectively
Succesful instantiate proposal response Txid: 0ba00f3b8840ae638072e8b9817ece0d9c0d25c7e284dbf82a6707fe0490a4ff from peer peer0.org1.example.com
Succesful instantiate proposal response Txid: 0ba00f3b8840ae638072e8b9817ece0d9c0d25c7e284dbf82a6707fe0490a4ff from peer peer1.org1.example.com
Received 2 instantiate proposal responses. Successful+verified: 2 . Failed: 0
Sending instantiateTransaction to orderer with a and b set to 100 and 200 respectively
Finished instantiate transaction with transaction id 0ba00f3b8840ae638072e8b9817ece0d9c0d25c7e284dbf82a6707fe0490a4ff
sending transactionProposal to all peers with arguments: move(a,b,100)
Successful transaction proposal response Txid: 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944 from peer peer0.org1.example.com
Successful transaction proposal response Txid: 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944 from peer peer1.org1.example.com
Received 2 transaction proposal responses. Successful+verified: 2 . Failed: 0
Successfully received transaction proposal responses.
Sending chaincode transaction(move a,b,100) to orderer.
RECEIVED Chaincode event with handle: CHAINCODE_EVENTS_HANDLE6afeffb2-3a25-46ec-b3ca-de289e3c5803CHAINCODE_EVENTS_HANDLE, chaincode Id: example_cc_go, chaincode event name: event, transaction id: 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944, event payload: "!", from event source: peer1.org1.example.com
Finished transaction with transaction id 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944
Now query chaincode for the value of b.
RECEIVED Chaincode event with handle: CHAINCODE_EVENTS_HANDLE6afeffb2-3a25-46ec-b3ca-de289e3c5803CHAINCODE_EVENTS_HANDLE, chaincode Id: example_cc_go, chaincode event name: event, transaction id: 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944, event payload: "!", from event source: peer0.org1.example.com
Query payload of b from peer peer0.org1.example.com returned 300
Query payload of b from peer peer1.org1.example.com returned 300
Channel info for : foo
Channel height: 3
Chain current block hash: e4d428ec5db754024016d6124cdf49ee3a698acbf3e0fce419179b6a337ce884
Chainl previous block hash: f27c2826a28f7462ff57f39895379dd39a64c690b5982c0fd02cebb040499720
queryBlockByNumber returned correct block with blockNumber 2 
 previous_hash f27c2826a28f7462ff57f39895379dd39a64c690b5982c0fd02cebb040499720
queryBlockByHash returned block with blockNumber 1
queryBlockByTxID returned block with blockNumber 2
QueryTransactionByID returned TransactionInfo: txID 5f091bae842da7f71f3fde564808ce82567e52a7aa4ba38860c143b230cab944
     validation code 0
Running for Channel foo done


Constructing channel bar
Created channel bar
Peer peer0.org2.example.com joined channel bar
Peer peer1.org2.example.com joined channel bar
Finished initialization channel bar
Running channel bar
Creating install proposal
Sending install proposal
Successful install proposal response Txid: 807734440877031f3d77332b8cd05cd3cb5f51ec03ef8f0128318b8c99515c9f from peer peer0.org2.example.com
Successful install proposal response Txid: 807734440877031f3d77332b8cd05cd3cb5f51ec03ef8f0128318b8c99515c9f from peer peer1.org2.example.com
Received 2 install proposal responses. Successful+verified: 2 . Failed: 0
Sending instantiateProposalRequest to all peers with arguments: a and b set to 100 and 300 respectively
Succesful instantiate proposal response Txid: 8ef8145a3e98352c51a10a205f19f6f94e1bfe44ae058a59b5ded1c39b152bb9 from peer peer0.org2.example.com
Succesful instantiate proposal response Txid: 8ef8145a3e98352c51a10a205f19f6f94e1bfe44ae058a59b5ded1c39b152bb9 from peer peer1.org2.example.com
Received 2 instantiate proposal responses. Successful+verified: 2 . Failed: 0
Sending instantiateTransaction to orderer with a and b set to 100 and 300 respectively
Finished instantiate transaction with transaction id 8ef8145a3e98352c51a10a205f19f6f94e1bfe44ae058a59b5ded1c39b152bb9
sending transactionProposal to all peers with arguments: move(a,b,100)
Successful transaction proposal response Txid: f30c1517d84f5f6462b475dd62568dc289a16d31f61bead0817abfcc68e21fba from peer peer0.org2.example.com
Successful transaction proposal response Txid: f30c1517d84f5f6462b475dd62568dc289a16d31f61bead0817abfcc68e21fba from peer peer1.org2.example.com
Received 2 transaction proposal responses. Successful+verified: 2 . Failed: 0
Successfully received transaction proposal responses.
Sending chaincode transaction(move a,b,100) to orderer.
Finished transaction with transaction id f30c1517d84f5f6462b475dd62568dc289a16d31f61bead0817abfcc68e21fba
Now query chaincode for the value of b.
Query payload of b from peer peer0.org2.example.com returned 400
Query payload of b from peer peer1.org2.example.com returned 400
Channel info for : bar
Channel height: 3
Chain current block hash: 761e20919e01b1bdbb39add78eb2bfc31f52778dd29b69d3e60fd312d0f0f5bf
Chainl previous block hash: 89fd7081195a9b9bb25669305494ff95b975b8ba03eb3b99554b863af13e2322
queryBlockByNumber returned correct block with blockNumber 2 
 previous_hash 89fd7081195a9b9bb25669305494ff95b975b8ba03eb3b99554b863af13e2322
queryBlockByHash returned block with blockNumber 1
queryBlockByTxID returned block with blockNumber 2
QueryTransactionByID returned TransactionInfo: txID f30c1517d84f5f6462b475dd62568dc289a16d31f61bead0817abfcc68e21fba
     validation code 0
Running for Channel bar done

Traverse the blocks for chain bar 
current block number 2 has data hash: 9ec16a9ef6e30cfe9c9d990cc8946f6916b08ab6e7712e1cc8585b028e36fc8d
current block number 2 has previous hash id: 89fd7081195a9b9bb25669305494ff95b975b8ba03eb3b99554b863af13e2322
current block number 2 has calculated block hash is 761e20919e01b1bdbb39add78eb2bfc31f52778dd29b69d3e60fd312d0f0f5bf
current block number 2 has 1 envelope count:
  Transaction number 1 has transaction id: f30c1517d84f5f6462b475dd62568dc289a16d31f61bead0817abfcc68e21fba
  Transaction number 1 has channel id: bar
  Transaction number 1 has epoch: 0
  Transaction number 1 has transaction timestamp: 十月 9,  2020  13:36:56 下午
  Transaction number 1 has type id: TRANSACTION_ENVELOPE
  Transaction number 1 has nonce : 471fb302f5be8e90dd84e35d41698ae8938673a3860d5302
  Transaction number 1 has submitter mspid: Org2MSP,  certificate: -----BEGIN CERTIFICATE-----
MIICjzCCAjWgAwIBAgIUJYFdzbksvZmpBfUP55tyP3wSuYgwCgYIKoZIzj0EAwIw
czELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh
biBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMT
E2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMjAxMDA5MDUzMjAwWhcNMjExMDA5MDUz
NzAwWjBCMTAwDQYDVQQLEwZjbGllbnQwCwYDVQQLEwRvcmcxMBIGA1UECxMLZGVw
YXJ0bWVudDExDjAMBgNVBAMTBXVzZXIxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD
QgAEtM6c1ht7v7vLL19QxZKOpRLbHESCr9s6uR0slHZFYZhVfiHAHHj2eTzdE8Id
ZTpOBAqz1OloDfZDbg6IpuMmPqOB1zCB1DAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0T
AQH/BAIwADAdBgNVHQ4EFgQU3nDVR3zPl3rQWyjAB6LaheBe5RYwKwYDVR0jBCQw
IoAgeyt2U8RRLWzpU144FAY19Tm9ihML5UrJT34TG3Wg8j4waAYIKgMEBQYHCAEE
XHsiYXR0cnMiOnsiaGYuQWZmaWxpYXRpb24iOiJvcmcxLmRlcGFydG1lbnQxIiwi
aGYuRW5yb2xsbWVudElEIjoidXNlcjEiLCJoZi5UeXBlIjoiY2xpZW50In19MAoG
CCqGSM49BAMCA0gAMEUCIQCo0+RGjzobf5iuZBxSPa0FQRWuBigVRpRTzb39uYH5
MAIga87bG6a8X5WSrGcZ9f1Ace4dUUGUlqRAaSf0BgbmN1Q=
-----END CERTIFICATE-----

  Transaction number 1 has 1 actions
  Transaction number 1 isValid true
  Transaction number 1 validation code 0
   Transaction action 1 has response status 352
   Transaction action 1 has response message bytes as string: 
   Transaction action 1 has 2 endorsements
Endorser 0 signature: 3044022034fe757066fea4c092741d8c3f26435591db71302905baa99fe249bc549eb06d0220023c9b6e19a0b6384ddd1dc21580dca0c87987cf088c87c8b2d77d39512b551a
Endorser 0 endorser: mspid Org2MSP 
 certificate -----BEGIN CERTIFICATE-----
MIICGTCCAcCgAwIBAgIRAKoFq36AGyh9tmw1qzjKp2YwCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTgwMjI1MTI0MzI5WhcNMjgwMjIzMTI0MzI5
WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMi5leGFtcGxlLmNvbTBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABFBM3gDUs/4Mp9DyF/uiUQkQk1UvqmmC
uhuAXJgeTAob/tzvsLGGRS78dsuPVSGVS3p4vtuPhUBMVKtrnscgjemjTTBLMA4G
A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIHsrdlPEUS1s
6VNeOBQGNfU5vYoTC+VKyU9+Ext1oPI+MAoGCCqGSM49BAMCA0cAMEQCIDbFc/hr
0RYfp0e9HqBW+tel9c9VCW7E+C7XO4e7ZYBJAiAVkjEFKpKadLUpA2cK0YHobNRH
zxIaKjL+wLVfr2wTzQ==
-----END CERTIFICATE-----

Endorser 1 signature: 3045022100888b30e637e6f9c7daf2ff260672bb48fe3860f572d4a0abcdf32438f9d2d915022019724ba6846f8879763022725730c91c9e6f675b6b5f5f0482632a09a19c74d1
Endorser 1 endorser: mspid Org2MSP 
 certificate -----BEGIN CERTIFICATE-----
MIICGDCCAb+gAwIBAgIQKHCjvLJSTkKm5lsAG4StsTAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMi5leGFtcGxlLmNvbTAeFw0xODAyMjUxMjQzMjlaFw0yODAyMjMxMjQzMjla
MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMS5vcmcyLmV4YW1wbGUuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEIPHSGaXYokkyDT7hjv7xR7qdr/4unay4
6ney+f+SaX3/+GS23ETzxjeZYyoKYy+nMjTGVtMx1k9m/KHHZUS4PaNNMEswDgYD
VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgeyt2U8RRLWzp
U144FAY19Tm9ihML5UrJT34TG3Wg8j4wCgYIKoZIzj0EAwIDRwAwRAIgRiUmbSDL
ZT4ETQzsS57MpfinlBo+WM/3ChUtTOL8BlgCIB8jfwjtaP22vH4w+V52ztTgQCnq
lCO/1jpx9z0ii78C
-----END CERTIFICATE-----

   Transaction action 1 has 4 chaincode input arguments
     Transaction action 1 has chaincode input argument 0 is: move
     Transaction action 1 has chaincode input argument 1 is: a
     Transaction action 1 has chaincode input argument 2 is: b
     Transaction action 1 has chaincode input argument 3 is: 100
   Transaction action 1 proposal response status: 352
   Transaction action 1 proposal response payload: :)
   Transaction action 1 proposal chaincodeIDName: example_cc_go, chaincodeIDVersion: 1
   Transaction action 1 has 2 name space read write sets
     Namespace example_cc_go read set 0 key a  version [1:0]
     Namespace example_cc_go read set 1 key b  version [1:0]
     Namespace example_cc_go write set 0 key a has value '400' 
     Namespace example_cc_go write set 1 key b has value '400' 
     Namespace lscc read set 0 key example_cc_go  version [1:0]
current block number 1 has data hash: f9b3b8287f9a165a2ac6d8d6599de8a130f6f92c09f52ecbfbdd27fb31cb6ab1
current block number 1 has previous hash id: ee9f35dbeb02a13bf436ccf2f7d00d43c19c463032548c907f2fe025c786572d
current block number 1 has calculated block hash is 89fd7081195a9b9bb25669305494ff95b975b8ba03eb3b99554b863af13e2322
current block number 1 has 1 envelope count:
  Transaction number 1 has transaction id: 8ef8145a3e98352c51a10a205f19f6f94e1bfe44ae058a59b5ded1c39b152bb9
  Transaction number 1 has channel id: bar
  Transaction number 1 has epoch: 0
  Transaction number 1 has transaction timestamp: 十月 9,  2020  13:36:52 下午
  Transaction number 1 has type id: TRANSACTION_ENVELOPE
  Transaction number 1 has nonce : b48e1ba3ee91a13c5abfdeea4677c19ce248cf847821ed4e
  Transaction number 1 has submitter mspid: Org2MSP,  certificate: -----BEGIN CERTIFICATE-----
MIICGjCCAcCgAwIBAgIRAIrZokP5xguxCqWjUeu0jnAwCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTgwMjI1MTI0MzI5WhcNMjgwMjIzMTI0MzI5
WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABGDqXVD4yOX65oU0eY3j5UtD8Gr8n/s+
eODjPP76wNeBoSqljQYM+D953dBtzZ87udrwQ2uvcpUI1R1mHTMuNmSjTTBLMA4G
A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIHsrdlPEUS1s
6VNeOBQGNfU5vYoTC+VKyU9+Ext1oPI+MAoGCCqGSM49BAMCA0gAMEUCIQCojuxd
EqSDDDUUJstAmAqU65xkd1/Yf0BVpLdCe++WigIgLWC9rBPpUa+Yhe3yy00+BlqG
xZ0h2eeiHaMuF6Qawy4=
-----END CERTIFICATE-----

  Transaction number 1 has 1 actions
  Transaction number 1 isValid true
  Transaction number 1 validation code 0
   Transaction action 1 has response status 200
   Transaction action 1 has response message bytes as string: 
   Transaction action 1 has 2 endorsements
Endorser 0 signature: 3045022100944df7ca5d50ae92468046473adef0d101ddaa6423e0657fd606fd0fc4e23cc802203e9bad11bb673a0997aa18796efbf9ad91a16fc6fd56954bcc8aaafd0c28db6a
Endorser 0 endorser: mspid Org2MSP 
 certificate -----BEGIN CERTIFICATE-----
MIICGTCCAcCgAwIBAgIRAKoFq36AGyh9tmw1qzjKp2YwCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTgwMjI1MTI0MzI5WhcNMjgwMjIzMTI0MzI5
WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMi5leGFtcGxlLmNvbTBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABFBM3gDUs/4Mp9DyF/uiUQkQk1UvqmmC
uhuAXJgeTAob/tzvsLGGRS78dsuPVSGVS3p4vtuPhUBMVKtrnscgjemjTTBLMA4G
A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIHsrdlPEUS1s
6VNeOBQGNfU5vYoTC+VKyU9+Ext1oPI+MAoGCCqGSM49BAMCA0cAMEQCIDbFc/hr
0RYfp0e9HqBW+tel9c9VCW7E+C7XO4e7ZYBJAiAVkjEFKpKadLUpA2cK0YHobNRH
zxIaKjL+wLVfr2wTzQ==
-----END CERTIFICATE-----

Endorser 1 signature: 304502210093ae518f7c43d0abdcb5aa083957be222a117b49b9858d1fe3269fa9cfb158ee022010e6ef369698e82932f00a62970eedd13f426ac48ecc8a3ec95c89febc5a5426
Endorser 1 endorser: mspid Org2MSP 
 certificate -----BEGIN CERTIFICATE-----
MIICGDCCAb+gAwIBAgIQKHCjvLJSTkKm5lsAG4StsTAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMi5leGFtcGxlLmNvbTAeFw0xODAyMjUxMjQzMjlaFw0yODAyMjMxMjQzMjla
MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMS5vcmcyLmV4YW1wbGUuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEIPHSGaXYokkyDT7hjv7xR7qdr/4unay4
6ney+f+SaX3/+GS23ETzxjeZYyoKYy+nMjTGVtMx1k9m/KHHZUS4PaNNMEswDgYD
VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgeyt2U8RRLWzp
U144FAY19Tm9ihML5UrJT34TG3Wg8j4wCgYIKoZIzj0EAwIDRwAwRAIgRiUmbSDL
ZT4ETQzsS57MpfinlBo+WM/3ChUtTOL8BlgCIB8jfwjtaP22vH4w+V52ztTgQCnq
lCO/1jpx9z0ii78C
-----END CERTIFICATE-----

   Transaction action 1 has 4 chaincode input arguments
     Transaction action 1 has chaincode input argument 0 is: deploy
     Transaction action 1 has chaincode input argument 1 is: bar
     Transaction action 1 has chaincode input argument 2 is: ?E???)??github.com/example_cc??example_cc_go??1????init??a??500?...
     Transaction action 1 has chaincode input argument 3 is: ? ??????????????????????????????????????Org1MSP??????Org2MSP????...
   Transaction action 1 proposal response status: 200
   Transaction action 1 proposal response payload: ??example_cc_go??1??escc"?vscc*Z? ??????????????????????????????...
   Transaction action 1 proposal chaincodeIDName: lscc, chaincodeIDVersion: 1.4.9
   Transaction action 1 has 2 name space read write sets
     Namespace example_cc_go write set 0 key a has value '500' 
     Namespace example_cc_go write set 1 key b has value '300' 
     Namespace lscc read set 0 key example_cc_go  version [0:0]
     Namespace lscc write set 0 key example_cc_go has value '??example_cc_go??1??escc"?vscc*Z? ??????????????????????????????...' 
current block number 0 has data hash: 342bc0f736574dffdc9009ef56e05d15fa330bb2ec4ef2d51553fd88445476de
current block number 0 has previous hash id: 
current block number 0 has calculated block hash is ee9f35dbeb02a13bf436ccf2f7d00d43c19c463032548c907f2fe025c786572d
current block number 0 has 1 envelope count:
  Transaction number 1 has transaction id: 
  Transaction number 1 has channel id: bar
  Transaction number 1 has epoch: 0
  Transaction number 1 has transaction timestamp: 十月 9,  2020  13:36:50 下午
  Transaction number 1 has type id: ENVELOPE
  Transaction number 1 has nonce : e4ad1608fd973bae02259c2ad9ee88dbcd0414a8e2ae2798
  Transaction number 1 has submitter mspid: OrdererMSP,  certificate: -----BEGIN CERTIFICATE-----
MIICCzCCAbKgAwIBAgIQUcfZvWT8UgJJ30cDzW15bDAKBggqhkjOPQQDAjBpMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w
bGUuY29tMB4XDTE4MDIyNTEyNDMyOVoXDTI4MDIyMzEyNDMyOVowWDELMAkGA1UE
BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz
Y28xHDAaBgNVBAMTE29yZGVyZXIuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAARQfP/qUmnEcXIlE5PlkR4RCMn2XykMsPFZN0k1XfpkSA4KP0nC
ALUgiITKLsOQohYA7oDaFQD/ZhaRswgwEgmNo00wSzAOBgNVHQ8BAf8EBAMCB4Aw
DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCAZtRU3kIVNroUKD5QVcPw8VpuHhyOT
OtWpwxnSk/LUkjAKBggqhkjOPQQDAgNHADBEAiApAQ0e/qdVsd5qtXGHqYKRt30Y
LPaGPmy8wbX8+/KDhwIgXtt1TL97Z0rfq7iKXzXLRNk8jNntsrmRFoLVstXr3dA=
-----END CERTIFICATE-----

That's all folks!

Process finished with exit code 0

到此java-sdk安装测试完成了。

参考资料:

https://github.com/hyperledger/fabric-sdk-java

farbic-sdk-java 学习部署

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/27722.html

(0)
上一篇 2023-09-20 15:00
下一篇 2023-09-20 16:15

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信