手工搭建fabric 1.1.0 网络

阅读: 评论:0

手工搭建fabric 1.1.0 网络

手工搭建fabric 1.1.0 网络

生成证书文件

crypto-config.yaml 内容如下

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
## ---------------------------------------------------------------------------
# "OrdererOrgs" - Definition of organizations managing orderer nodes
# ---------------------------------------------------------------------------
OrdererOrgs:# ---------------------------------------------------------------------------# Orderer# ---------------------------------------------------------------------------- Name: OrdererDomain: example# ---------------------------------------------------------------------------# "Specs" - See PeerOrgs below for complete description# ---------------------------------------------------------------------------Specs:- Hostname: orderer
# ---------------------------------------------------------------------------
# "PeerOrgs" - Definition of organizations managing peer nodes
# ---------------------------------------------------------------------------
PeerOrgs:# ---------------------------------------------------------------------------# Org1# ---------------------------------------------------------------------------- Name: Org1Domain: ampleEnableNodeOUs: true# ---------------------------------------------------------------------------# "Specs"# ---------------------------------------------------------------------------# Uncomment this section to enable the explicit definition of hosts in your# configuration.  Most users will want to use Template, below## Specs is an array of Spec entries.  Each Spec entry consists of two fields:#   - Hostname:   (Required) The desired hostname, sans the domain.#   - CommonName: (Optional) Specifies the template or explicit override for#                 the CN.  By default, this is the template:##                              "{{.Hostname}}.{{.Domain}}"##                 which obtains its values from the Spec.Hostname and#                 Org.Domain, respectively.# ---------------------------------------------------------------------------# Specs:#   - Hostname: foo # implicitly &#ample"#     CommonName: ample # overrides Hostname-based FQDN set above#   - Hostname: bar#   - Hostname: baz# ---------------------------------------------------------------------------# "Template"# ---------------------------------------------------------------------------# Allows for the definition of 1 or more hosts that are created sequentially# from a template. By default, this looks like "peer%d" from 0 to Count-1.# You may override the number of nodes (Count), the starting index (Start)# or the template used to construct the name (Hostname).## Note: Template and Specs are not mutually exclusive.  You may define both# sections and the aggregate nodes will be created for you.  Take care with# name collisions# ---------------------------------------------------------------------------Template:Count: 2# Start: 5# Hostname: {{.Prefix}}{{.Index}} # default# ---------------------------------------------------------------------------# "Users"# ---------------------------------------------------------------------------# Count: The number of user accounts _in addition_ to Admin# ---------------------------------------------------------------------------Users:Count: 1# ---------------------------------------------------------------------------# Org2: See "Org1" for full specification# ---------------------------------------------------------------------------- Name: Org2Domain: ampleEnableNodeOUs: trueTemplate:Count: 2Users:Count: 1
cryptogen generate --config=./crypto-config.yaml

生成创世区块

