Smart Contract Development with
Motoko
ICP Bootcamp:
Deploy Smart Contracts & dApps on ICP
Hi, I’m Yevonnael Andrew from Indonesia
Working Experience
Universitas Pelita Harapan (Startup, Corporate, Freelance | China, Singapore, Indonesia)
S.T. | Civil Engineering
Liverpool John Moores Univ.
M.Sc. | Machine Learning & AI
Teaching Experience
Swiss German University
M.Kom. | Data Science and Cybersecurity
GCAS College Dublin Global Presentation Engagement
PhD | Mathematics and Computer Science
Pelita Bangsa Academy
PT Pelita Teknologi Bangsa
Mall of Indonesia, Lantai 2, Unit 2F-A7B,
Jalan Boulevard Barat Raya No. 1,
”
Upskill dan Reskill Talenta Teknologi
Indonesia di bidang Blockchain sehingga
Kelapa Gading Jakarta Utara 14240. kalian bisa bersaing secara global.
pelitabangsa.co.id
instagram.pelitabangsa.co.id
linkedin.pelitabangsa.co.id
whatsapp.pelitabangsa.co.id
SESI
01 Introduction to the Internet Computer Protocol (ICP)
02 Smart Contract Development with Motoko HARI INI
03 Advanced Canister and Interacting with Ethereum
SESI
04 Frontend Integration and dApp Development
05 Decentralized AI dApps
06 Project Deployment
Recommendation
Recommendation
Physical Notebook https://notion.com
Recommendation
Recommendation
Be Active
Recommendation
Recommendation
Open Your Camera
A
Goal of this Bootcamp
The goal of this bootcamp:
● Learn about ICP Technology
● Come up with Web3 Application Ideas
● Build on ICP
● Prepare for upcoming ICP Hackathons
and Accelerator Program
● Prepare to build your own startup!
Build on ICP
Steps: What to Submit:
1. Form a Team ● GitHub repository
2. Build Your Project ● Live Website
3. Submit Your Project via Google Form ● Presentation Pitch Deck (optional)
4. Share on Social Media ● Video Demonstration (optional)
B
Pelita Bangsa Academy
Resources
Pelita Bangsa Academy Resources:
● LMS (Learning Management System):
https://lms.pelitabangsa.co.id/
(Class Recording, PDF Material, YouTube Livestream Links)
● Discord Link:
https://discord.gg/Jquvw5DqEv
01
Motoko
Supported Languages
1. Motoko: Easy to learn, especially for Python or JavaScript dev, choose for ease of use and rapid
development
2. Rust: Suitable for complex and large-scale projects.
3. Community-developed Canister Development Kits (CDKs):
a. Python (Kybra CDK)
b. TypeScript (Azle CDK)
c. Solidity (Bitfinity’s EVM)
d. C++ (icpp-pro CDK)
4. Candid Interface (Interface description language)
a. Allows interoperability between services written in different languages.
b. Ensures that different canisters (regardless of the language used) can communicate seamlessly.
Hello, World!
// Motoko example
actor HelloWorld {
public func greet() : Text {
Motoko return "Hello, World!";
}
};
# Python example
def greet():
return "Hello, World!"
Python
# Call the function
print(greet())
// JavaScript example (traditional function)
function greet() {
return "Hello, World!";
JavaScript }
// Call the function
console.log(greet());
Motoko Interactive Tutorial
https://internetcomputer.org/docs/current/motoko/tutorial
02
Setting Up Dev Environment
Environment Setup (1/2)
1. Install Git
https://git-scm.com/downloads
2. Install Node.js
https://nodejs.org/en/download/package-manager
Environment Setup (2/2)
1. Buka Terminal/Command Prompt/CMD
2. Eksekusi:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
3. Exit Terminal/Command Prompt/CMD, kemudian buka lagi (jika tidak restart, tidak bisa lanjut)
4. Eksekusi:
rustup target add wasm32-unknown-unknown
5. Eksekusi:
sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
Jika muncul pertanyaan “Proceed with installation?”, pilih Default dan Enter
6. Exit Terminal/Command Prompt/CMD, kemudian buka lagi (jika tidak restart, tidak bisa lanjut)
ICP Hello World Motoko
1. Buka Terminal/Command Prompt/CMD
2. Eksekusi:
git clone https://github.com/dfinity/icp-hello-world-motoko
3. Setelah selesai cloning, pindah ke direktori repo:
cd icp-hello-world-motoko
4. Install dependencies, eksekusi:
npm install
5. Untuk deploy frontend dan backend, eksekusi:
dfx start --background
dfx deploy
03
dfx structure
What is dfx?
1. Command-line utility for Internet Computer SDK
2. Primary tool for creating, managing & deploying dapps
3. Uses syntax: dfx [subcommand] [flag]
4. Essential Subcommands:
a. build: Build canister output from source code
b. deploy: Deploy canisters from project source
c. new: Create new projects
d. start: Start local canister execution
e. stop: Stop local canister execution
f. identity: Manage identities
g. canister: Manage deployed canisters
Create a New Project
To create a new project:
dfx new [nama_project]
Project Structure
When a frontend exists, the project would typically follow this structure:
hello_world/
├── dfx.json # Project configuration
├── src/ # Source files
│ ├── backend/ # Backend code
│ └── frontend/ # Frontend assets
The project structure shows only a backend folder since we've just started the project without a frontend.
We'll see a frontend folder appear in the src directory once we add the frontend part later.
Understanding main.mo
The core Motoko file for Internet Computer canisters:
actor {
public query func greet(name : Text) : async Text {
return "Hello, " # name # "!";
};
};
● actor - Service object replacing traditional main function
● public query func - Defines a read-only public function (query), that can be called from outside the canister.
● (name : Text) - The function takes one parameter named "name" of type "Text" (Motoko's string type)
● async Text - Returns text asynchronously
● # operator - Concatenates text strings
● Example Output: greet("Bob") → "Hello, Bob!"
Q&A
Homework
Foto Bersama
Thank You
pelitabangsa.co.id
instagram.pelitabangsa.co.id
PT Pelita Teknologi Bangsa
Mall of Indonesia, Lantai 2, Unit 2F-A7B, linkedin.pelitabangsa.co.id
Jalan Boulevard Barat Raya No. 1,
Kelapa Gading Jakarta Utara 14240. whatsapp.pelitabangsa.co.id
CREDITS: This presentation template was created by Slidesgo, and
includes icons by Flaticon, and infographics & images by Freepik