Not able to query the BYFN via fabric-sdk-go due to the error “ no endorsement combination…”












1















I am trying to use fabric-sdk-go to access the fabric network which is buid up via BYFN .
I want to try to do the same thing as the cli command:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'



but only get the error:
Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied.



The endorsement policy is:



-P "AND ('Org1MSP.peer','Org2MSP.peer')"


The client code is below:



configPath := "config-payment.yaml"
sdk, err := fabsdk.New(config.FromFile(configPath))
defer sdk.Close()

clientChannelContext := sdk.ChannelContext(channelID, fabsdk.WithUser("User1"), fabsdk.WithOrg(orgName))
client, err := channel.New(clientChannelContext)

args := byte{byte("a")}
_, err = client.Query(channel.Request{ChaincodeID: ccID, Fcn: "query", Args: args},
channel.WithRetry(retry.DefaultChannelOpts))
if err != nil {
log.Fatalf("Failed to query: %s", err)
}


And the config-payment.yaml is below:



    version: 1.0.0
client:
organization: org1
logging:
level: info
cryptoconfig:
path: fabric-network/first-network/crypto-config
credentialStore:
path: "/tmp/state-store"
cryptoStore:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
client:
key:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.key
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.crt

channels:
_default:
peers:
peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
discovery:
maxTargets: 2
retryOpts:
attempts: 4
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
eventService:
resolverStrategy: PreferOrg
balancer: Random
blockHeightLagThreshold: 5
reconnectBlockHeightLagThreshold: 8
peerMonitorPeriod: 6s
mychannel:
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

organizations:
org1:
mspid: Org1MSP
cryptoPath: peerOrganizations/org1.example.com/users/{username}@org1.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
peers:
- peer0.org1.example.com
- peer1.org1.example.com
org2:
mspid: Org2MSP
cryptoPath: peerOrganizations/org2.example.com/users/{username}@org2.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem
peers:
- peer0.org2.example.com
- peer1.org2.example.com

Orderer:
mspID: OrdererMSP
cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp
peers:
- orderer.example.com
orderers:
orderer.example.com:
url: localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem

peers:
peer0.org1.example.com:
url: localhost:7051
eventUrl: localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer1.org1.example.com:
url: localhost:8051
eventUrl: localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer0.org2.example.com:
url: localhost:9051
eventUrl: localhost:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

peer1.org2.example.com:
url: localhost:10051
eventUrl: localhost:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

entityMatchers:
peer:
- pattern: peer0.org1.example.com:7051
urlSubstitutionExp: localhost:7051
eventUrlSubstitutionExp: localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com

- pattern: peer1.org1.example.com:7051
urlSubstitutionExp: localhost:8051
eventUrlSubstitutionExp: localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com

- pattern: peer0.org2.example.com:7051
urlSubstitutionExp: localhost:9051
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com

- pattern: peer1.org2.example.com:7051
urlSubstitutionExp: localhost:10051
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com

orderer:
- pattern: orderer.example.com:7050
urlSubstitutionExp: localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com









share|improve this question

























  • What was the endorsement policy of your chaincode?

    – Tanmoy Krishna Das
    Nov 23 '18 at 9:54
















1















I am trying to use fabric-sdk-go to access the fabric network which is buid up via BYFN .
I want to try to do the same thing as the cli command:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'



but only get the error:
Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied.



The endorsement policy is:



-P "AND ('Org1MSP.peer','Org2MSP.peer')"


The client code is below:



configPath := "config-payment.yaml"
sdk, err := fabsdk.New(config.FromFile(configPath))
defer sdk.Close()

clientChannelContext := sdk.ChannelContext(channelID, fabsdk.WithUser("User1"), fabsdk.WithOrg(orgName))
client, err := channel.New(clientChannelContext)

args := byte{byte("a")}
_, err = client.Query(channel.Request{ChaincodeID: ccID, Fcn: "query", Args: args},
channel.WithRetry(retry.DefaultChannelOpts))
if err != nil {
log.Fatalf("Failed to query: %s", err)
}


