2021/03/16 16:47:15 failed to create new channel the Client: the event service creation failed: could not get chConfig cache reference: QueryBlockConfig failed: QueryBlockConfig failed: queryChaincode failed: Transaction processing for endorser [peer0.org1.example.com: 7051] : endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [peer0.org1.example.com: 7051] : the connection is in TRANSIENT_FAILURE
The SDK connection configuration file
Name: "test - network"
Version: 1.0.0
Client:
Organization: Org1
Logging:
Level: the info
Cryptoconfig:
Path:/config/cert
CredentialStore:
Path:/TMP/shanyiou - store
CryptoStore:
Path:/TMP/shanyiou - MSP
BCCSP:
Security:
Enabled: true
Default:
The provider: "SW"
HashAlgorithm: "SHA2
"SoftVerify: true
Level: 256
TlsCerts:
SystemCertPool: false
Client:
Key:
Path:
Cert:
Path:
Channels:
Mychannel:
Peers:
Peer0.org1.example.com:
EndorsingPeer: true
ChaincodeQuery: true
LedgerQuery: true
EventSource: true
Policies:
QueryChannelConfig:
MinResponses: 1
MaxTargets: 1
RetryOpts:
Attempts: 5
InitialBackoff: 500 ms
MaxBackoff: 5 s
BackoffFactor: 2.0
Discovery:
MaxTargets: 2
RetryOpts:
4 attempts:
InitialBackoff: 500 ms
MaxBackoff: 5 s
BackoffFactor: 2.0
EventService:
ResolverStrategy: PreferOrg
Balancer: Random
BlockHeightLagThreshold: 5
ReconnectBlockHeightLagThreshold: 10
PeerMonitorPeriod: 5 s
Organizations:
Org1:
Mspid: Org1MSP
@ org1.example.com/msp cryptoPath: peerOrganizations/org1.example.com/users/{userName}
Peers:
- peer0.org1.example.com
Users:
Admin:
Key:
Path:/config/cert/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/b79a7bf4780dee0b268eebf0b6cbb9e5aa2850b031e796bf2f9ef645e0645c00_sk
Cert:
Path:/config/cert/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/cert.pem
User1:
Key:
Path:/config/cert/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/c81de741513bed57cef9e7ec686e7ff5044f3bb7cf10955935ae664aa6a47f7a_sk
Cert:
Path:/config/cert/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/cert.pem
Orderers:
Orderer.example.com:
Url: grpcs://orderer.example.com: 7050
GrpcOptions:
SSL - target - name - override: orderer.example.com
Keep alive - time: 0 s
Keep alive - timeout: 20 s
Keep alive - permit: false
Fail - fast: false
Allow - insecure: false
TlsCACerts:
# path:/fixtures/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
Path:/config/cert/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Peers:
Peer0.org1.example.com:
Url: peer0.org1.example.com: 7051
EventUrl: grpcs://peer0.org1.example.com: 7053
GrpcOptions:
SSL - target - name - override: peer0.org1.example.com
Keep alive - time: 0 s
Keep alive - timeout: 20 s
Keep alive - permit: false
Fail - fast: false
Allow - insecure: false
TlsCACerts:
Path:/config/cert/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
EntityMatchers:
Peer:
Peer0.org1.example.com - the pattern: * (\ w) (\ w *)
UrlSubstitutionExp: grpcs://peer0.org1.example.com: 7051
EventUrlSubstitutionExp: grpcs://peer0.org1.example.com: 7053
SslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
MappedHost: peer0.org1.example.com
The orderer:
- the pattern: (. *)
UrlSubstitutionExp: GRPCS://localhost: 7050
SslTargetOverrideUrlSubstitutionExp: orderer.example.com
MappedHost: orderer.example.com
Access profile block chain go code
Package the main
Import (
//"FMT"
"Log"
"OS"
"Github.com/hyperledger/fabric-sdk-go/pkg/client/channel
""Github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry
""Github.com/hyperledger/fabric-sdk-go/pkg/core/config
""Github.com/hyperledger/fabric-sdk-go/pkg/fabsdk
")
Const (
ChannelID="mychannel"
ChaincodeID="esg"
OrgID="Org1"
UserID="Admin"
)
Func main () {
ConfigOpt:=config. FromFile ("./config/SDK - config. Yaml ")
The SDK, err:=fabsdk. New (configOpt)
if err ! Nil={
The Fatalf (" \ n "failed to create the new SDK: % v, err)
Return
}
Defer to the SDK. The Close ()
The Printf (" -- -- -- & gt; Create the SDK success \ n ")
Var options_user fabsdk. ContextOption
Var. Options_org fabsdk ContextOption
Options_user=fabsdk. WithUser (userID)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull