You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: archive/motoko/dip721-nft-container/README.md
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ When upgrading canister code, however, it is necessary to explicitly handle cani
28
28
### 2. Certified data.
29
29
Generally, when a function only reads data, instead of modifying the state of the canister, it is
30
30
beneficial to use a [query call instead of an update call](https://internetcomputer.org/docs/current/concepts/canisters-code.md#query-and-update-methods).
31
-
But, since query calls do not go through consensus, [certified responses](https://internetcomputer.org/docs/current/developer-docs/security/general-security-best-practices)
31
+
But, since query calls do not go through consensus, [certified responses](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
32
32
should be used wherever possible. The HTTP interface of the Rust implementation shows how certified data can be handled.
33
33
34
34
### 3. Delegating control over assets.
@@ -47,7 +47,7 @@ In case an error occurs during any part of the upgrade (including `post_upgdrade
47
47
48
48
The Rust CDK (Canister Development Kit) currently only supports one value in stable memory, so it is necessary to create an object that can hold everything you care about.
49
49
In addition, not every data type can be stored in stable memory; only ones that implement the [CandidType trait](https://docs.rs/candid/latest/candid/types/trait.CandidType.html)
50
-
(usually via the [CandidType derive macro](https://docs.rs/candid/latest/candid/derive.CandidType.html)) can be written to stable memory.
50
+
(usually via the [CandidType derive macro](https://docs.rs/candid/latest/candid/derive.CandidType.html)) can be written to stable memory.
51
51
52
52
Since the state of our canister includes a `RbTree` which does not implement the `CandidType`, it has to be converted into a data structure (in this case a `Vec`) that implements `CandidType`.
53
53
Luckily, both `RbTree` and `Vec` implement functions that allow converting to/from iterators, so the conversion can be done quite easily.
@@ -76,7 +76,7 @@ For a much more detailed explanation of how certification works, see [this expla
76
76
-**Operator**: sort of a delegated owner. The operator does not own the NFT but can do the same actions an owner can do.
77
77
-**Custodian**: creator of the NFT collection/canister. They can do anything (transfer, add/remove operators, burn, and even un-burn) to NFTs, but also mint new ones or change the symbol or description of the collection.
78
78
79
-
The NFT example canister keeps access control in these three levels very simple:
79
+
The NFT example canister keeps access control in these three levels very simple:
80
80
- For every level of control, a separate list (or set) of principals is kept.
81
81
- Those three levels are then manually checked every single time someone attempts to do something for which they require authorization.
82
82
- If a user is not authorized to call a certain function an error is returned.
@@ -88,7 +88,7 @@ Using this management canister address, we can construct its principal and set t
88
88
89
89
## NFT sample code tutorial
90
90
91
-
### Prerequisites
91
+
### Prerequisites
92
92
93
93
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
94
94
-[x] Download and install [git.](https://git-scm.com/downloads)
@@ -108,7 +108,7 @@ cd examples/motoko/dip721-nft-container
108
108
### Step 3: Run a local instance of the Internet Computer:
109
109
110
110
```bash
111
-
dfx start --background
111
+
dfx start --background
112
112
```
113
113
114
114
**If this is not a new installation, you may need to run `start` with the `--clean` flag.**
@@ -123,7 +123,7 @@ This command deploys the DIP721 NFT canister with the following initialization a
123
123
124
124
```bash
125
125
dfx deploy --argument "(
126
-
principal\"$(dfx identity get-principal)\",
126
+
principal\"$(dfx identity get-principal)\",
127
127
record {
128
128
logo = record {
129
129
logo_type = \"image/png\";
@@ -137,15 +137,15 @@ dfx deploy --argument "(
137
137
```
138
138
139
139
#### What this does
140
-
-`principal`: the initial custodian of the collection. A custodian is a user who can administrate the collection i.e. an "Admin" user.
140
+
-`principal`: the initial custodian of the collection. A custodian is a user who can administrate the collection i.e. an "Admin" user.
141
141
142
142
:::info
143
143
`"$(dfx identity get-principal)"` automatically interpolates the default identity used by dfx on your machine into the argument that gets passed to `deploy`.
144
144
:::
145
145
146
146
-`logo`: The image that represents this NFT collection.
147
147
-`name`: The name of the NFT collection.
148
-
-`symbol`: A short, unique symbol to identify the token.
148
+
-`symbol`: A short, unique symbol to identify the token.
149
149
-`maxLimit`: The maximum number of NFTs that are allowed in this collection.
150
150
151
151
You will receive output that resembles the following:
@@ -164,8 +164,8 @@ Use the following command to mint an NFT:
Transfer the NFT from the default user to `ALICE`.
211
+
Transfer the NFT from the default user to `ALICE`.
212
212
213
213
Here the arguments are:
214
214
`from`: principal that owns the NFT
@@ -255,7 +255,7 @@ Output:
255
255
256
256
### `getMetadataDip721`
257
257
258
-
Provide a token ID.
258
+
Provide a token ID.
259
259
The token ID was provided to you when you ran `mintDip721`, e.g. `(variant { Ok = record { id = 1 : nat; token_id = 0 : nat64 } })` So, the token ID is 0 in this case.
260
260
261
261
```bash
@@ -410,7 +410,7 @@ Output:
410
410
411
411
### `ownerOfDip721`
412
412
413
-
Provide a token ID.
413
+
Provide a token ID.
414
414
The token ID was provided to you when you ran `mintDip721`, e.g. `(variant { Ok = record { id = 1 : nat; token_id = 0 : nat64 } })` So, the token ID is 0 in this case.
Copy file name to clipboardExpand all lines: motoko/encrypted-notes-dapp/README.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ We wanted to build an example of a simple (but not too simple) dapp running pure
41
41
1. Client-side **end-to-end encryption**.
42
42
2.**Multi-user** and **multi-device** support.
43
43
44
-
To demonstrate the potential of the IC as a platform for developing such dapps, we implemented this example using two distinct canister development kits (CDKs). The Motoko CDK allows developers to implement actor-based dapps using the [Motoko](https://internetcomputer.org/docs/current/motoko/getting-started/motoko-introduction) language. The Rust CDK allows implementing dapps in [Rust](https://internetcomputer.org/docs/current/developer-docs/backend/rust/index). In both cases, canisters are compiled into WebAssembly files that are then deployed onto the IC.
44
+
To demonstrate the potential of the IC as a platform for developing such dapps, we implemented this example using two distinct canister development kits (CDKs). The Motoko CDK allows developers to implement actor-based dapps using the [Motoko](https://internetcomputer.org/docs/current/motoko/getting-started/motoko-introduction) language. The Rust CDK allows implementing dapps in [Rust](https://internetcomputer.org/docs/current/developer-docs/backend/rust/). In both cases, canisters are compiled into WebAssembly files that are then deployed onto the IC.
45
45
46
46
## Architecture
47
47
@@ -110,7 +110,7 @@ Follow the steps below to deploy this sample project.
110
110
111
111
## Prerequisites
112
112
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index).
113
-
-[x] Download and install [Docker](https://docs.docker.com/get-docker/) if using the Docker option.
113
+
-[x] Download and install [Docker](https://docs.docker.com/get-docker/) if using the Docker option.
114
114
-[x] Download the GitHub repo containing this project's files: `git clone https://github.com/dfinity/examples`
115
115
116
116
### Step 1. Navigate inside of the project's folder:
@@ -139,7 +139,7 @@ export BUILD_ENV=motoko
139
139
140
140
-#### Step 1: Install and start Docker by following the instructions.
141
141
-#### Step 2: For Motoko build/deployment set environmental variable:
142
-
142
+
143
143
```bash
144
144
export BUILD_ENV=motoko
145
145
```
@@ -247,7 +247,7 @@ npm run dev
247
247
248
248
249
249
:::caution
250
-
If you have opened this page previously, please remove all local store data for this page from your web browser, and hard-reload the page.
250
+
If you have opened this page previously, please remove all local store data for this page from your web browser, and hard-reload the page.
251
251
252
252
For example in Chrome, go to Inspect → Application → Local Storage → http://localhost:3000/ → Clear All, and then reload.
253
253
:::
@@ -320,9 +320,9 @@ Fig. 2. Basic single-device scenario for a user.
320
320
321
321
-#### Step 3: Once logged in for the first time, your notes list should be empty.
322
322
323
-
At this moment, your _Local Storage_ should be populated with additional variables (see Fig. 2(d)): **ic-identity**, **ic-delegation**.
323
+
At this moment, your _Local Storage_ should be populated with additional variables (see Fig. 2(d)): **ic-identity**, **ic-delegation**.
324
324
325
-
These variables are used for storing/retrieving notes from the backend canister.
325
+
These variables are used for storing/retrieving notes from the backend canister.
326
326
327
327
In addition, another two variables are generated in the _IndexedDB_: **PrivateKey**, **PublicKey**. These two variables are used for encrypting/decrypting the shared secret key.
328
328
@@ -341,7 +341,7 @@ Fig. 3. Scenario for a user with multiple registered devices.
341
341
342
342
-#### Step 1: Perform steps 1-3 of Scenario I on Device A.
343
343
344
-
-#### Step 2:. Perform steps 1-3 of Scenario I on Device B.
344
+
-#### Step 2:. Perform steps 1-3 of Scenario I on Device B.
345
345
346
346
One subtle difference that you might observe on Device B is that the message "Synchronizing..." (Fig. 3(a)) appears for a short time. As Device A was the first to log in, it was also the first one to generate a shared secret. Device B has to retrieve it. To do that, Device B first uploads its public key (pub B) to the backend canister. Device A retrieves pub B using periodic polling. Device A then re-encrypts the shared secret with pub B and uploads it to the backend. Afterward, Device B can retrieve the encrypted shared secret and decrypt it with its private key.
347
347
@@ -380,7 +380,7 @@ Fig. 4. Scenario for a user adding/removing devices.
380
380
381
381
## Unit testing
382
382
383
-
The unit tests are implemented in `src/encrypted_notes_motoko/test/test.mo` using the [Motoko Matchers](https://kritzcreek.github.io/motoko-matchers/) library.
383
+
The unit tests are implemented in `src/encrypted_notes_motoko/test/test.mo` using the [Motoko Matchers](https://kritzcreek.github.io/motoko-matchers/) library.
384
384
385
385
The easiest way to run all tests involves the following steps:
386
386
@@ -508,7 +508,7 @@ This dapp uses the web browser's `_Local Storage_` and `_IndexedDB_` for storing
508
508
509
509
:::
510
510
511
-
A symmetric key for encrypting/decrypting the notes is stored in RAM (this key is shared between multiple devices). For a better understanding of the mechanics of the dapp, please see the `_Local Storage_`/`_IndexedDB_` windows in your web browser.
511
+
A symmetric key for encrypting/decrypting the notes is stored in RAM (this key is shared between multiple devices). For a better understanding of the mechanics of the dapp, please see the `_Local Storage_`/`_IndexedDB_` windows in your web browser.
512
512
513
513
In Chrome, go to: _Developer Tools→Application→Local Storage_/_IndexedDB_.
Copy file name to clipboardExpand all lines: rust/dip721-nft-container/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ When upgrading canister code, however, it is necessary to explicitly handle cani
28
28
### 2. Certified data.
29
29
Generally, when a function only reads data, instead of modifying the state of the canister, it is
30
30
beneficial to use a [query call instead of an update call](https://internetcomputer.org/docs/current/concepts/canisters-code.md#query-and-update-methods).
31
-
But, since query calls do not go through consensus, [certified responses](https://internetcomputer.org/docs/current/developer-docs/security/general-security-best-practices)
31
+
But, since query calls do not go through consensus, [certified responses](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
32
32
should be used wherever possible. The HTTP interface of the Rust implementation shows how certified data can be handled.
Copy file name to clipboardExpand all lines: rust/encrypted-notes-dapp/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ We wanted to build an example of a simple (but not too simple) dapp running pure
42
42
1. Client-side **end-to-end encryption**.
43
43
2.**Multi-user** and **multi-device** support.
44
44
45
-
To demonstrate the potential of the IC as a platform for developing such dapps, we implemented this example using two distinct canister development kits (CDKs). The Motoko CDK allows developers to implement actor-based dapps using the [Motoko](https://internetcomputer.org/docs/current/motoko/getting-started/motoko-introduction) language. The Rust CDK allows implementing dapps in [Rust](https://internetcomputer.org/docs/current/developer-docs/backend/rust/index.md). In both cases, canisters are compiled into WebAssembly files that are then deployed onto the IC.
45
+
To demonstrate the potential of the IC as a platform for developing such dapps, we implemented this example using two distinct canister development kits (CDKs). The Motoko CDK allows developers to implement actor-based dapps using the [Motoko](https://internetcomputer.org/docs/current/motoko/getting-started/motoko-introduction) language. The Rust CDK allows implementing dapps in [Rust](https://internetcomputer.org/docs/current/developer-docs/backend/rust/). In both cases, canisters are compiled into WebAssembly files that are then deployed onto the IC.
0 commit comments