Skip to content

Commit e827b10

Browse files
committed
FAB-406 node-sdk doc fixes
fixed broken links and formatted node-sdk documents. Copied new images into images folder in both docs and nodeSDK folder to make images working from both github and readthedocs. This is a duplicate effort while submitting changes on these images. https://jira.hyperledger.org/browse/FAB-406 Change-Id: Ia62ffcc602617574f9e685cfa3b44a3873877a84 Signed-off-by: rameshthoomu <[email protected]>
1 parent 02a123c commit e827b10

11 files changed

+134
-119
lines changed
50.8 KB
Loading

docs/images/web-app-developer.png

50.8 KB
Loading
+21-20
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# Setting up the Full Hyperledger fabric Developer's Environment
22

3-
1. See [Setting Up The Development Environment](../dev-setup/devenv.md) to set up your development environment.
3+
1. See [Setting Up The Development Environment](../dev-setup/devenv.md) to set up your development environment.
44

5-
2. Issue the following commands to build the Hyperledger fabric client (HFC) Node.js SDK including the API reference documentation
5+
2. Issue the following commands to build the Hyperledger fabric client (HFC) Node.js SDK including the API reference documentation
66

7-
```
7+
```
88
cd /opt/gopath/src/github.com/hyperledger/fabric/sdk/node
99
make all
10-
```
11-
12-
3. Issue the following command where your Node.js application is located if you wish to use the `require("hfc")`, this will install the HFC locally.
13-
14-
```
15-
npm install /opt/gopath/src/github.com/hyperledger/fabric/sdk/node
16-
```
17-
10+
```
11+
3. Issue the following command where your Node.js application is located if you wish to use the `require("hfc")`, this will install the HFC locally.
12+
13+
```
14+
npm install /opt/gopath/src/github.com/hyperledger/fabric/sdk/node
15+
```
16+
1817
Or use point directly to the HFC directly by using the following require in your code:
19-
```javascript
18+
19+
```javascript
2020
require("/opt/gopath/src/github.com/hyperledger/fabric/sdk/node");
21-
```
22-
23-
24-
4. To see the API reference documentation which is built in step 2:
25-
```
21+
```
22+
23+
4. To see the API reference documentation which is built in step 2:
24+
25+
```
2626
cd /opt/gopath/src/github.com/hyperledger/fabric/sdk/node/doc
27-
```
27+
```
2828

2929
The [Self Contained Node.js Environment](node-sdk-self-contained.md) will have the reference documentation already built and may be accessed by:
30-
```
30+
31+
```
3132
docker exec -it nodesdk /bin/bash
3233
cd /opt/gopath/src/github.com/hyperledger/fabric/sdk/node/doc
33-
```
34+
```

docs/nodeSDK/app-overview.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
Hyperledger fabric supports two types of applications:
44

