Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos on motoko theory #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dao_adventure/graduation.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Until now, we've only worked with applications that use a single canister. Today
- Name: `motoko_bootcamp`
- Associated Principal: `nkqop-siaaa-aaaaj-qa3qq-cai`

> You can decide to hardcode the initial setup or create an external one that will be executed canister upon deployment.
> You can decide to hardcode the initial setup or create an external one that will be executed upon canister deployment.

7. **Token Faucet**
You are required to use the **Motoko Bootcamp Token**, a free, educational token faucet. It allows unlimited minting but holds no real economic value; it's solely for educational use.
Expand Down
14 changes: 7 additions & 7 deletions src/motoko_theory/appendix-1/APPENDIX-1.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

<p align="center"> <img src="./assets/dao_icon.png" width="300px" style="border: 2px solid black;"> </p>

Throughout history, humans have find different creative ways to organize in social groups and structures. They have done so different reasons such as safety, support, social identity, work, power or even economic. A few common groups include: family unit, tribes, clans, states, guilds, secrect societies, political parties...
Throughout history, humans have found different creative ways to organize in social groups and structures. They have done so for different reasons such as safety, support, social identity, work, power or even economics. A few common groups include: family unit, tribes, clans, states, guilds, secret societies, political parties...

With the advent of the Internet, social networks, cryptocurriencies & smart contracts many believe that a new type of organization is about to start a new chapter of human history: **DAO**.

A Decentralized Autonomous Organization (DAO) is a digital organization that is composed of members living all around the world, and is governend and organized through smart contracts.

Because smart contracts execute automatically, are decentralized, transparent, can't be censored or modified by any individual the same applies to **DAOs** in the sense that they are not controlled by any single individual or entity, they rather operate based on the collective decision-making of their members.
Smart contracts execute automatically, are decentralized, transparent and can't be censored or modified by any individual. The same applies to **DAOs** in the sense that they are not controlled by any single individual or entity, they rather operate based on the collective decision-making of their members.

A few usecases for DAOs include:
A few use cases for DAOs include:

- **Decentralized venture capital**: DAOs can be used to enable decentralized venture capital funds, in which members can propose and vote on investments in projects. [The DAO](https://en.wikipedia.org/wiki/The_DAO_(organization)) was one of the first DAOs to be created and was designed to be a decentralized venture capital fund, although it was controversial and ultimately failed due to a hack.

Expand All @@ -22,17 +22,17 @@ A few usecases for DAOs include:
## 🙁 Limitations of DAOs
As we've said DAOs are formed through smart contracts. However, smart-contracts are pretty limited:
- They can't store any meaningful amount of data (photos, videos, files...). [The cost of storing 1GB of data in the Ethereum blockchain has been estimated at around $5.5M](https://steemit.com/ethereum/@suryanshkumr/you-need-usd5-5m-to-save-1gb-data-in-ethereum-blockchain-d)
- It is not possible to interact with a smart contracts directly from a browser. A wallet needs to be installed and acts as relay.
- It is not possible to interact with smart contracts directly from a browser. A wallet needs to be installed and acts as a relay.
- Smart contracts rely on oracles to gather information from the external world and facilitate communication with it, as they are unable to interact with anything outside of the blockchain on their own.
- Smart contracts are limited in term of computational power they have access to.
- Smart contracts are limited in terms of computational power they have access to.

Those technical limitations results in concrete actions that a DAO would be unable to do:
- 🌳 **Interact with the physical world**: DAOs are limited to the digital world and cannot interact with the physical world. A DAO could not plant a tree, turn on a light switch, or deliver a physical letter.
- 📲 **Access external data sources**: For example, a DAO could not retrieve the current temperature from a weather website, or the current stock price from a financial website.
- 🔮 **Use advanced computational power**: For example, a DAO could not run simulations to predict the outcome of a complex system, such as the spread of a pandemic or the performance of a financial portfolio.
- 🗂️ **Handle large amounts of data**: For example, a DAO could not store and process the complete medical records of millions of patients.

Those important limitations are preventing DAOs to have a meaningful impact in the world.
Those important limitations are preventing DAOs from having a meaningful impact in the world.

## 🚀 From smart-contracts to canisters
Imagine that smart-contracts could:
Expand All @@ -57,4 +57,4 @@ This concept is called Open Internet Services. The aim is to end the current mon

<p align="center"> <img src="assets/web2_web3.jpeg" width="400px" style="border: 2px solid black;"> </p>

> **A prediction?** <br/> Open Internet Services are powerful and won't stop with social networks or messaging apps. They are here to revolutionize the way we work and live together. With unprecedented scalability of collaborative work enabled by the combined power of DAOs and OISs, the sky's the limit! Imagine the positive impact on humanity with projects like environmental conservation, medical research, and education all being amplified by this new level of coordination and collaboration. And this is just the tip of the iceberg, as this new technology could open the door to even more innovative solutions to some of the world's most pressing problems. This is an opportunity to make real progress and change the world in ways we never thought possible before. **Get ready, the future is here!**
> **A prediction?** <br/> Open Internet Services are powerful and won't stop with social networks or messaging apps. They are here to revolutionize the way we work and live together. With unprecedented scalability of collaborative work enabled by the combined power of DAOs and OISs, the sky's the limit! Imagine the positive impact on humanity with projects like environmental conservation, medical research, and education all being amplified by this new level of coordination and collaboration. And this is just the tip of the iceberg, as this new technology could open the door to even more innovative solutions to some of the world's most pressing problems. This is an opportunity to make real progress and change the world in ways we never thought possible. **Get ready, the future is here!**
2 changes: 1 addition & 1 deletion src/motoko_theory/appendix-2/APPENDIX-2.MD
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The proposals that can be voted on by the **NNS** (**Network Nervous System**) a
- 🌏 Subnet management: proposals related to administering network subnets, such as creating new subnets, adding and removing subnet nodes, or splitting subnets.
- 🧑‍⚖️ Governance: proposals related to administering governance, such as motions and configuring certain parameters.

To learn more about the incredible power of the NNS, check out the [Internet Computer Wiki](https://wiki.internetcomputer.org/wiki/Network_Nervous_System).
To learn more about the incredible power of the NNS, check out the [NNS Documentation](https://internetcomputer.org/docs/current/developer-docs/daos/nns/overview).

The NNS is constitued of **different canisters**. Each canister is deployed on the same subnet which is also called the [NNS subnet](https://dashboard.internetcomputer.org/subnet/tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe).

Expand Down
14 changes: 7 additions & 7 deletions src/motoko_theory/lesson-1/LESSON-1.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It's... 🥁... **CANISTER**!

The Internet Computer is a platform that hosts a large number of applications, all of those applications run smoothly within special containers called **canisters**.

- The Internet Computer is responsible for smoothly and safely run all the canisters deployed on the platform in parallel.
- The Internet Computer is responsible for smoothly and safely running all the canisters deployed on the platform in parallel.
- Developers build applications by writing the source code for those canisters. An application can be built into one or several canisters depending on the architecture.
- Users will interact with applications by sending messages to canisters. This happens whenever you use an application on the Internet Computer and interact with it - a few examples of such interactions are:
- When you post on a social network.
Expand All @@ -25,12 +25,12 @@ Before we move on to Motoko - we actually need to explain another term: **WebAss

If we zoom inside, a canister is composed of:
- A **WebAssembly module** which is a piece of compiled code from languages such as Rust or Motoko. This is the code that is installed in the canister and is ultimately running.
- A **WebAssembly memory** - also called memory pages. This is where the state of the canister is stored and files are stored (photos, videos, tokens...). Code runs by the WebAssembly module will modify the memory.
- A **WebAssembly memory** - also called memory pages. This is where the state of the canister is stored and files are stored (photos, videos, tokens...). Code ran by the WebAssembly module will modify the memory.

<p align="center"> <img src="./assets/webassembly.png" width="600px" style="border: 2px solid black;"> </p>

<p align="center"> What is <b> WebAssembly </b>? <p>
WebAssembly is a low-level binary format for executing code in multiples environments (browsers, cloud platform, smart devices, virtual machine..). The main benefits of using WebAssembly are,
WebAssembly is a low-level binary format for executing code in multiple environments (browsers, cloud platform, smart devices, virtual machine..). The main benefits of using WebAssembly are,

- **WebAssembly** supports code written in multiple languages (C, C++, Rust, Motoko) making it a versatile solution for developers.
- **WebAssembly** code is portable and can run on almost any device. You write it once and you can run it everywhere!
Expand All @@ -48,7 +48,7 @@ The only problem with **WebAssembly** is that it's a low-level language and it p
That's why the [DFINITY Foundation](https://dfinity.org/) has introduced a new language called **Motoko**, which is a programming language specifically designed for creating decentralized applications (dApps) on the Internet Computer. Since Motoko code can directly be compiled into **WebAssembly**, it is an incredible language to build on the Internet Computer. Motoko is a high-level language, that is easy to use. You write in Motoko and then it compiles for you in WebAssembly.

<p align="center"> <img src="./assets/motoko_to_wasm.png" width="600px" style="border: 1px solid black;"/> </p>
<p align="center"> In Motoko the code is spun, Into WebAssembly it does run.</p>
<p align="center"> In Motoko the code is spun into WebAssembly.</p>

> It's worth noting that WebAssembly, was co-designed by [Andreas Rossberg](https://github.com/rossberg), who joined the DFINITY Foundation early in 2017 to work on its canister smart contract execution environment and is also the original designer of the Motoko language. The standard is maintained by the [World Wide Web Consortium](https://www.w3.org/).

Expand Down Expand Up @@ -108,7 +108,7 @@ actor {

};
````
An **actor** is how a canister is represented and abstracted in **Motoko**. This terms comes from the [Actor model](https://en.wikipedia.org/wiki/Actor_model) which is a way to write computer programs that can handle many tasks at the same time. It does this by treating **actors** as the basic building blocks of a program. <br/>
An **actor** is how a canister is represented and abstracted in **Motoko**. This term comes from the [Actor model](https://en.wikipedia.org/wiki/Actor_model) which is a way to write computer programs that can handle many tasks at the same time. It does this by treating **actors** as the basic building blocks of a program. <br/>
An actor is a small computer program that can receive messages, do some work and then send messages to other actors. Actors can also create new actors and control them. All the actors talk to each other by sending messages. Since all interaction between actors is done via message passing, this allows for very high levels of concurrency and parallelism, making it well-suited for distributed systems. In that regards, **the Internet Computer is a distributed computer where each program is a canister !**

Since canisters have been implemented to follow the actor model - you won't be surprised to learn that canisters:
Expand All @@ -120,7 +120,7 @@ Since canisters have been implemented to follow the actor model - you won't be s


<p align="center"> <img src="./assets/actor_model.gif" width="800px" style="border: 2px solid black;"></p>
<p align="center">A canister receives a message, execute it, and possibilty send other messages to other canisters (or even create new ones) in response. </p>
<p align="center">A canister receives a message, executes it, and possibilty send other messages to other canisters (or even create new ones) in response. </p>

Let's now consider the following actor:
```motoko
Expand Down Expand Up @@ -149,7 +149,7 @@ Have you noticed the `query` keyword in the previous example?

### Update calls
Update calls are used when the user wants to modify the state of a canister. To ensure the integrity of the Internet Computer, these calls must be processed through consensus and by all nodes, which results in a delay of around 1-2 seconds. An update call would be used in the following situations:
- Posting on a social media, such as [DSCVR](https://dscvr.one/).
- Posting on social media, such as [DSCVR](https://dscvr.one/).
- Sending a message on a messaging application, such as [OpenChat](https://oc.app/).
- Liking or sharing a content on [Distrikt](https://az5sd-cqaaa-aaaae-aaarq-cai.ic0.app/).
- Buying a NFT on [Entrepot](https://entrepot.app/).
Expand Down
2 changes: 1 addition & 1 deletion src/motoko_theory/lesson-10/LESSON-10.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Whether you are interacting with the Internet Computer using [Internet Identity]

<p align="center"> <img src="./assets/identity_recap.png" width="600px" style="border: 2px solid black;"> </p>

- A **private key**, which grants you access to all the ICPs you own, allows you to manage canisters, and enables you to access your identity across various applications.
- A **private key**, which grants you access to all the ICP tokens you own, allows you to manage canisters, and enables you to access your identity across various applications.
- A **public key**, from which your **principal** is derived.

## Managing identities with dfx
Expand Down
10 changes: 5 additions & 5 deletions src/motoko_theory/lesson-11/LESSON-11.MD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public type Invoice = {

## Calling an actor by reference.

The most straighforward way to call another canister it's **by reference**. This technique will always work, whether you are working locally or on mainnet but it requires two informations about the canister you want to call:
The most straighforward way to call another canister is **by reference**. This technique will always work, whether you are working locally or on mainnet but it requires two things about the canister you want to call:

1. The canister id.
2. The interface of the canister (at least partially).
Expand Down Expand Up @@ -75,7 +75,7 @@ let invoiceCanister = actor("rrkah-fqaaa-aaaaa-aaaaq-ca") : actor {
## Importing locally

> For this section, check the source code in [ADD LINK].
> When you a working locally, assuming that you canister is defined in `dfx.json` as follows.
> When you are working locally, assuming that your canister is defined in `dfx.json` as follows.

```json
{
Expand Down Expand Up @@ -128,7 +128,7 @@ Before calling another canisters, you might want to check its interface. To find
3. Scroll down through the list of methods until you reach the **Canister Interface** section.
<p align="center"> <img src="./assets/canister-interface.png" width="500px" style="border: 1px solid black;"/> </p>

4. Here, you can view a list of all public types used and the interface of the service, that list all public methods.
4. Here, you can view a list of all public types used and the interface of the service, that lists all public methods.
<p align="center"> <img src="./assets/service-interface.png" width="500px" style="border: 1px solid black;"/> </p>

5. You can use the different tabs to see the interface in different languages (**Candid**, **Motoko**, **Rust**, **JavaScript**, **Typescript**).
Expand All @@ -141,7 +141,7 @@ A canister processes its messages sequentially (one at-a-time), with each messag

Suppose you are **canister A** and you are calling **canister B**. The following sequence of events occurs:

- **Canister A** receives a message, which triggers a function. This function then initiates an inter-canister call which result in canister A sending a message to **canister B**.
- **Canister A** receives a message, which triggers a function. This function then initiates an inter-canister call which results in canister A sending a message to **canister B**.
- Canister B already has a queue of 2 messages, so the new message is added to the end of the queue.
- Canister A continues to receive and process additional messages, while canister B processes it's messages one-at-a time.
- Canister B eventually sends a response to canister A. The message is added to the queue of canister A.
Expand All @@ -154,7 +154,7 @@ As you can see, between the instant you call a canister and the moment you recei

### Intra-Subnet

When canister A and canister B belong to the same subnet, consensus is not required for inter-canister calls. This is because the inter-canister call results from a message being processed has already been agreed upon during the previous consensus round. There is an upper limit to the amount of computation that can be handled within a single consensus round; however, assuming this limit is not surpassed, **canister A will** receive its response in the same round.
When canister A and canister B belong to the same subnet, consensus is not required for inter-canister calls. This is because the inter-canister call results from a message being processed that had already been agreed upon during the previous consensus round. There is an upper limit to the amount of computation that can be handled within a single consensus round; however, assuming this limit is not surpassed, **canister A will** receive its response in the same round.

### Inter-Subnet

Expand Down
Loading