1. 程式人生 > >hyperledger中安裝鏈碼

hyperledger中安裝鏈碼

[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# #
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block

[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block
[email protected]
:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/tlscacerts/tlsca.wilsoner.com-cert.pem
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o
orderer.wilsoner.com:7050
-C testchannel -l golang -n testcc -v v1.0 --tls true --cafile $CAFILE -P “AND (‘OrgGoMSP.member’, ‘OrgCppMSP.member’)” -c ‘{“Args”:[“init”, “a”, “100”, “b”, “200”]}’
2018-12-12 07:40:55.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-12 07:40:55.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -chaincoden }atestcc - queryC [Argstestchannel -{c
Error: unknown shorthand flag: ‘{’ in -{c
Usage:
peer chaincode query [flags]

Flags:
-C, --channelID string The channel on which this command should be executed
–connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
-c, --ctor string Constructor message for the chaincode in JSON format (default “{}”)
-h, --help help for query
-x, --hex If true, output the query value byte array in hexadecimal. Incompatible with --raw
-n, --name string Name of the chaincode
–peerAddresses stringArray The addresses of the peers to connect to
-r, --raw If true, output the query value as raw bytes, otherwise format as a printable string
–tlsRootCertFiles stringArray If TLS is enabled, the paths to the TLS root cert files of the peers to connect to. The order and number of certs specified should match the --peerAddresses flag

Global Flags:
–cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
–certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
–clientauth Use mutual TLS when communicating with the orderer endpoint
–connTimeout duration Timeout for client to connect (default 3s)
–keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
–logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
–ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
–tls Use TLS when communicating with the orderer endpoint
–transient string Transient map of arguments in JSON encoding

[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -n testcc -C testchannel -c ‘{“Args”:[“query”, “a”]}’
100
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $CORE_PEER_ADDRESS
peer0.orgcpp.wilsoner.com:7051
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/orgcpp.wilsoner.com/peers/peer0.orgcpp.wilsoner.com/tls
ca.crt server.crt server.key
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_ADDRESS=peer1.orgcpp.wilsoner.com:7051
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_LOCALMSPID=OrgCppMSP
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/orgcpp.wilsoner.com/users/[email protected]/msp
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/orgcpp.wilsoner.com/peers/peer1.orgcpp.wilsoner.com/tls/ca.crt
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/orgcpp.wilsoner.com/peers/peer1.orgcpp.wilsoner.com/tls/server.crt
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/orgcpp.wilsoner.com/peers/peer1.orgcpp.wilsoner.com/tls/server.key
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $CORE_PEER_ADDRESS
peer1.orgcpp.wilsoner.com:7051
root[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls
channel-artifacts crypto testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channle ls
Error: unknown command “channle” for “peer”

Did you mean this?
channel

Run ‘peer --help’ for usage.
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel ls
Operate a channel: create|fetch|join|list|update|signconfigtx|getinfo.

Usage:
peer channel [command]

Available Commands:
create Create a channel
fetch Fetch a block
getinfo get blockchain information of a specified channel.
join Joins the peer to a channel.
list List of channels peer has joined.
signconfigtx Signs a configtx update.
update Send a configtx update.

Flags:
–cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
–certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
–clientauth Use mutual TLS when communicating with the orderer endpoint
–connTimeout duration Timeout for client to connect (default 3s)
-h, --help help for channel
–keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
-o, --orderer string Ordering service endpoint
–ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
–tls Use TLS when communicating with the orderer endpoint

Global Flags:
–logging-level string Default logging level and overrides, see core.yaml for full syntax

Use “peer channel [command] --help” for more information about a command.
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel list
2018-12-12 07:52:31.312 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Channels peers has joined:
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls
channel-artifacts crypto testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b testchannel.block
2018-12-12 07:53:06.800 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-12 07:53:06.924 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -l golang -n testcc -p github.com/chaincode -v v1.0
2018-12-12 07:54:07.280 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-12 07:54:07.280 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-12-12 07:54:07.669 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:“OK” >
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.wilsoner.com:7050 -C testchannel -l golang -n testcc -v v1.0 --tls true --cafile $CAFILE -P “AND (‘OrgGoMSP.member’, ‘OrgCppMSP.member’)” -c ‘{“Args”:[“init”, “a”, “100”, “b”, “200”]}’
2018-12-12 07:54:31.182 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-12 07:54:31.182 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg chaincode with name ‘testcc’ already exists
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# ---------------------
bash: ---------------------: command not found
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer#
Display all 928 possibilities? (y or n)
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# 93
bash: 93: command not found
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/tlscacerts/tlsca.wilsoner.com-cert.pemCSDN
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/tlscacerts/tlsca.wilsoner.com-cert.pemhttps://blog.csdn.net/qq_30505673/article/details/84963320
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# #
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/
tlscacerts/tlsca.wilsoner.com-cert.pem
channel-artifacts/ crypto/ testchannel.block
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# CAFILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/wilsoner.com/orderers/orderer.wilsoner.com/msp/tlscacerts/tlsca.wilsoner.com-cert.pem
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.wilsoner.com:7050 -C testchannel -l golang -n testcc -v v1.0 --tls true --cafile $CAFILE -P “AND (‘OrgGoMSP.member’, ‘OrgCppMSP.member’)” -c ‘{“Args”:[“init”, “a”, “100”, “b”, “200”]}’
2018-12-12 07:55:29.600 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-12 07:55:29.600 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg chaincode with name ‘testcc’ already exists
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -n testcc -C testchannel -c ‘{“Args”:[“query”, “a”]}’
100
[email protected]:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $