Skip to content

Commit 51627d7

Browse files
Address fab-1346 to begin v1.0 docs
Refactored docs to focus on current devenv preference for native docker over vagrant. Remove no longer relevant info for membership services. remove REST API info, and rename CoreAPI.md to CLI.md. Left placeholders for documentation (coming soon). added gnubsd dependency Change-Id: I31c6b56ef892a85c3b79651550b8c6bbd566cdb3 Signed-off-by: Christopher Ferris <[email protected]>
1 parent e810bdb commit 51627d7

File tree

9 files changed

+236
-1260
lines changed

9 files changed

+236
-1260
lines changed

docs/API/CLI.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Command-line Interface (CLI)
2+
3+
To view the currently available CLI commands, execute the following:
4+
5+
```
6+
cd /opt/gopath/src/github.com/hyperledger/fabric
7+
build/bin/peer
8+
```
9+
10+
You will see output similar to the example below (**NOTE:** rootcommand below
11+
is hardcoded in [main.go](https://github.com/hyperledger/fabric/blob/master/main.go).
12+
Currently, the build will create a *peer* executable file).
13+
14+
```
15+
Usage:
16+
peer [flags]
17+
peer [command]
18+
19+
Available Commands:
20+
version Print fabric peer version.
21+
node node specific commands.
22+
network network specific commands.
23+
chaincode chaincode specific commands.
24+
help Help about any command
25+
26+
Flags:
27+
-h, --help[=false]: help for peer
28+
--logging-level="": Default logging level and overrides, see core.yaml for full syntax
29+
--test.coverprofile="coverage.cov": Done
30+
-v, --version[=false]: Show current version number of fabric peer server
31+
32+
33+
Use "peer [command] --help" for more information about a command.
34+
35+
```
36+
37+
The `peer` command supports several subcommands and flags, as shown above. To
38+
facilitate its use in scripted applications, the `peer` command always
39+
produces a non-zero return code in the event of command failure. Upon success,
40+
many of the subcommands produce a result on **stdout** as shown in the table
41+
below:
42+
43+
Command | **stdout** result in the event of success
44+
--- | ---
45+
`version` | String form of `peer.version` defined in [core.yaml](https://github.com/hyperledger/fabric/blob/master/peer/core.yaml)
46+
`node start` | N/A
47+
`node status` | String form of [StatusCode](https://github.com/hyperledger/fabric/blob/master/protos/server_admin.proto#L36)
48+
`node stop` | String form of [StatusCode](https://github.com/hyperledger/fabric/blob/master/protos/server_admin.proto#L36)
49+
`network login` | N/A
50+
`network list` | The list of network connections to the peer node.
51+
`chaincode deploy` | The chaincode container name (hash) required for subsequent `chaincode invoke` and `chaincode query` commands
52+
`chaincode invoke` | The transaction ID (UUID)
53+
`chaincode query` | By default, the query result is formatted as a printable
54+
string. Command line options support writing this value as raw bytes (-r, --raw),
55+
or formatted as the hexadecimal representation of the raw bytes (-x, --hex). If
56+
the query response is empty then nothing is output.
57+
58+
## Deploy a Chaincode
59+
60+
Deploy creates the docker image for the chaincode and subsequently deploys the
61+
package to the validating peer. An example is below.
62+
63+
```
64+
peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
65+
```
66+
Or:
67+
68+
```
69+
peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args": ["init", "a","100", "b", "200"]}'
70+
```
71+
72+
The response to the chaincode deploy command will contain the chaincode
73+
identifier (hash) which will be required on subsequent `chaincode invoke`
74+
and `chaincode query` commands in order to uniquely identify the deployed
75+
chaincode.
76+
77+
**Note:** If your GOPATH environment variable contains more than one element,
78+
the chaincode must be found in the first one or deployment will fail.

0 commit comments

Comments
 (0)