Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 1dd2fc6

Browse files
author
Dave Kelsey
authored
fixes and improvements to byfn tutorial (#3166)
Signed-off-by: Dave Kelsey <[email protected]>
1 parent 087ffe8 commit 1dd2fc6

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

packages/composer-website/jekylldocs/tutorials/deploy-to-fabric-multi-org.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Clone the following GitHub repository:
4343

4444
git clone -b issue-6978 https://github.com/sstone1/fabric-samples.git
4545

46-
Follow the [Building Your First Network tutorial](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html), ensuring that you use the GitHub repository cloned in the previous step. You must not clone and use the Hyperledger Fabric version of the GitHub repository as it is currently missing changes that are required for this tutorial. **IMPORTANT** Make sure you are using the `latest` in the url to ensure you are using the preview of {{site.data.conrefs.hlf_full}} 1.1
46+
Follow the [Building Your First Network tutorial](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html), ensuring that you use the GitHub repository cloned in the previous step. You must not clone and use the Hyperledger Fabric version of the GitHub repository as it is currently missing changes that are required for this tutorial.
4747

4848
<h2 class='everybody'>Step One: Starting a {{site.data.conrefs.hlf_full}} network</h2>
4949

@@ -156,7 +156,7 @@ A channel named `mychannel` has been created. All four peer nodes - `peer0.org1.
156156
We need a base connection profile that describes this fabric network which can then be given to `alice` and `bob` to customize for their organization.
157157

158158
{
159-
"name": "hlfv1",
159+
"name": "byfn-network",
160160
"x-type": "hlfv1",
161161
"version": "1.0.0",
162162
"channels": {
@@ -180,7 +180,7 @@ We need a base connection profile that describes this fabric network which can t
180180
"chaincodeQuery": true,
181181
"eventSource": true
182182
},
183-
"peer0.org2.example.com": {
183+
"peer1.org2.example.com": {
184184
"endorsingPeer": true,
185185
"chaincodeQuery": true,
186186
"eventSource": true
@@ -252,7 +252,7 @@ We need a base connection profile that describes this fabric network which can t
252252
"pem": "INSERT_ORG2_CA_CERT"
253253
}
254254
},
255-
"peer0.org1.example.com": {
255+
"peer1.org2.example.com": {
256256
"url": "grpcs://localhost:10051",
257257
"eventUrl": "grpcs://localhost:10053",
258258
"grpcOptions": {
@@ -266,11 +266,17 @@ We need a base connection profile that describes this fabric network which can t
266266
"certificateAuthorities": {
267267
"ca.org1.example.com": {
268268
"url": "https://localhost:7054",
269-
"caName": "ca-org1"
269+
"caName": "ca-org1",
270+
"httpOptions": {
271+
"verify": false
272+
}
270273
},
271274
"ca.org2.example.com": {
272275
"url": "https://localhost:8054",
273-
"caName": "ca-org2"
276+
"caName": "ca-org2",
277+
"httpOptions": {
278+
"verify": false
279+
}
274280
}
275281
}
276282
}
@@ -285,7 +291,7 @@ Use the following command to convert the pem file to something that can be embed
285291

286292
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt > /tmp/composer/org1/ca-org1.txt
287293

288-
copy the contents of the file `/tmp/ca-org1.txt` and replace the text `INSERT_ORG1_CA_CERT`. It should now look something like this
294+
copy the contents of the file `/tmp/composer/org1/ca-org1.txt` and replace the text `INSERT_ORG1_CA_CERT`. It should now look something like this (but be a single line in the profile file)
289295

290296
```
291297
"pem": "-----BEGIN CERTIFICATE-----\nMIICNTCCAdygAwIBAgIRAMNvmQpnXi7uM19BLdha3MwwCgYIKoZIzj0EAwIwbDEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l\neGFtcGxlLmNvbTAeFw0xNzA2MjYxMjQ5MjZaFw0yNzA2MjQxMjQ5MjZaMGwxCzAJ\nBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh\nbmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh\nbXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASJn3QUVcKCp+s6lSPE\nP5KlWmE9rEG0kpECsAfW28vZQSIg2Ez+Tp1alA9SYN/5BtL1N6lUUoVhG3lz8uvi\n8zhro18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB\nAf8EBTADAQH/MCkGA1UdDgQiBCB7ULYTq3+BQqnzwae1RsnwQgJv/HQ5+je2xcDr\nka4MHTAKBggqhkjOPQQDAgNHADBEAiB2hLiS8B1g4J5Qbxu15dVWAZTAXX9xPAvm\n4l25e1oS+gIgBiU/aBwSxY0uambwMB6xtQz0ZE/D4lyTZZcW9SODlOE=\n-----END CERTIFICATE-----\n"
@@ -296,28 +302,22 @@ Use the following command to convert the pem file to something that can be embed
296302

297303
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt > /tmp/composer/org2/ca-org2.txt
298304

299-
Copy the contents of the file `/tmp/ca-org2.txt` and replace the text `INSERT_ORG2_CA_CERT`.
305+
Copy the contents of the file `/tmp/composer/org2/ca-org2.txt` and replace the text `INSERT_ORG2_CA_CERT`.
300306

301307
You need to replace all instances of the text `INSERT_ORDERER_CA_CERT` with the CA certificate for the orderer node:
302308
Use the following command to convert the pem file to something that can be embedded into the above connection profile.
303309

304310
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt > /tmp/composer/ca-orderer.txt
305311

306-
copy the contents of the file `/tmp/ca-orderer.txt` and replace the text `INSERT_ORDERER_CA_CERT`.
307-
308-
Once done, save this file as `connection-network.json`.
309-
310-
Run the following commands to create connection profiles for Org1 and Org2:
312+
copy the contents of the file `/tmp/composer/ca-orderer.txt` and replace the text `INSERT_ORDERER_CA_CERT`.
311313

312-
cd /tmp/composer
313-
cp connection-network.json ./org1/connection-org1.json
314-
cp connection-network.json ./org2/connection-org2.json
314+
Once done, save this file as `/tmp/composer/byfn-network.json`.
315315

316316
This connection profile now describes the fabric network setup, all the peers, orderers and certificate authorities that are part of the network, it defines all the organizations that are participating in the network and also defines the channel's on this network. {{site.data.conrefs.composer_full}} can only interact with a single channel so only one channel should be defined.
317317

318318
<h2 class='alice'>Step Three: Customizing the connection profile for Org1</h2>
319319

320-
This is just a case of now specifying the organization that `alice` belongs to in a client section with optional timeouts, so add the following block into the above connection profile `connection-network.json` after the `version` property and before the `channel` property and save it as `connection-org1.json`.
320+
This is just a case of now specifying the organization that `alice` belongs to in a client section with optional timeouts, so add the following block into the above connection profile `/tmp/composer/byfn-network.json` after the `version` property and before the `channel` property and save it as `/tmp/composer/org1/byfn-network-org1.json`.
321321

322322
"client": {
323323
"organization": "Org1",
@@ -355,7 +355,7 @@ So the section of the profile should look like
355355

356356
<h2 class='bob'>Step Four: Building a connection profile for Org2</h2>
357357

358-
Repeat the same process for `bob` but this time specify the organization as `Org2` and save the file as `connection-org2.json`, it should have a section similar to
358+
Repeat the same process for `bob` but this time specify the organization as `Org2` and save the file as `/tmp/composer/byfn-network-org2.json`, it should have a section similar to
359359

360360
...
361361
"version": "1.0.0",
@@ -385,7 +385,7 @@ You must first locate the certificate file for this user. The certificate is the
385385

386386
Next, you must locate the private key file for this user. The private key is used to sign transactions as this identity. The private key file can be found in the `keystore` subdirectory. The name of the private key file is a long hexadecimal string, with a suffix of `_sk`, for example `78f2139bfcfc0edc7ada0801650ed785a11cfcdef3f9c36f3c8ca2ebfa00a59c_sk`. The name will change every time the configuration is generated.
387387

388-
Remember the path to both of these files, or copy them into the same directory as the connection profile file `connection-org1.json` that you created in step three. You will need these files in the next steps.
388+
Remember the path to both of these files, or copy them into the same directory as the connection profile file `/tmp/composer/org1/byfn-network-org1.json` that you created in step three. You will need these files in the next steps.
389389

390390
<h2 class='bob'>Step Six: Locating the certificate and private key for the {{site.data.conrefs.hlf_full}} administrator for Org2</h2>
391391

@@ -397,15 +397,15 @@ You must first locate the certificate file for this user. The certificate is the
397397

398398
Next, you must locate the private key file for this user. The private key is used to sign transactions as this identity. The private key file can be found in the `keystore` subdirectory. The name of the private key file is a long hexadecimal string, with a suffix of `_sk`, for example `d4889cb2a32e167bf7aeced872a214673ee5976b63a94a6a4e61c135ca2f2dbb_sk`. The name will change every time the configuration is generated.
399399

400-
Remember the path to both of these files, or copy them into the same directory as the connection profile file `connection-org2.json` that you created in step four. You will need these files in the next steps.
400+
Remember the path to both of these files, or copy them into the same directory as the connection profile file `/tmp/composer/byfn-network-org2.json` that you created in step four. You will need these files in the next steps.
401401

402402
<h2 class='alice'>Step Seven: Creating business network cards for the {{site.data.conrefs.hlf_full}} administrator for Org1</h2>
403403

404404
In this step you will create business network cards for the administrator to use to deploy the blockchain business network to the {{site.data.conrefs.hlf_full}} network.
405405

406406
Run the `composer card create` command to create a business network card using the connection profile for `Org1`. You must specify the path to all three files that you either created or located in the previous steps: (note: the _sk_ file will differ.)
407407

408-
composer card create -p connection-org1.json -u PeerAdmin -c [email protected] -k 78f2139bfcfc0edc7ada0801650ed785a11cfcdef3f9c36f3c8ca2ebfa00a59c_sk -r PeerAdmin -r ChannelAdmin -f [email protected]
408+
composer card create -p /tmp/composer/org1/byfn-network-org1.json -u PeerAdmin -c [email protected] -k 78f2139bfcfc0edc7ada0801650ed785a11cfcdef3f9c36f3c8ca2ebfa00a59c_sk -r PeerAdmin -r ChannelAdmin -f [email protected]
409409

410410
If the command works successfully, a business network card file called `[email protected]` will have been written to the current directory.
411411

@@ -415,7 +415,7 @@ In this step you will create business network cards for the administrator to use
415415

416416
Run the `composer card create` command to create a business network card using the connection profile for `Org2`. You must specify the path to all three files that you either created or located in the previous steps:
417417

418-
composer card create -p connection-org2.json -u PeerAdmin -c [email protected] -k d4889cb2a32e167bf7aeced872a214673ee5976b63a94a6a4e61c135ca2f2dbb_sk -r PeerAdmin -r ChannelAdmin -f [email protected]
418+
composer card create -p /tmp/composer/org1/byfn-network-org2.json -u PeerAdmin -c [email protected] -k d4889cb2a32e167bf7aeced872a214673ee5976b63a94a6a4e61c135ca2f2dbb_sk -r PeerAdmin -r ChannelAdmin -f [email protected]
419419

420420
If the command works successfully, a business network card file called `[email protected]` will have been written to the current directory.
421421

@@ -457,7 +457,7 @@ You can find more information on endorsement policies in the {{site.data.conrefs
457457

458458
> Please note that the endorsement policies used for a business network must be in the JSON format used by the {{site.data.conrefs.hlf_full}} Node.js SDK. This is a different format to the simple endorsement policy format used by the {{site.data.conrefs.hlf_full}} CLI, which you will see in the {{site.data.conrefs.hlf_full}} documentation.
459459
460-
Create an endorsement policy file called `endorsement-policy.json` with the following contents and save it to disk. You will use this file in later steps, so remember where you place it!
460+
Create an endorsement policy file called `/tmp/composer/endorsement-policy.json` with the following contents and save it to disk. You will use this file in later steps, so remember where you place it!
461461

462462
{
463463
"identities": [
@@ -520,17 +520,17 @@ The certficates will be placed into a directory called `bob` in the current work
520520

521521
<h2 class='alice'>Step Seventeen: Starting the business network</h2>
522522

523-
Run the `composer network start` command to start the business network. Only `Org1` needs to perform this operation. This command uses the `endorsement-policy.json` file created in step thirteen, and the `admin-pub.pem` files created by both Alice and Bob in step fifteen and step sixteen, so you must ensure that all of these files are accessible to this command:
523+
Run the `composer network start` command to start the business network. Only `Org1` needs to perform this operation. This command uses the `/tmp/composer/endorsement-policy.json` file created in step thirteen, and the `admin-pub.pem` files created by both Alice and Bob in step fifteen and step sixteen, so you must ensure that all of these files are accessible to this command:
524524

525-
composer network start -c PeerAdmin@byfn-network-org1 -a [email protected] -o endorsementPolicyFile=endorsement-policy.json -A alice -C alice/admin-pub.pem -A bob -C bob/admin-pub.pem
525+
composer network start -c PeerAdmin@byfn-network-org1 -a [email protected] -o endorsementPolicyFile=/tmp/composer/endorsement-policy.json -A alice -C alice/admin-pub.pem -A bob -C bob/admin-pub.pem
526526

527527
Once this command completes, the business network will have been started. Both Alice and Bob will be able to access the business network, start to set up the business network, and onboard other participants from their respective organizations. However, both Alice and Bob must create new business network cards with the certificates that they created in the previous steps so that they can access the business network.
528528

529529
<h2 class='alice'>Step Eighteen: Creating a business network card to access the business network as Org1</h2>
530530

531531
Run the `composer card create` command to create a business network card that Alice, the business network administrator for `Org1`, can use to access the business network:
532532

533-
composer card create -p connection-org1.json -u alice -n tutorial-network -c alice/admin-pub.pem -k alice/admin-priv.pem
533+
composer card create -p /tmp/composer/org1/byfn-network-org1.json -u alice -n tutorial-network -c alice/admin-pub.pem -k alice/admin-priv.pem
534534

535535
Run the `composer card import` command to import the business network card that you just created:
536536

@@ -546,7 +546,7 @@ If the command completes successfully, then you should see the fully qualified p
546546

547547
Run the `composer card create` command to create a business network card that Bob, the business network administrator for `Org2`, can use to access the business network:
548548

549-
composer card create -p connection-org2.json -u bob -n tutorial-network -c bob/admin-pub.pem -k bob/admin-priv.pem
549+
composer card create -p /tmp/composer/org1/byfn-network-org2.json -u bob -n tutorial-network -c bob/admin-pub.pem -k bob/admin-priv.pem
550550

551551
Run the `composer card import` command to import the business network card that you just created:
552552

0 commit comments

Comments
 (0)