configtx.yaml 文件内容如下

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#---
################################################################################
#
#   Profile
#
#   - Different configuration profiles may be encoded here to be specified
#   as parameters to the configtxgen tool
#
################################################################################
Profiles:TwoOrgsOrdererGenesis:Capabilities:<<: *ChannelCapabilitiesOrderer:<<: *OrdererDefaultsOrganizations:- *OrdererOrgCapabilities:<<: *OrdererCapabilitiesConsortiums:SampleConsortium:Organizations:- *Org1- *Org2TwoOrgsChannel:Consortium: SampleConsortiumApplication:<<: *ApplicationDefaultsOrganizations:- *Org1- *Org2Capabilities:<<: *ApplicationCapabilities################################################################################
#
#   Section: Organizations
#
#   - This section defines the different organizational identities which will
#   be referenced later in the configuration.
#
################################################################################
Organizations:# SampleOrg defines an MSP using the sampleconfig.  It should never be used# in production but may be used as a template for other definitions- &OrdererOrg# DefaultOrg defines the organization which is used in the sampleconfig# of the fabric.git development environmentName: OrdererOrg# ID to load the MSP definition asID: OrdererMSP# MSPDir is the filesystem path which contains the MSP configurationMSPDir: crypto-config/ordererOrganizations/example/msp- &Org1# DefaultOrg defines the organization which is used in the sampleconfig# of the fabric.git development environmentName: Org1MSP# ID to load the MSP definition asID: Org1MSPMSPDir: crypto-config/ample/mspAnchorPeers:# AnchorPeers defines the location of peers which can be used# for cross org gossip communication.  Note, this value is only# encoded in the genesis block in the Application section context- Host: amplePort: 7051- &Org2# DefaultOrg defines the organization which is used in the sampleconfig# of the fabric.git development environmentName: Org2MSP# ID to load the MSP definition asID: Org2MSPMSPDir: crypto-config/ample/mspAnchorPeers:# AnchorPeers defines the location of peers which can be used# for cross org gossip communication.  Note, this value is only# encoded in the genesis block in the Application section context- Host: amplePort: 7051################################################################################
#
#   SECTION: Orderer
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults# Orderer Type: The orderer implementation to start# Available types are "solo" and "kafka"OrdererType: soloAddresses:- ample:7050# Batch Timeout: The amount of time to wait before creating a batchBatchTimeout: 2s# Batch Size: Controls the number of messages batched into a blockBatchSize:# Max Message Count: The maximum number of messages to permit in a batchMaxMessageCount: 10# Absolute Max Bytes: The absolute maximum number of bytes allowed for# the serialized messages in a batch.AbsoluteMaxBytes: 99 MB# Preferred Max Bytes: The preferred maximum number of bytes allowed for# the serialized messages in a batch. A message larger than the preferred# max bytes will result in a batch larger than preferred max bytes.PreferredMaxBytes: 512 KBKafka:# Brokers: A list of Kafka brokers to which the orderer connects# NOTE: Use IP:port notationBrokers:- 127.0.0.1:9092# Organizations is the list of orgs which are defined as participants on# the orderer side of the networkOrganizations:################################################################################
#
#   SECTION: Application
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for application related parameters
#
################################################################################
Application: &ApplicationDefaults# Organizations is the list of orgs which are defined as participants on# the application side of the networkOrganizations:################################################################################
#
#   SECTION: Capabilities
#
#   - This section defines the capabilities of fabric network. This is a new
#   concept as of v1.1.0 and should not be utilized in mixed networks with
#   v1.0.x peers and orderers.  Capabilities define features which must be
#   present in a fabric binary for that binary to safely participate in the
#   fabric network.  For instance, if a new MSP type is added, newer binaries
#   might recognize and validate the signatures from this type, while older
#   binaries without this support would be unable to validate those
#   transactions.  This could lead to different versions of the fabric binaries
#   having different world states.  Instead, defining a capability for a channel
#   informs those binaries without this capability that they must cease
#   processing transactions until they have been upgraded.  For v1.0.x if any
#   capabilities are defined (including a map with all capabilities turned off)
#   then the v1.0.x peer will deliberately crash.
#
################################################################################
Capabilities:# Channel capabilities apply to both the orderers and the peers and must be# supported by both.  Set the value of the capability to true to require it.Global: &ChannelCapabilities# V1.1 for Global is a catchall flag for behavior which has been# determined to be desired for all orderers and peers running v1.0.x,# but the modification of which would cause incompatibilities.  Users# should leave this flag set to true.V1_1: true# Orderer capabilities apply only to the orderers, and may be safely# manipulated without concern for upgrading peers.  Set the value of the# capability to true to require it.Orderer: &OrdererCapabilities# V1.1 for Order is a catchall flag for behavior which has been# determined to be desired for all orderers running v1.0.x, but the# modification of which  would cause incompatibilities.  Users should# leave this flag set to true.V1_1: true# Application capabilities apply only to the peer network, and may be safely# manipulated without concern for upgrading orderers.  Set the value of the# capability to true to require it.Application: &ApplicationCapabilities# V1.1 for Application is a catchall flag for behavior which has been# determined to be desired for all peers running v1.0.x, but the# modification of which would cause incompatibilities.  Users should# leave this flag set to true.V1_1: true
export FABRIC_CFG_PATH=$PWD
mkdir dir channel-artifacts
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

