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/persistent-storage/README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ This example covers:
24
24
## Installation
25
25
This example project can be cloned, installed, and deployed locally, for learning and testing purposes. The instructions are based on running the example on either macOS or Linux, but when using WSL2 on Windows, the instructions will be the same.
26
26
27
-
###Prerequisites
27
+
## Prerequisites
28
28
This example requires an installation of:
29
29
30
30
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx).
@@ -33,7 +33,8 @@ This example requires an installation of:
33
33
34
34
Begin by opening a terminal window.
35
35
36
-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the command:
36
+
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/basic_bitcoin)
8
-
9
-
## Overview
10
3
This tutorial will walk you through how to deploy a sample [canister smart contract](https://wiki.internetcomputer.org/wiki/Canister_smart_contract)**that can send and receive Bitcoin** on the Internet Computer.
11
4
12
5
## Architecture
@@ -21,22 +14,23 @@ For a deeper understanding of the ICP < > BTC integration, see the [Bitcoin inte
21
14
22
15
## Prerequisites
23
16
24
-
*[x] Install the [IC
25
-
SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx). For local testing, `dfx >= 0.22.0` is required.
17
+
-[x] Install the [IC
18
+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
19
+
-[x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
20
+
21
+
> [!WARNING]
22
+
> This example is designed to be deployed on the mainnet. It will return errors when deployed locally; these errors are expected.
26
23
27
-
:::info
28
-
This example is designed to be deployed on the mainnet. It will return errors when deployed locally; these errors are expected.
29
-
:::
24
+
Begin by opening a terminal window.
30
25
31
-
## Step 1: Building and deploying sample code
26
+
## Step 1: Setup the project environment
32
27
33
-
### Clone the smart contract
28
+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
34
29
35
-
To clone and build the smart contract in **Motoko**:
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/basic_dao)
8
-
9
3
This sample project demonstrates a basic [decentralized autonomous organization](https://en.wikipedia.org/wiki/Decentralized_autonomous_organization) (DAO) that can be deployed to the [Internet Computer](https://github.com/dfinity/ic). The basic DAO sample code is available in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/basic_dao) and [Rust](https://github.com/dfinity/examples/tree/master/rust/basic_dao). You can see a quick introduction on [YouTube](https://youtu.be/3IcYlieA-EE).
10
4
11
-
## Overview
12
-
13
5
A `basic_dao` can be initialized with a set of accounts: mappings from principal IDs to a number of tokens. Account owners can query their account balance by calling `account_balance` and transfer tokens to other accounts by calling `transfer`. Anyone can call `list_accounts` to view all accounts.
14
6
15
7
Account owners can submit proposals by calling `submit_proposal`. A proposal specifies a canister, method, and arguments for this method. Account owners can cast votes (either `Yes` or `No`) on a proposal by calling `vote`. The amount of votes cast is equal to the amount of tokens the account owner has. If enough `Yes` votes are cast, `basic_dao` will execute the proposal by calling the proposal’s given method with the given args against the given canister. If enough `No` votes are cast, the proposal is not executed, and is instead marked as `Rejected`.
@@ -19,30 +11,35 @@ This workflow is demonstrated below.
19
11
20
12
View the [canister service definition](https://github.com/dfinity/examples/blob/master/rust/basic_dao/src/basic_dao/src/basic_dao.did) for more details.
21
13
22
-
### Prerequisites
23
-
This example requires an installation of:
14
+
## Prerequisites
24
15
25
-
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/).
16
+
-[x] Install the [IC
17
+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
26
18
-[x] To run the test scripts, you need to download [ic-repl](https://github.com/chenyan2002/ic-repl/releases).
27
19
-[x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
28
20
29
21
Begin by opening a terminal window.
30
22
31
-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the command:
23
+
## Step 1: Setup the project environment
24
+
25
+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
26
+
32
27
33
28
```bash
34
29
cd examples/motoko/basic_dao
35
30
dfx start --background
36
31
```
37
32
38
-
### Step 2: Create test identities with the commands:
33
+
## Step 2: Create identities
34
+
35
+
Create test identities with the commands:
39
36
40
37
```bash
41
38
dfx identity new Alice --disable-encryption; dfx identity use Alice;export ALICE=$(dfx identity get-principal);
42
39
dfx identity new Bob --disable-encryption; dfx identity use Bob;export BOB=$(dfx identity get-principal);
43
40
```
44
41
45
-
###Step 3: Deploy `basic_dao` with initial test accounts.
42
+
##Step 3: Deploy `basic_dao` with initial test accounts
In order not to call `dfx canister logs CanisterLogs` after every canister call in a separate terminal window/pane C start a script that will constantly poll logs:
76
74
@@ -86,7 +84,7 @@ $ ./poll_logs.sh
86
84
...
87
85
```
88
86
89
-
###Step 6: Call `print`, `trap` and other canister methods:
87
+
## Step 6: Call `print`, `trap` and other canister methods
Copy file name to clipboardExpand all lines: motoko/classes/README.md
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,5 @@
1
-
---
2
-
keywords: [beginner, motoko, classes, actor classes]
3
-
---
4
-
5
1
# Classes
6
2
7
-
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/motoko/classes)
8
-
9
-
## Overview
10
-
11
3
This example demonstrates a simple use of actor classes, allowing a program to dynamically install new actors (that is, canisters). It also demonstrates a multi-canister project, and actors using inter-actor communication through shared functions.
12
4
13
5
The example defines two Motoko actors, `Map` and `Test`.
@@ -26,29 +18,32 @@ The `Test.mo` actor imports the (installed) `Map` canister, using `Maps` Candid
26
18
27
19
This is a Motoko example that does not currently have a Rust variant.
28
20
29
-
30
21
## Prerequisites
31
-
This example requires an installation of:
32
22
33
-
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/).
23
+
-[x] Install the [IC
24
+
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
34
25
-[x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
35
26
36
27
Begin by opening a terminal window.
37
28
38
-
### Step 1: Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the command:
29
+
## Step 1: Setup the project environment
30
+
31
+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
32
+
39
33
40
34
```bash
41
35
cd examples/motoko/classes
42
36
dfx start --background
43
37
```
44
38
45
-
###Step 2: Deploy the canisters `Map` and `Test`:
39
+
## Step 2: Deploy the canisters `Map` and `Test`
46
40
47
41
```bash
48
-
dfx deploy
42
+
dfx deploy Map
43
+
dfx deploy Test
49
44
```
50
45
51
-
###Step 3: Invoke the run method of canister Test:
46
+
## Step 3: Invoke the run method of canister `Test`
0 commit comments