And the config-payment.yaml is below:



    version: 1.0.0
client:
organization: org1
logging:
level: info
cryptoconfig:
path: fabric-network/first-network/crypto-config
credentialStore:
path: "/tmp/state-store"
cryptoStore:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
client:
key:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.key
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.crt

channels:
_default:
peers:
peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
discovery:
maxTargets: 2
retryOpts:
attempts: 4
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
eventService:
resolverStrategy: PreferOrg
balancer: Random
blockHeightLagThreshold: 5
reconnectBlockHeightLagThreshold: 8
peerMonitorPeriod: 6s
mychannel:
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

organizations:
org1:
mspid: Org1MSP
cryptoPath: peerOrganizations/org1.example.com/users/{username}@org1.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
peers:
- peer0.org1.example.com
- peer1.org1.example.com
org2:
mspid: Org2MSP
cryptoPath: peerOrganizations/org2.example.com/users/{username}@org2.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem
peers:
- peer0.org2.example.com
- peer1.org2.example.com

Orderer:
mspID: OrdererMSP
cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp
peers:
- orderer.example.com
orderers:
orderer.example.com:
url: localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem

peers:
peer0.org1.example.com:
url: localhost:7051
eventUrl: localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer1.org1.example.com:
url: localhost:8051
eventUrl: localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer0.org2.example.com:
url: localhost:9051
eventUrl: localhost:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

peer1.org2.example.com:
url: localhost:10051
eventUrl: localhost:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

entityMatchers:
peer:
- pattern: peer0.org1.example.com:7051
urlSubstitutionExp: localhost:7051
eventUrlSubstitutionExp: localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com

- pattern: peer1.org1.example.com:7051
urlSubstitutionExp: localhost:8051
eventUrlSubstitutionExp: localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com

- pattern: peer0.org2.example.com:7051
urlSubstitutionExp: localhost:9051
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com

- pattern: peer1.org2.example.com:7051
urlSubstitutionExp: localhost:10051
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com

orderer:
- pattern: orderer.example.com:7050
urlSubstitutionExp: localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com









share|improve this question

























  • What was the endorsement policy of your chaincode?

    – Tanmoy Krishna Das
    Nov 23 '18 at 9:54














1












1








1








I am trying to use fabric-sdk-go to access the fabric network which is buid up via BYFN .
I want to try to do the same thing as the cli command:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'



but only get the error:
Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied.



The endorsement policy is:



-P "AND ('Org1MSP.peer','Org2MSP.peer')"


The client code is below:



configPath := "config-payment.yaml"
sdk, err := fabsdk.New(config.FromFile(configPath))
defer sdk.Close()

clientChannelContext := sdk.ChannelContext(channelID, fabsdk.WithUser("User1"), fabsdk.WithOrg(orgName))
client, err := channel.New(clientChannelContext)

args := byte{byte("a")}
_, err = client.Query(channel.Request{ChaincodeID: ccID, Fcn: "query", Args: args},
channel.WithRetry(retry.DefaultChannelOpts))
if err != nil {
log.Fatalf("Failed to query: %s", err)
}


And the config-payment.yaml is below:



    version: 1.0.0
client:
organization: org1
logging:
level: info
cryptoconfig:
path: fabric-network/first-network/crypto-config
credentialStore:
path: "/tmp/state-store"
cryptoStore:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
client:
key:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.key
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.crt

channels:
_default:
peers:
peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
discovery:
maxTargets: 2
retryOpts:
attempts: 4
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
eventService:
resolverStrategy: PreferOrg
balancer: Random
blockHeightLagThreshold: 5
reconnectBlockHeightLagThreshold: 8
peerMonitorPeriod: 6s
mychannel:
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

organizations:
org1:
mspid: Org1MSP
cryptoPath: peerOrganizations/org1.example.com/users/{username}@org1.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
peers:
- peer0.org1.example.com
- peer1.org1.example.com
org2:
mspid: Org2MSP
cryptoPath: peerOrganizations/org2.example.com/users/{username}@org2.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem
peers:
- peer0.org2.example.com
- peer1.org2.example.com