生成创建频道配置交易

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./ -channelID mychannel

命令成功执行后,进入channel-artifacts 文件夹,会看到生成的创世区块文件和创建频道交易数据文件

 

配置和启动orderer容器

docker-orderer.yaml 文件内容如下

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#version: '2'ample:container_name: ampleimage: hyperledger/fabric-orderer:latestenvironment:- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=steven_default
      - ORDERER_GENERAL_LOGLEVEL=DEBUG
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=7050
      - ORDERER_GENERAL_GENESISMETHOD=file
      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/sis.block
      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      # enabled TLS- ORDERER_GENERAL_TLS_ENABLED=TRUE
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/]
    working_dir: /opt/gopath/src/github/hyperledger/fabriccommand: orderervolumes:- ./channel-artifacts/genesis.block:/var/hyperledger/sis.block
    - ./crypto-config/ordererOrganizations/example/ample/msp:/var/hyperledger/orderer/msp
    - ./crypto-config/ordererOrganizations/example/ample/tls/:/var/hyperledger/orderer/tls
    networks:default:aliases:- steven
    ports:- 7050:7050

启动orderer容器

docker-compose -f docker-orderer.yaml up -d

配置和启动 peer01 节点

KEY文件

cd ./crypto-config/ample/ca

这个路径下有一个文件名以 _sk 结尾的文件

FABRIC_CA_SERVER_TLS_KEYFILE
command
配置项替换成实际的_sk文件

- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/e1f396671ed85eb422a1cf8f596cc68fabb00d902b6a51c238e933a181795ae7_skcommand: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/ample-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/e1f396671ed85eb422a1cf8f596cc68fabb00d902b6a51c238e933a181795ae7_sk -b admin:adminpw -d'

配置文件内容如下

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#version: '2'services:couchdb:container_name: couchdbimage: hyperledger/fabric-couchdb:latest# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password# for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.
#    environment:
#      - COUCHDB_USER=
#      - COUCHDB_PASSWORD=# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,# for example map it to utilize Fauxton User Interface in dev environments.ports:- "5984:5984"
ca:container_name: caimage: hyperledger/fabric-ca:latestenvironment:- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
        - FABRIC_CA_SERVER_CA_NAME=ca
        - FABRIC_CA_SERVER_TLS_ENABLED=TRUE
        - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/ample-cert.pem
        - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/e1f396671ed85eb422a1cf8f596cc68fabb00d902b6a51c238e933a181795ae7_sk
      ports:- "7054:7054"
      command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/ample-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/e1f396671ed85eb422a1cf8f596cc68fabb00d902b6a51c238e933a181795ae7_sk -b admin:adminpw -d'volumes:- ./crypto-config/ample/ca/:/etc/hyperledger/fabric-ca-server-config
ample:container_name: ampleimage: hyperledger/fabric-peer:latestenvironment:- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
- CORE_PEER_ID&#ample
      - CORE_PEER_NETWORKID=steven
      - CORE_PEER_ADDRESS&#ample:7051
      - CORE_PEER_CHAINCODELISTENADDRESS&#ample:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT&#ample:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    # the following setting starts chaincode containers on the same# bridge network as the peers#  CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=steven_default
#      - CORE_LOGGING_LEVEL=INFO- CORE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=false
      - CORE_PEER_TLS_ENABLED=TRUE
      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/
      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/
    volumes:- /var/run/:/host/var/run/
        - ./crypto-config/ample/ample/msp:/etc/hyperledger/fabric/msp
        - ./crypto-config/ample/ample/tls:/etc/hyperledger/fabric/tls
    working_dir: /opt/gopath/src/github/hyperledger/fabric/peercommand: peer node startports:- 7051:7051
      - 7052:7052
      - 7053:7053
    depends_on:- couchdb
    networks:default:aliases:- steven
