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
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/rust/basic_bitcoin)
8
-
9
-
## Overview
10
3
This tutorial will walk you through how to deploy a sample [canister smart contract](https://internetcomputer.org/docs/current/developer-docs/multi-chain/bitcoin/overview)**that can send and receive Bitcoin** on the Internet Computer.
11
4
12
5
## Architecture
@@ -24,15 +17,13 @@ For a deeper understanding of the ICP < > BTC integration, see the [Bitcoin inte
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/rust/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`.
@@ -23,32 +15,34 @@ This example requires an installation of:
Copy file name to clipboardExpand all lines: rust/canister-info/README.md
-6Lines changed: 0 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,5 @@
1
-
---
2
-
keywords: [beginner, rust, canister info]
3
-
---
4
-
5
1
# Canister info
6
2
7
-
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/rust/canister-info)
8
-
9
3
The purpose of this dapp is to give developers a small (backend) dapp that uses the IC's `canister_info` management call to retrieve information about canisters including canister history.
10
4
11
5
You can find a detailed description of its methods in the form of doc comments in the source code.
[View this sample's code on GitHub](https://github.com/dfinity/examples/tree/master/rust/canister-snapshots)
8
-
9
-
## Overview
1
+
# Canister snapshots
10
2
11
3
This example demonstrates the process of taking and loading canister snapshots.
12
4
It features a canister named `chat`, which functions as a miniature database.
@@ -18,40 +10,38 @@ and subsequently restore the data after the simulated data loss.
18
10
19
11
This example requires an installation of:
20
12
21
-
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx). Note: the Canister Snapshots feature requires `dfx` version `0.23.0-beta.3` or later.
13
+
-[x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). Note: the Canister Snapshots feature requires `dfx` version `0.23.0-beta.3` or later.
22
14
-[x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
23
15
24
-
-### Step 1: Begin by opening a terminal window and navigating into the project's directory
16
+
Begin by opening a terminal window.
25
17
26
-
```sh
27
-
cd examples/rust/canister-snapshots
28
-
```
18
+
## Step 1: Setup the project environment
29
19
30
-
-### Step 2: Start a clean local Internet Computer replica and a web server
20
+
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
31
21
32
-
```sh
33
-
dfx stop
34
-
dfx start --clean
22
+
23
+
```bash
24
+
cd examples/rust/canister-snapshots
25
+
dfx start
35
26
```
36
27
37
28
This terminal will stay blocked, printing log messages, until the `Ctrl+C` is pressed or `dfx stop` command is run.
38
29
39
30
Example output:
40
31
41
32
```sh
42
-
% dfx stop && dfx start --clean
43
33
Running dfx start for version 0.23.0-beta.3
44
34
[...]
45
35
Replica API running on 127.0.0.1:4943
46
36
```
47
37
48
-
-###Step 3: Open another terminal window in the same directory
38
+
##Step 2: Open another terminal window in the same directory
49
39
50
40
```sh
51
41
cd examples/rust/canister-snapshots
52
42
```
53
43
54
-
-###Step 4: Compile and deploy `chat` canister
44
+
##Step 3: Compile and deploy `chat` canister
55
45
56
46
```sh
57
47
dfx deploy
@@ -69,7 +59,7 @@ URLs:
69
59
chat: http://127.0.0.1:4943/?canisterId=...
70
60
```
71
61
72
-
-###Step 5: Populate the database with data
62
+
##Step 4: Populate the database with data
73
63
74
64
```sh
75
65
dfx canister call chat append 'Hi there!'
@@ -85,7 +75,7 @@ Example output:
85
75
(vec { "Hi there!" })
86
76
```
87
77
88
-
- ### Step 6: Take canister snapshot
78
+
## Step 5: Take canister snapshot
89
79
90
80
Canister `chat` is currently running, and snapshots should not be taken of active canisters.
91
81
Therefore, the canister should be stopped before taking a snapshot and then restarted.
@@ -107,7 +97,7 @@ Created a new snapshot of canister chat. Snapshot ID: 00000000000000008000000000
107
97
Starting code for canister chat, with canister_id bkyz2-fmaaa-aaaaa-qaaaq-cai
108
98
```
109
99
110
-
- ### Step 7: Simulate data loss
100
+
## Step 6: Simulate data loss
111
101
112
102
The `remove_spam` canister method intentionally includes a bug to simulate data loss.
113
103
@@ -127,7 +117,7 @@ Example output:
127
117
128
118
There is no more data in the database.
129
119
130
-
- ### Step 8: Restore the canister state from the snapshot
120
+
## Step 7: Restore the canister state from the snapshot
131
121
132
122
Canister `chat` is currently running, and snapshots should not be applied to active canisters.
133
123
Therefore, the canister must be stopped before applying the snapshot and then restarted.
0 commit comments