Orderer:
mspID: OrdererMSP
cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp
peers:
- orderer.example.com
orderers:
orderer.example.com:
url: localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem

peers:
peer0.org1.example.com:
url: localhost:7051
eventUrl: localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer1.org1.example.com:
url: localhost:8051
eventUrl: localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer0.org2.example.com:
url: localhost:9051
eventUrl: localhost:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

peer1.org2.example.com:
url: localhost:10051
eventUrl: localhost:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

entityMatchers:
peer:
- pattern: peer0.org1.example.com:7051
urlSubstitutionExp: localhost:7051
eventUrlSubstitutionExp: localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com

- pattern: peer1.org1.example.com:7051
urlSubstitutionExp: localhost:8051
eventUrlSubstitutionExp: localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com

- pattern: peer0.org2.example.com:7051
urlSubstitutionExp: localhost:9051
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com

- pattern: peer1.org2.example.com:7051
urlSubstitutionExp: localhost:10051
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com

orderer:
- pattern: orderer.example.com:7050
urlSubstitutionExp: localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com









share|improve this question
















I am trying to use fabric-sdk-go to access the fabric network which is buid up via BYFN .
I want to try to do the same thing as the cli command:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'



but only get the error:
Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied.



The endorsement policy is:



-P "AND ('Org1MSP.peer','Org2MSP.peer')"


The client code is below:



configPath := "config-payment.yaml"
sdk, err := fabsdk.New(config.FromFile(configPath))
defer sdk.Close()

clientChannelContext := sdk.ChannelContext(channelID, fabsdk.WithUser("User1"), fabsdk.WithOrg(orgName))
client, err := channel.New(clientChannelContext)

args := byte{byte("a")}
_, err = client.Query(channel.Request{ChaincodeID: ccID, Fcn: "query", Args: args},
channel.WithRetry(retry.DefaultChannelOpts))
if err != nil {
log.Fatalf("Failed to query: %s", err)
}


And the config-payment.yaml is below:



    version: 1.0.0
client:
organization: org1
logging:
level: info
cryptoconfig:
path: fabric-network/first-network/crypto-config
credentialStore:
path: "/tmp/state-store"
cryptoStore:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
client:
key:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.key
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.crt

channels:
_default:
peers:
peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
discovery:
maxTargets: 2
retryOpts:
attempts: 4
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
eventService:
resolverStrategy: PreferOrg
balancer: Random
blockHeightLagThreshold: 5
reconnectBlockHeightLagThreshold: 8
peerMonitorPeriod: 6s
mychannel:
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

peer1.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true

organizations:
org1:
mspid: Org1MSP
cryptoPath: peerOrganizations/org1.example.com/users/{username}@org1.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
peers:
- peer0.org1.example.com
- peer1.org1.example.com
org2:
mspid: Org2MSP
cryptoPath: peerOrganizations/org2.example.com/users/{username}@org2.example.com/msp
users:
Admin:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem
User1:
cert:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem
peers:
- peer0.org2.example.com
- peer1.org2.example.com

Orderer:
mspID: OrdererMSP
cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp
peers:
- orderer.example.com
orderers:
orderer.example.com:
url: localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem

peers:
peer0.org1.example.com:
url: localhost:7051
eventUrl: localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer1.org1.example.com:
url: localhost:8051
eventUrl: localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem

peer0.org2.example.com:
url: localhost:9051
eventUrl: localhost:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

peer1.org2.example.com:
url: localhost:10051
eventUrl: localhost:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: fabric-network/first-network/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem

entityMatchers:
peer:
- pattern: peer0.org1.example.com:7051
urlSubstitutionExp: localhost:7051
eventUrlSubstitutionExp: localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com

- pattern: peer1.org1.example.com:7051
urlSubstitutionExp: localhost:8051
eventUrlSubstitutionExp: localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com

- pattern: peer0.org2.example.com:7051
urlSubstitutionExp: localhost:9051
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com

- pattern: peer1.org2.example.com:7051
urlSubstitutionExp: localhost:10051
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com

