首先去github上拉取相应的
Docker Compose 我是按照这个安装测试的:https://github.com/IBM-Blockchain/fabric-images
照着他的文档自己搭建很快就搭建完了(很简单)。
在安装完后你能很好的运行他的合约,之后我开始运行我自己写的合约 然后就是各种不行,我的合约在本地自己搭建的环境(虚拟机)是可以跑的。然后我就以为是不是我的环境有问题,最后发现是合约写法的的问题 现在给出我请教IBM,IBM给我的回答。
第二次问:
ACTION TAKEN:
[Blockchain Support] We have reviewed the additional questions on
chaincode deployment as illustrated in the
90951.999.738-Fabric_docker_image_issue_2.doc file. Below are responses
on methods one and three that were attempted for chaincode deployment.
Method one - Multiple chaincode Go files in one directory (and the same
Go package)
If multiple chaincode files in the directory have a "main" function,
that would cause a problem for the chaincode deployment process. The
deployment logic looks for one "main" function to know what to deploy.
Also, concerning the Marbles sample code, note that the code is
different for Hyperledger Fabric version 0.6 and Hyperledger Fabric
version 1.0. If branch v3.0 of the Marbles repository
(https://github.com/IBM-Blockchain/marbles) is being reviewed, this code
corresponds to Hyperledger Fabric version 1.0. The process of
propagating chaincode to a blockchain network is different in
Hyperledger Fabric 1.0 as compared to Hyperledger Fabric version 0.6.
For version 0.6 (which corresponds to the published Docker images),
branch v2.0 of the Marbles repository is used. When using the v2.0
branch, there is only one chaincode file, marbles_chaincode.go.
Method three - Multiple chaincode Go files in separate directories (and
different Go packages)
When using Hyperledger Fabric version 0.6, a file upload from a
directory is done during the chaincode deployment process. There is not
a process that inspects the chaincode Go file in one directory (such as
payment02/src/chaincode) and then determines what other Go files have
packages that are being imported. The results are the same when using
Bluemix and an environment based on Docker images since this deals with
the way chaincode deployment works with Hyperledger Fabric version 0.6.
ACTION PLAN:
Follow up with the customer on chaincode deployment for Hyperledger
Fabric version 0.6. For method one, we suggest checking whether
multiple Go files have "main" functions. Method two with all of the
chaincode in one Go file is the most straightforward. As of Hyperledger
Fabric version 0.6, method three which requires finding chaincode in
multiple directories is not supported.
第一次问:
ACTION TAKEN:
[Blockchain Support] We have reviewed the four questions about using
the IBM-published Docker images for Hyperledger Fabric version 0.6 which
are available through GitHub at
https://github.com/IBM-Blockchain/fabric-images (with documentation at
https://hub.docker.com/r/ibmblockchain/fabric-peer/). Responses to the
questions are included below.
Question 1: Why does issuing a POST to 0.0.0.0:7050/chaincode and a POST
to 172.18.0.1:7050/chaincode produce the same result?
Response 1: The 0.0.0.0 notation stands for all ethernet interfaces.
The 172.18.0.1 IP address is for a particular container that was started
as a result of running a command like "docker-compose -f
single-peer-ca.yaml up". If you run "docker ps", it will show that port
7050 is exposed on all interfaces (0.0.0.0).
If you have navigated into a container (by running a command such as
"docker exec -it dockercompose_vp0_1 bash"), then either the
0.0.0.0:7050 or 172.18.0.1:7050 address can be used since port 7050 is
exposed on all interfaces. An address of 127.0.0.1 should also work.
Note that if you have not navigated into a container, the address
returned by "docker-machine ip" (such as 192.168.99.100) uses a
different port. The port mapping is shown when using the ?docker ps?
command. For example, the port for a peer might be 8050 or 9050 when it
is accessed from 192.168.99.100.
Question 2: In the chaincode deployment specification, why is the
chaincode name not sufficient for the "chaincodeID" section?
Response 2: Based on the document attached to the PMR, we observed that
the assumption is that the peer is running in development mode.
Following is a Hyperledger documentation topic that indicates that
development mode is set with a --peer-chaincodedev flag that is passed
when a peer starts:
http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup
.html
The docker-compose files provided with the IBM-published Docker images
do not start a peer with this --peer-chaincodedev flag. When using
these images, the peer does not start in development mode.
There is a "chaincode deploy via CLI and REST" heading within the page
mentioned above
(http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setu
p.html?highlight=REST%20API#chaincode-deploy-via-cli-and-rest) that
indicates that a deploy transaction requires a "path" parameter if
development mode is not being used. The "name" parameter is only
available in development mode which is not being used in this case.
Question 3: When attempting to query chaincode, why is there an error
that says "Failed to launch chaincode spec(Could not get deployment
transaction ...)"?
Response 3: This means that the chaincode deployment failed. When
chaincode deployment fails a Docker container is not started for the
chaincode. Since there is not a running chaincode container, the
chaincode query will not succeed.
A potential cause for this type of issue is a problem with the
chaincode, such as not compiling. We would suggest making sure the
chaincode compiles before attempting the deployment.
Question 4: Why does the Example02 chaincode result in the creation of a
chaincode container, while a container is not created for another
chaincode?
Response 4: This is closely tied to question three. When a chaincode
deploys successfully it will create a chaincode container. When there
is a deployment problem (such as due to a chaincode issue), then a
chaincode container will not be created.
ACTION PLAN:
Follow up with the customer on the above responses to the questions
concerning using the IBM-published Docker images for Hyperledger Fabric
version 0.6.