Skip to content

discover command cheetsheet

James Taylor edited this page Jul 7, 2020 · 2 revisions

See Service Discovery CLI for more info.

Configure for test network org1 user1

discover --configFile=discover.yaml --peerTLSCA ~/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/[email protected]/tls/ca.crt --userKey ~/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk --userCert ~/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected] --MSP Org1MSP saveConfig

Show peers in the default test network channel

discover --configFile discover.yaml peers --channel mychannel --server localhost:7051

Show the test network config

discover --configFile discover.yaml config --channel mychannel --server localhost:7051

Get the first order

discover --configFile discover.yaml config --channel mychannel --server localhost:7051 | jq -r '.orderers[.orderers | keys | .[0]].endpoint[0] | "\(.host):\(.port)"'

Extract TLS certificate of first orderer

discover --configFile discover.yaml config --channel mychannel --server localhost:7051 | jq -r '.msps[.orderers | keys | .[0]].root_certs[0]' | base64 --decode

Display details of TLS certificate of first orderer

discover --configFile discover.yaml config --channel mychannel --server localhost:7051 | jq -r '.msps[.orderers | keys | .[0]].root_certs[0]' | base64 --decode | openssl x509 -text -noout

Getting initial config (tbc)

Get peer TLS CA cert from connection profile

cat connection.json | jq -r '.peers[.organizations[.client.organization].peers[0]].tlsCACerts.pem'