orderer:
- pattern: orderer.example.com:7050
urlSubstitutionExp: localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com






hyperledger-fabric hyperledger-fabric-sdk-go






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 11:58







Moon

















asked Nov 22 '18 at 12:59









MoonMoon

336




336













  • What was the endorsement policy of your chaincode?

    – Tanmoy Krishna Das
    Nov 23 '18 at 9:54



















  • What was the endorsement policy of your chaincode?

    – Tanmoy Krishna Das
    Nov 23 '18 at 9:54

















What was the endorsement policy of your chaincode?

– Tanmoy Krishna Das
Nov 23 '18 at 9:54





What was the endorsement policy of your chaincode?

– Tanmoy Krishna Das
Nov 23 '18 at 9:54












1 Answer
1






active

oldest

votes


















1














Afer debuging the code, I found the root cause was due to the "Exclude" filter:



func containsPeer(peers fab.Peer, peer fab.Peer) bool {
for _, p := range peers {
if p.URL() == peer.URL() {
return true
}
}
return false
}

peers[3].url = localhost:7051
peer.url = peer0.org1.example.com:7051


I was blocked by a connection problem, so I set the URL as localhost instead of peer0.org1.example.com. So the peer0.org1 was excluded and hence got the error: getting endorsers from channel response: no endorsement combination can be satisfied.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431595%2fnot-able-to-query-the-byfn-via-fabric-sdk-go-due-to-the-error-no-endorsement-c%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Afer debuging the code, I found the root cause was due to the "Exclude" filter:



    func containsPeer(peers fab.Peer, peer fab.Peer) bool {
    for _, p := range peers {
    if p.URL() == peer.URL() {
    return true
    }
    }
    return false
    }

    peers[3].url = localhost:7051
    peer.url = peer0.org1.example.com:7051


    I was blocked by a connection problem, so I set the URL as localhost instead of peer0.org1.example.com. So the peer0.org1 was excluded and hence got the error: getting endorsers from channel response: no endorsement combination can be satisfied.






    share|improve this answer






























      1














      Afer debuging the code, I found the root cause was due to the "Exclude" filter:



      func containsPeer(peers fab.Peer, peer fab.Peer) bool {
      for _, p := range peers {
      if p.URL() == peer.URL() {
      return true
      }
      }
      return false
      }

      peers[3].url = localhost:7051
      peer.url = peer0.org1.example.com:7051


      I was blocked by a connection problem, so I set the URL as localhost instead of peer0.org1.example.com. So the peer0.org1 was excluded and hence got the error: getting endorsers from channel response: no endorsement combination can be satisfied.






      share|improve this answer




























        1












        1








        1







        Afer debuging the code, I found the root cause was due to the "Exclude" filter:



        func containsPeer(peers fab.Peer, peer fab.Peer) bool {
        for _, p := range peers {
        if p.URL() == peer.URL() {
        return true
        }
        }
        return false
        }

        peers[3].url = localhost:7051
        peer.url = peer0.org1.example.com:7051


        I was blocked by a connection problem, so I set the URL as localhost instead of peer0.org1.example.com. So the peer0.org1 was excluded and hence got the error: getting endorsers from channel response: no endorsement combination can be satisfied.






        share|improve this answer















        Afer debuging the code, I found the root cause was due to the "Exclude" filter:



        func containsPeer(peers fab.Peer, peer fab.Peer) bool {
        for _, p := range peers {
        if p.URL() == peer.URL() {
        return true
        }
        }
        return false
        }

        peers[3].url = localhost:7051
        peer.url = peer0.org1.example.com:7051


        I was blocked by a connection problem, so I set the URL as localhost instead of peer0.org1.example.com. So the peer0.org1 was excluded and hence got the error: getting endorsers from channel response: no endorsement combination can be satisfied.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 24 '18 at 14:06

























        answered Nov 24 '18 at 13:54









        MoonMoon

        336




        336
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431595%2fnot-able-to-query-the-byfn-via-fabric-sdk-go-due-to-the-error-no-endorsement-c%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()