5-
* A standalone application that interacts directly with a blockchain.
5+
* A standalone application that interacts directly with a blockchain.
66
See the [Standalone Application](#standaloneApp) section.
77

8-
* A web application that interacts with a blockchain on behalf of its web application users.
8+
* A web application that interacts with a blockchain on behalf of its web application users.
99
See the [Web Application](#webApp) section.
1010

1111
<a name="standaloneApp"></a>
1212
## Standalone Application
1313

1414
The following diagram provides an overview of the major components of Hyperledger fabric for the standalone application developer.
1515

16-
![Reference architecture](../images/standalone-app-developer.png)
16+
<img src="../images/standalone-app-developer.png" width="900" height="456">
1717

1818
In the diagram above, the blue boxes are Hyperledger fabric components and the green boxes are application developer components. Each outer box represents a separate process.
1919

@@ -24,14 +24,16 @@ The **Standalone Application** may be developed in Node.js by using the Hyperled
2424

2525
The **SDK** interacts with a **Peer** process. If the Peer process fails, the Node.js Client SDK can fail-over to another Peer as shown by the dotted line from the Node.js Client SDK to another Peer.
2626

27-
This interaction with the Peer consists of submitting transactions to the blockchain. There are three types of transactions:
28-
* deploy - to deploy developer's chaincode as depicted by the green **CC1** boxes in the diagram;
29-
* invoke - to execute a chaincode function which changes the state of the *blockchain database*;
27+
This interaction with the Peer consists of submitting transactions to the blockchain. There are three types of transactions:
28+
29+
* deploy - to deploy developer's chaincode as depicted by the green **CC1** boxes in the diagram;
30+
* invoke - to execute a chaincode function which changes the state of the *blockchain database*;
3031
* query - to execute a chaincode function which may return state information related to the *blockchain database*.
3132

3233
The **SDK** also interacts with a **Membership Services** process. In fact, if security is enabled in the Peer (strongly recommended), the Node.js client SDK must interact with Membership Services first in order to retrieve *credentials* which are then used to interact with the Peer. These *credentials* consist of certificates as described in [Membership Services](membership-services.md).
3334

3435
The interaction with the Membership Services consists of:
36+
3537
* register - to indicate a new user to the blockchain
3638
* enroll - to get access to the blockchain
3739

@@ -41,14 +43,14 @@ The interaction with the Membership Services consists of:
4143
The following diagram provides an overview of the major components of Hyperledger fabric for the web application developer.
4244

4345
At a high-level, you can think of the Block Chain as a database with which the web application interacts; therefore, it is similar to the following topology.
46+
4447
```
4548
browser --> web tier --> database tier
46-
```
4749
50+
```
4851

49-
![Reference architecture](../images/web-app-developer.png)
52+
<img src="../images/web-app-developer.png" width="900" height="456">
5053

5154
In the diagram above, the blue boxes are Hyperledger fabric components and the green boxes are application developer components. Each outer box represents a separate process.
5255

5356
The browser interacts with the developer's Node.js web application using the Hyperledger fabric's Node.js client SDK. The SDK handles all interactions with other Hyperledger fabric components in the same manor as described in the [SDK interactions](#sdk-interactions) section of [Standalone Application](#standaloneApp).
54-
50.8 KB
Loading
50.8 KB
Loading

docs/nodeSDK/node-sdk-indepth.md

+34-33
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ The Hyperledger fabric Client (HFC) SDK provides a powerful and easy to use API
44

55
## Installing only the SDK
66

7-
If you are an experienced node.js developer and already have a blockchain environment set up and running elsewhere, you can set up a client-only environment to run the node.js client by installing the HFC node module as shown below. This assumes npm version 2.11.3 and node.js version 0.12.7 are already installed.
8-
7+
If you are an experienced node.js developer and already have a blockchain environment set up and running elsewhere, you can set up a client-only environment to run the node.js client by installing the HFC node module as shown below. This assumes npm version 2.11.3 and node.js version 0.12.7 are already installed.
8+
99
* To install the latest HFC module of Hyperledger fabric
10+
1011
```
11-
npm install hfc
12+
npm install hfc
1213
```
1314

1415
### Terminology
@@ -49,7 +50,8 @@ The following is a high-level description of the HFC objects (classes and interf
4950

5051
HFC was designed to support two pluggable components:
5152

52-
1. Pluggable `KeyValStore` key value store which is used to retrieve and store keys associated with a member. The key value store is used to store sensitive private keys, so care must be taken to properly protect access.
53+
1. Pluggable `KeyValStore` key value store which is used to retrieve and store keys associated with a member. The key value store is used to store sensitive private keys, so care must be taken to properly protect access.
54+
5355
**IMPORTANT NOTE**: The default KeyValStore is file-based. If multiple instances of a web application run in a cluster, you must provide an implementation of the KeyValStore which is used by all members of the cluster.
5456

5557
2. Pluggable `MemberServices` which is used to register and enroll members. Member services enables hyperledger to be a permissioned blockchain, providing security services such as anonymity, unlinkability of transactions, and confidentiality
@@ -63,40 +65,40 @@ up the chaincode project outside of your Hyperledger fabric source tree to inclu
6365
following instructions will demonstrate how to properly set up the directory
6466
structure to deploy *chaincode_example02* in network mode.
6567

66-
The chaincode project must be placed under the `$GOPATH/src` directory. For
67-
example, the
68-
[chaincode_example02](https://github.com/hyperledger/fabric/blob/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go)
68+
The chaincode project must be placed under the `$GOPATH/src` directory. For example, the [chaincode_example02](https://github.com/hyperledger/fabric/blob/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go)
6969
project should be placed under `$GOPATH/src/` as shown below.
7070

7171
```
72-
mkdir -p $GOPATH/src/github.com/chaincode_example02/
73-
cd $GOPATH/src/github.com/chaincode_example02
74-
curl GET https://raw.githubusercontent.com/hyperledger/fabric/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go > chaincode_example02.go
72+
mkdir -p $GOPATH/src/github.com/chaincode_example02/
73+
cd $GOPATH/src/github.com/chaincode_example02
74+
curl GET https://raw.githubusercontent.com/hyperledger/fabric/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go > chaincode_example02.go
7575
```
7676

7777
After you have placed your chaincode project under the `$GOPATH/src`, you will need to vendor the dependencies. From the directory containing your chaincode source, run the following commands:
7878

7979
```
80-
go get -u github.com/kardianos/govendor
81-
cd $GOPATH/src/github.com/chaincode_example02
82-
govendor init
83-
govendor fetch github.com/hyperledger/fabric
80+
go get -u github.com/kardianos/govendor
81+
cd $GOPATH/src/github.com/chaincode_example02
82+
govendor init
83+
govendor fetch github.com/hyperledger/fabric
8484
```
8585

8686
Now, execute `go build` to verify that all of the chaincode dependencies are
8787
present.
8888

8989
```
90-
go build
90+
go build
9191
```
9292

9393
#### 'dev' mode
9494
For deploying chaincode in development mode see [Writing, Building, and Running Chaincode in a Development Environment](../Setup/Chaincode-setup.md).
9595
The chaincode must be running and connected to the peer before issuing the `deploy()` from the Node.js application. The hfc `chain` object must be set to dev mode.
96+
9697
```javascript
9798
chain.setDevMode(true);
9899
```
99100
The deploy request must include the `chaincodeName` that the chaincode registered with the peer. The built-in chaincode example checks an environment variable `CORE_CHAINCODE_ID_NAME=mycc` when it starts.
101+
100102
```json
101103
var deployRequest = {
102104
chaincodeName: 'mycc',
@@ -112,11 +114,11 @@ If you wish to configure TLS with the Membership Services server, the following
112114
- Modify `$GOPATH/src/github.com/hyperledger/fabric/membersrvc/membersrvc.yaml` as follows:
113115

114116
```
115-
server:
116-
tls:
117-
cert:
117+
server:
118+
tls:
119+
cert:
118120
file: "/var/hyperledger/production/.membersrvc/tlsca.cert"
119-
key:
121+
key:
120122
file: "/var/hyperledger/production/.membersrvc/tlsca.priv"
121123
```
122124

@@ -125,12 +127,12 @@ To specify to the Membership Services (TLS) Certificate Authority (TLSCA) what X
125127
- Modify `$GOPATH/src/github.com/hyperledger/fabric/peer/core.yaml` as follows:
126128

127129
```
128-
peer:
129-
pki:
130-
tls:
131-
enabled: true
132-
rootcert:
133-
file: "/var/hyperledger/production/.membersrvc/tlsca.cert"
130+
peer:
131+
pki:
132+
tls:
133+
enabled: true
134+
rootcert:
135+
file: "/var/hyperledger/production/.membersrvc/tlsca.cert"
134136
```
135137

136138
To configure the peer to connect to the Membership Services server over TLS (otherwise, the connection will fail).
@@ -140,19 +142,18 @@ To configure the peer to connect to the Membership Services server over TLS (oth
140142
- Copy `/var/hyperledger/production/.membersrvc/tlsca.cert` to `$GOPATH/src/github.com/hyperledger/fabric/sdk/node`.
141143

142144
*Note:* If you cleanup the folder `/var/hyperledger/production` then don't forget to copy again the *tlsca.cert* file as described above.
143-
144-
145-
146-
147145

148146
### Troublingshooting
149147
If you see errors stating that the client has already been registered/enrolled, keep in mind that you can perform the enrollment process only once, as the enrollmentSecret is a one-time-use password. You will see these errors if you have performed a user registration/enrollment and subsequently deleted the cryptographic tokens stored on the client side. The next time you try to enroll, errors similar to the ones below will be seen.
150148

151-
```
149+
```
152150
Error: identity or token do not match
153-
```
154-
```
151+
152+
```
153+
154+
```
155155
Error: user is already registered
156-
```
156+
157+
```
157158

158159
To address this, remove any stored cryptographic material from the CA server by following the instructions [here](https://github.com/hyperledger/fabric/blob/master/docs/Setup/Chaincode-setup.md#removing-temporary-files-when-security-is-enabled). You will also need to remove any of the cryptographic tokens stored on the client side by deleting the KeyValStore directory. That directory is configurable and is set to `/tmp/keyValStore` within the unit tests.

0 commit comments

Comments
 (0)