Skip to content

Commit 2383597

Browse files
committed
Clean up SETUP.md and README.md
1 parent 7ba52a3 commit 2383597

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ The directory structure should look like the image below.
8282
This file states that the index will:
8383
- keep track of the *issuer* field of each document
8484
- store this index in a design document (ddoc) named *issuerIndexDoc*
85-
- is named issuerIndex
86-
- will be in json format
85+
- is named *issuerIndex*
86+
- will be in *json* format
8787

8888
Now let's create two more index files.
8989

@@ -101,7 +101,7 @@ Now let's create two more index files.
101101
}
102102
```
103103

104-
This index is very similar to the previous one for the issuer field but instead we are indexing the *owner* field.
104+
This index is very similar to the previous one for the *issuer* field but instead we are indexing the *owner* field.
105105

106106
5. Finally, create one last file in the **indexes** directory and name it **currentStateIndex.json**
107107
6. Then, copy the following code into that file:
@@ -132,8 +132,8 @@ And that's all it takes to build indexes. These indexes will be deployed the nex
132132

133133
Now we need to implement the query logic in the transactions of the smart contract. These transactions will be invoked by the Node.js SDK to execute our queries.
134134

135-
1. Using VSCode, open the [papercontract.js](./papercontract.js) file found in this pattern repo
136-
2. Replace the contents of [contract/lib/papercontract.js](./contract/lib/papercontract.js) with the new [papercontract.js](./papercontract.js)
135+
1. Using VSCode, open the [papercontract.js](./papercontract.js) file found in this pattern repo.
136+
2. Replace the contents of [contract/lib/papercontract.js](./contract/lib/papercontract.js) with the new [papercontract.js](./papercontract.js).
137137

138138
This updated contract already has the query logic added. Let's take a look at the transactions that were added.
139139

@@ -145,7 +145,7 @@ This updated contract already has the query logic added. Let's take a look at th
145145

146146
Let's take a closer look at the code involved in making these queries.
147147

148-
Open the new [papercontract.js](./papercontract.js) in VS Code and go to line 182
148+
Open the new [papercontract.js](./papercontract.js) in VS Code and go to line 182.
149149

150150
<br>
151151
<p align="center">
@@ -162,7 +162,7 @@ The next property to note is `use_index` which allows you to specify a design do
162162

163163
Since we made changes to the smart contract we now need to re-deploy it to the peer.
164164

165-
1. Open up [contract/package.json](./contract/package.json) in VS Code
165+
1. Open up [contract/package.json](./contract/package.json) in VS Code.
166166

167167
2. Change the *version* property to **0.0.2** and save the file.
168168

@@ -274,7 +274,7 @@ Your folder structure should look similar to the picture below, with the wallet
274274

275275
Right now the world state is empty and there is nothing to query. Let's add some entries to the ledger so that we can see some results when we run the queries.
276276

277-
1. From the terminal and while in the **application** folder, run `node setup.js`
277+
1. From the terminal and while in the **application** folder, run `node setup.js`.
278278

279279
This will run through a variety of transactions to populate the ledger. The process will take about 2-3 minutes. While this is running, take a look at the **setup.js** file from within VS Code to see what the transactions are doing.
280280

@@ -283,11 +283,11 @@ This will run through a variety of transactions to populate the ledger. The proc
283283

284284
Now we can finally get around to querying the world state.
285285

286-
1. From the terminal, run `node query.js`
286+
1. From the terminal, run `node query.js`.
287287

288288
This query will return absolutely everything that is in the world state. While this might be valuable in some situations, in most cases you will want to search based on certain criteria such as by owner or by status.
289289

290-
2. From the terminal, run `node queryByOwner.js`
290+
2. From the terminal, run `node queryByOwner.js`.
291291

292292
This query will return all assets that are currently owned by MagnetoCorp. If you take a look at the `queryByOwner.js` file in VS Code you can see in line 66 that we are calling the `queryByOwner` transaction defined in the `papercontract.js` file and that we are passing in `MagnetoCorp` as the only argument. You can easily change `MagnetoCorp` to `DigiBank` and rerun the query to get all assets owned by DigiBank instead.
293293

@@ -297,7 +297,7 @@ This query will return all assets that are currently owned by MagnetoCorp. If yo
297297
</p>
298298
<br>
299299

300-
3. From the terminal, run `node queryByCurrentState.js`
300+
3. From the terminal, run `node queryByCurrentState.js`.
301301

302302
This query will return all commercial papers that have been bought. If you take a look at `queryByCurrentState.js` in VS Code you can see in line 64 that this time we are calling the `queryByCurrentState` transaction in `papercontract.js` and passing in the status code of 2 as the only parameter. The status codes for the commercial papers are as follows:
303303

SETUP.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Verify the installation under the Extensions view.
1919

2020
#### Step 2. Start a local fabric environment
2121

22-
Go to the Blockchain platform view and under `FABRIC ENVIRONMENTS`, click on `Local Fabric` to start the Local Fabric environment
22+
Go to the Blockchain platform view and under `FABRIC ENVIRONMENTS`, click on `Local Fabric` to start the Local Fabric environment.
2323

2424
<br>
2525
<p align="center">
@@ -34,7 +34,7 @@ After a few minutes, your network will be up and running.
3434

3535
1. Open up your terminal and `cd` into where you'd like to clone the repo.
3636

37-
2. Then, enter the following command to clone the repo
37+
2. Then, enter the following command to clone the repo.
3838

3939
```bash
4040
git clone https://github.com/IBM/queryPattern
@@ -50,7 +50,7 @@ In this section, we will deploy the base commercial paper smart contract which w
5050

5151
In VSCode, choose `File` > `Open...`, and select the **contract** folder within the repo that was cloned in the previous step.
5252

53-
Then, right click in the space under your files in the **Explorer** view and select **Add folder to workspace...**
53+
Then, right click in the space under your files in the **Explorer** view and select **Add folder to workspace...**.
5454

5555
<br>
5656
<p align="center">
@@ -112,9 +112,9 @@ When the process completes, you should see **papercontract@0.0.1** under the *In
112112

113113
#### Step 6. Instantiate the contract
114114

115-
1. In the **FABRIC ENVIRONMENTS** section, click on **+ Instantiate**
115+
1. In the **FABRIC ENVIRONMENTS** section, click on **+ Instantiate**.
116116

117-
2. Select **papercontract@0.0.1** when asked to select a smart contract
117+
2. Select **papercontract@0.0.1** when asked to select a smart contract.
118118

119119
4. You will then be prompted to enter a function to call, type **instantiate** and press enter.
120120

@@ -126,7 +126,7 @@ When the process completes, you should see **papercontract@0.0.1** under the *In
126126

127127
After a short delay, your smart contract will be instantiated on the channel.
128128

129-
If everything went according to plan then you should see *papercontract@0.0.1* listed under the *Instantiated* section of **FABRIC ENVIRONMENTS**
129+
If everything went according to plan then you should see **papercontract@0.0.1** listed under the *Instantiated* section of **FABRIC ENVIRONMENTS**.
130130

131131
<br>
132132
<p align="center">

0 commit comments

Comments
 (0)