SlideShare a Scribd company logo
Let’s write a DApp
Chung Wu
LikeCoin Foundation
HKOSCon 2018
What is DApp
ServerBrowser
Browser Blockchain
DApp example: class voting system
- Teacher is the host and can create new proposals with some
description
- Students are participants, the list is pre-defined, and can vote for
‘agree’ or ‘disagree’ for each proposal
- Each of the participants can vote for each proposal only once
Traditional approach
- Server defines API for creating, querying and voting proposals
- Hardcoded teacher account to verify for creating proposals
- Hardcoded student accounts to verify for voting proposals
- Server ensures that no one can vote the same proposal twice
- A web frontend
Traditional approach
- Server defines API for creating, querying and voting proposals
- Hardcoded teacher account to verify for creating proposals
- Hardcoded student accounts to verify for voting proposals
- Server ensures that no one can vote the same proposal twice
- A web frontend
Smart contract
Smart contract
address
address
DApp
Still need this
Some concepts
- Private Key: a secret stored by the user for signing transactions and
proving user’s identity
- Ethereum Address: user’s identifier derived from private key
- Smart Contract: code that executes on blockchain, plus storage
Or in other words:
- Private Key: password for blockchain
- Ethereum Address: username for blockchain
- Smart Contract: program for blockchain
How does an Ethereum DApp work
Browser
Your app’s
execution
environment
Your code
MetaMask
extension
Private Key(s)
①
②
③
④
smart
contract
Ethereum
Blockchain
Demo
Code & References
Demo code repo: https://github.com/likecoin/hkos2018-dapp-web
Web3 doc: https://web3js.readthedocs.io/en/1.0/index.html
Solidity language doc: https://solidity.readthedocs.io/

More Related Content

Similar to HKOS 2018

Integrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
Integrations - Thinking outside the box - Presentation Engage 2023 in AmsterdamIntegrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
Integrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
Roland Driesen
 
Api craft notes
Api craft notesApi craft notes
Api craft notes
Anallely Olivares
 
Adaptive Payments SDK - Magento Developers Paradise
Adaptive Payments SDK - Magento Developers ParadiseAdaptive Payments SDK - Magento Developers Paradise
Adaptive Payments SDK - Magento Developers Paradise
PayPal
 
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
Johann Schleier-Smith
 
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics PlatformWSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
WSO2
 
APITalkMeetupSharable
APITalkMeetupSharableAPITalkMeetupSharable
APITalkMeetupSharable
Obaidur (OB) Rashid
 
CIS13: Federation Protocol Cross-Section
CIS13: Federation Protocol Cross-SectionCIS13: Federation Protocol Cross-Section
CIS13: Federation Protocol Cross-Section
CloudIDSummit
 
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
MysoreMuleSoftMeetup
 
SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6
Ben Abdallah Helmi
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
Amazon Web Services
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 
SOA Testing
SOA TestingSOA Testing
SOA Testing
Roopesh Kohad
 
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayAWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
Vadim Zendejas
 
REST APIs
REST APIsREST APIs
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
Amazon Web Services Korea
 
Jayant_Kamthane_Resume
Jayant_Kamthane_ResumeJayant_Kamthane_Resume
Jayant_Kamthane_Resume
Jayant Kamthane
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Jay Simcox
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
Tom Hofte
 
WSO2 Workshop Sydney 2016 - Analytics
WSO2 Workshop Sydney 2016 -  AnalyticsWSO2 Workshop Sydney 2016 -  Analytics
WSO2 Workshop Sydney 2016 - Analytics
Dassana Wijesekara
 
Fahath Aseef Profile
Fahath Aseef ProfileFahath Aseef Profile
Fahath Aseef Profile
Fahath Aseef
 

Similar to HKOS 2018 (20)

Integrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
Integrations - Thinking outside the box - Presentation Engage 2023 in AmsterdamIntegrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
Integrations - Thinking outside the box - Presentation Engage 2023 in Amsterdam
 
Api craft notes
Api craft notesApi craft notes
Api craft notes
 
Adaptive Payments SDK - Magento Developers Paradise
Adaptive Payments SDK - Magento Developers ParadiseAdaptive Payments SDK - Magento Developers Paradise
Adaptive Payments SDK - Magento Developers Paradise
 
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
ReStream: Accelerating Backtesting and Stream Replay with Serial-Equivalent P...
 
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics PlatformWSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
WSO2Con EU 2015: An Introduction to the WSO2 Data Analytics Platform
 
APITalkMeetupSharable
APITalkMeetupSharableAPITalkMeetupSharable
APITalkMeetupSharable
 
CIS13: Federation Protocol Cross-Section
CIS13: Federation Protocol Cross-SectionCIS13: Federation Protocol Cross-Section
CIS13: Federation Protocol Cross-Section
 
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
Anypoint DataGraph - Consume & Re-use your APIs faster | MuleSoft Mysore Meet...
 
SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6SCWCD : Session management : CHAP : 6
SCWCD : Session management : CHAP : 6
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
 
SOA Testing
SOA TestingSOA Testing
SOA Testing
 
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayAWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
 
REST APIs
REST APIsREST APIs
REST APIs
 
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
AWS 마켓플레이스 기반 API 비즈니스 성장 경험 공유 (김건오 대표, 트윈워드) :: AWS TechShift 2018
 
Jayant_Kamthane_Resume
Jayant_Kamthane_ResumeJayant_Kamthane_Resume
Jayant_Kamthane_Resume
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
 
WSO2 Workshop Sydney 2016 - Analytics
WSO2 Workshop Sydney 2016 -  AnalyticsWSO2 Workshop Sydney 2016 -  Analytics
WSO2 Workshop Sydney 2016 - Analytics
 
Fahath Aseef Profile
Fahath Aseef ProfileFahath Aseef Profile
Fahath Aseef Profile
 

Recently uploaded

Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 

Recently uploaded (12)

Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 

HKOS 2018

  • 1. Let’s write a DApp Chung Wu LikeCoin Foundation HKOSCon 2018
  • 3. DApp example: class voting system - Teacher is the host and can create new proposals with some description - Students are participants, the list is pre-defined, and can vote for ‘agree’ or ‘disagree’ for each proposal - Each of the participants can vote for each proposal only once
  • 4. Traditional approach - Server defines API for creating, querying and voting proposals - Hardcoded teacher account to verify for creating proposals - Hardcoded student accounts to verify for voting proposals - Server ensures that no one can vote the same proposal twice - A web frontend
  • 5. Traditional approach - Server defines API for creating, querying and voting proposals - Hardcoded teacher account to verify for creating proposals - Hardcoded student accounts to verify for voting proposals - Server ensures that no one can vote the same proposal twice - A web frontend Smart contract Smart contract address address DApp Still need this
  • 6. Some concepts - Private Key: a secret stored by the user for signing transactions and proving user’s identity - Ethereum Address: user’s identifier derived from private key - Smart Contract: code that executes on blockchain, plus storage Or in other words: - Private Key: password for blockchain - Ethereum Address: username for blockchain - Smart Contract: program for blockchain
  • 7. How does an Ethereum DApp work Browser Your app’s execution environment Your code MetaMask extension Private Key(s) ① ② ③ ④ smart contract Ethereum Blockchain
  • 9. Code & References Demo code repo: https://github.com/likecoin/hkos2018-dapp-web Web3 doc: https://web3js.readthedocs.io/en/1.0/index.html Solidity language doc: https://solidity.readthedocs.io/