cli:container_name: cliimage: hyperledger/fabric-tools:latesttty: truestdin_open: trueenvironment:- GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=DEBUG
#    - CORE_LOGGING_LEVEL=INFO- CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS&#ample:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_TLS_ENABLED=TRUE
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github/hyperledger/fabric/peer/crypto/ample/ample/
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github/hyperledger/fabric/peer/crypto/ample/ample/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github/hyperledger/fabric/peer/crypto/ample/ample/
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github/hyperledger/fabric/peer/crypto/ample/users/Admin&#ample/msp
    working_dir: /opt/gopath/src/github/hyperledger/fabric/peercommand: /bin/bashvolumes:- /var/run/:/host/var/run/
      - ./chaincode/go/:/opt/gopath/src/github/hyperledger/fabric/steven/chaincode/go
      - ./crypto-config:/opt/gopath/src/github/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github/hyperledger/fabric/peer/channel-artifacts
    depends_on:
#    - ample
#    - ample
#    - ample
#    - amplenetworks:default:aliases:- steven

启动peer01 节点容器

docker-compose -f docker-peer.yaml up -d

创建channel

登入cli容器

docker exec -it cli bash

创建频道

peer channel create -ample:7050 -c mychannel -t 50 -f ./  --tls --cafile /opt/gopath/src/github/hyperledger/fabric/peer/crypto/ordererOrganizations/example/ample/msp/ample-cert.pem 

日志中可以看到

[channelCmd] readBlock -> INFO 020 Received block: 0

0号区块,即频道里的创世区块,已经被正常创建了。
在当前路径下执行ls,可以看到生成了 mychannel.block 文件,这个文件保存了创世区块的内容,说明创建频道成功。

将peer01 加入频道

环境变量 CORE_PEER_ADDRESS 定义了要操作的目标节点
查看这个环境变量的值,

echo $CORE_PEER_ADDRESS
ample:7051

可以看到目前要操作的目标节点是peer01

加入频道

peer channel join -b mychannel.block 

查看频道信息

root@7fdedcc1183b:/opt/gopath/src/github/hyperledger/fabric/peer# peer channel list
2018-08-14 03:52:28.753 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 03:52:28.753 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 03:52:28.754 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-08-14 03:52:28.755 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 631A0D0A0B4765744368616E6E656C73 
2018-08-14 03:52:28.755 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 99844B080D2E7B509EDD67B6DC7F5898AF1562D4AAC3A3593010844922AA0304 
Channels peers has joined: 
mychannel
2018-08-14 03:52:28.757 UTC [main] main -> INFO 

可以看到 节点已经成功加入了mychannel频道

root@7fdedcc1183b:/opt/gopath/src/github/hyperledger/fabric/peer# peer channel getinfo -c mychannel
2018-08-14 03:54:32.992 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 03:54:32.992 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 03:54:32.993 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-08-14 03:54:32.993 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 6E496E666F0A096D796368616E6E656C 
2018-08-14 03:54:32.993 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: D19350DDC8B2042CB89C5F8A1EE06B7A196916B29BB44B82E51CEA3703448F25 
Blockchain info: {"height":1,"currentBlockHash":"VbnvfMzMoQ3Bvbdf6BZcvtEj41W2657lQTptDsGTii0="}
2018-08-14 03:54:32.995 UTC [main] main -> INFO 
root@7fdedcc1183b:/opt/gopath/src/github/hyperledger/fabric/peer# 

在这个频道里区块链的高度为1,也就是说目前只有1个区块,也就是0号创世区块

chaincode

编译chaincode

cd chaincode/go/chaincode_example02/go
go get -u --tags nopkcs11 github/hyperledger/fabric/core/chaincode/shim
go build --tags nopkcs11 -o chaincode_example02

编译完成后,在当前目录会生成名为 chaincode_example02 的可执行文件

安装chaincode到peer节点

在peer节点的docker-peer.yaml 文件中

    volumes:- /var/run/:/host/var/run/
      - ./chaincode/go/:/opt/gopath/src/github/hyperledger/fabric/steven/chaincode/go
peer chaincode install -n mycc -p github/hyperledger/fabric/steven/chaincode/go/chaincode_example02/go -v 1.0        

-p 参数定义chaincode所在路径
因为
chaincode所在的完整路径为
/opt/gopath/src/github/hyperledger/fabric/steven/chaincode/go/chaincode_example02/go
因为定义了环境变量 GOPATH=/opt/gopath
所以 -p 参数只需要提供 github/hyperledger/fabric/steven/chaincode/go/chaincode_example02/go
peer channel install 命令会自动到 $GOPATH/src/ github/hyperledger/fabric/steven/chaincode/go/chaincode_example02/go
找chaincode

实例化chaincode

peer chaincode instantiate -ample:7050 -C mychannel -n mycc -c '{"Args":["init","A","10","B","10"]}' -P "OR (&#ber')" -v 1.0  --tls --cafile /opt/gopath/src/github/hyperledger/fabric/peer/crypto/ordererOrganizations/example/ample/msp/ample-cert.pem

调用chaincode

query
peer chaincode query -C mychannel -n mycc -c '{"Args":["query", "A"]}'   
2018-08-14 06:24:31.987 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 06:24:31.987 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 06:24:31.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-08-14 06:24:31.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-08-14 06:24:31.987 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-08-14 06:24:31.987 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 6E6E656C1A0A0A0571756572790A0141 
2018-08-14 06:24:31.987 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: D3D6DBE27AF65A95CD956D28F79DD1E3BD9E2B18E2DD13B5CE8217F72A86FF12 
Query Result: 10
2018-08-14 06:24:31.999 UTC [main] main -> INFO 
peer chaincode query -C mychannel -n mychannel -c '{"Args":["query", "B"]}' 
2018-08-14 06:24:57.225 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 06:24:57.225 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 06:24:57.225 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-08-14 06:24:57.225 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-08-14 06:24:57.225 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-08-14 06:24:57.225 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 6E6E656C1A0A0A0571756572790A0142 
2018-08-14 06:24:57.225 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 6A27E793D0F7E6CD473137EC984FB9D5803F66F80B64D2FF47034F705A7DE699 
Query Result: 10
2018-08-14 06:24:57.242 UTC [main] main -> INFO 

分别查询A 和 B的值,目前都是 10,

invoke
peer chaincode invoke -C mychannel -n mycc -c '{"Args":["invoke", "A", "B", "3"]}'   --tls --cafile /opt/gopath/src/github/hyperledger/fabric/peer/crypto/ordererOrganizations/example/ample/msp/ample-cert.pem

再次query A和B

root@7fdedcc1183b:/opt/gopath/src/github/hyperledger/fabric/steven/chaincode# peer chaincode query -C mychannel -n mycc -c '{"Args":["query", "A"]}'            
2018-08-14 06:28:10.210 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 06:28:10.210 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 06:28:10.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-08-14 06:28:10.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-08-14 06:28:10.211 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-08-14 06:28:10.211 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 6E6E656C1A0A0A0571756572790A0141 
2018-08-14 06:28:10.211 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 946CB5FE517D93FEC27065BB3534B69E5FD73AA5E8C08E2A56FC6C071F549DD3 
Query Result: 7
2018-08-14 06:28:10.222 UTC [main] main -> INFO 
root@7fdedcc1183b:/opt/gopath/src/github/hyperledger/fabric/steven/chaincode# peer chaincode query -C mychannel -n mycc -c '{"Args":["query", "B"]}'            
2018-08-14 06:28:14.821 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-08-14 06:28:14.821 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-08-14 06:28:14.821 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-08-14 06:28:14.821 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-08-14 06:28:14.821 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-08-14 06:28:14.822 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 6E6E656C1A0A0A0571756572790A0142 
2018-08-14 06:28:14.822 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 81FC2A154BAE944DFB58FC8B2E7BA3E9A10820BCA74EBB93658030027A34904A 
Query Result: 13
2018-08-14 06:28:14.830 UTC [main] main -> INFO 

A减去了3变成了7
B加上了3变成了13

本文发布于:2024-02-04 20:52:02,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170716147059499.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:手工   网络   fabric
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23