SlideShare a Scribd company logo
1 of 27
Download to read offline
Lucien Lee
Blockchain 101 for Frontend Engs
前端工程師也可以懂的區塊鏈
2021
Lucien Lee・鹿尋
2
Tech Lead
Dapps Fullstack Eng
The first Taiwanese Defi
CEO Co-founder
The largest crowdsourcing
fact-check platform in Asia
PREVIOUS
What is Blockchain?
3
a semantic overloaded word
4
We only discuss this today
So blockchain is a P2P Network that…
5
Public Permissionless
Distributed
Decentralized Immutable
Unforgeable
Data Storage Compute Engine
+
You can believe the justification of computing
on this P2P Network
6
Robust Public
Trust(less)
Machine
Ledger
7
Data Storage
How to achieve that
Unforgeable
8
Public-key cryptograph
Digital Signature
How to achieve that
Immutable
9
Block Hash Chain
https://andersbrownworth.com/blockchain/
How to achieve that
Decentralized
10
Kademlia
Msg exchange
consensus
POW, POS, PBFT…
Example of ETH Tx
POW version
11
1. A user init an TX
2. Input Tx Info in wallet,
3. Sign TX with private key
4. Broadcast “Signed Tx” to nearby ETH node
Broadcast to
( nearby ) node
4
Creat a Tx
Steve
0x123… 0x321… ether
FROM
Dave
TO
12
AMOUNT
10
gwei
GAS PRICE
units
21,000
GAS LIMIT
Welcome to Pelith! …
INPUT DATA
Tx Signature
3
Wallet
Private Key
Steve
2
1
12
State Database
SQL
BALANCE
( ether )
ADDRESS
34
16
9
Steve
Dave
W
130
X
0.7
Y
0.02
Z
9
First Miner finding out the “nonce”
Generate new block and get the ETH award
Tx Pool
Filtered by “Gas Price”
Tx
Gas Limit
Gas Price
W X 3.5
Y Z 0.7
Depoly
Contract
Call
Contract
I J 25
S D 12
21,000
21,000
21,000
500,000
120,000
21,000
11
10
10
8
8
7
Check Status
5 Join Wait List
6 Executed in EVM
8
( ≈ 2.4 TB )
Node
7
New
Block
Calculating “nonce” for block <PoW>
(Competing with other nodes)
Total Gas Limit < 8,000,000
EVM
Ether Balance Updated
Smart Contract Deployed / Called
1 Block ≤ 8M Gas
Blockchain
New
Block 8660586
Block 8660585
Block 8660584
5. Check the balance
6. Put Tx in the pool
7. Nodes keep broadcast and received new Tx
8. Nodes select more tips tx, calc and prepare
to pack them into new block
9. Mine the block
13
Node
Node
Node
Node
Node Node
Node
Node
Node
Node
Broadcast with each other
to update latest status
10
P2P Network
11 12
10. Broadcast the new block to the network
11. Nodes sync the new block, state and Tx pool
12. Loop
Smart Contract
14
Computing Engine
Code is Rule
Resistance to Censorship
Verifiable Behavior
It’s like serverless Architecture
Function-as-a-Service
15
Source: https://medium.com/@tanmayct/serverless-architecture-function-as-a-service-19e127b8c990
16
Todo App as example
const { AWS } = require('../connection');


const docClient = new AWS.DynamoDB.DocumentClient();


exports.getTodo = async function (event, context) {


let response;


let todoId;


const table = "Todos";


if (event.body) {


let body = JSON.parse(event.body);


todoId = body.id;


}


const params = {


TableName: table,


Key: {


"id": todoId,


}


};


try {


const data = await docClient.get(params).promise();


response = {


'statusCode': 200,


'body': JSON.stringify({


message: data,


})


}


} catch (err) {


response = {


'statusCode': 400,


'body': JSON.stringify({


message: err,


})


}


}


return response;


}
getTodo
17
Cost is based on actual execution time
18
Cost is based on sum of opcode, storage usage, message call…
19
Dapps Architecture
20
RPC, Remote Procedure Call
balanceOf(address)
0x70a08231b98ef4ca268c9c……db06bb5d45e689f2a360be
8
sha3
{

"jsonrpc":"2.0"
,

"method":"eth_call"
,

"params":
[

{

“to":"<contract address>"
,

"data":"0x70a08231<arg>
"

}
,

"latest
"

]
,

“id":
1

}
Post to RPC endpoint
Why we need trust(less) computing
Loot drop rate is a blackbox
21
How does JS get involved in blockchain?
22
Dapps
The UI for users interacting with blockchain
23
Why Frontend Engs are so important?
Put an elephant into refrigerator
24
Gas fee too expensive Lightweight Backend
Move user-friendly logic to FE
Isomorphic-like app


solidity <-> JS/TS
contract blockchain
TypeChain, @symfoni/hardhat-react
Script / Arbitrage
25
What’s good scenario of blockchain?
26
Assets
To incentivize validators, blockchain network native has money system
Contact
27
Email
lucien@pelith.com
We’re hiring engineers!
cakeresume.com/companies/pelith/jobs
Facebook
facebook.com/lucienlee.deer

More Related Content

What's hot

Blockchain tutorial for MBA
Blockchain tutorial for MBABlockchain tutorial for MBA
Blockchain tutorial for MBABlokcert
 
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...Edureka!
 
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...Simplilearn
 
The Blockchain, Bitcoin and other Cryptocurrencies
The Blockchain, Bitcoin and other CryptocurrenciesThe Blockchain, Bitcoin and other Cryptocurrencies
The Blockchain, Bitcoin and other CryptocurrenciesApondi Kevin Omondi
 
Testing in the blockchain
Testing in the blockchainTesting in the blockchain
Testing in the blockchainCraig Risi
 
Security in the blockchain
Security in the blockchainSecurity in the blockchain
Security in the blockchainBellaj Badr
 
The Cloud is dead ?! Blockchain in the new cloud
The Cloud is dead ?! Blockchain in the new cloudThe Cloud is dead ?! Blockchain in the new cloud
The Cloud is dead ?! Blockchain in the new cloudYuval Birenboum
 
Deja vu Security - Blockchain Security Summit - Adam Cecchetti
Deja vu Security - Blockchain Security Summit - Adam CecchettiDeja vu Security - Blockchain Security Summit - Adam Cecchetti
Deja vu Security - Blockchain Security Summit - Adam CecchettiScott Strang
 
Blockchain overview, use cases, implementations and challenges
Blockchain overview, use cases, implementations and challengesBlockchain overview, use cases, implementations and challenges
Blockchain overview, use cases, implementations and challengesSébastien Tandel
 
Transaction speed
Transaction speedTransaction speed
Transaction speedOliviaJune1
 
Blockchain 101
Blockchain 101Blockchain 101
Blockchain 101Suki Chana
 
List of best Open Source Blockchain platforms
List of best Open Source Blockchain platformsList of best Open Source Blockchain platforms
List of best Open Source Blockchain platformsBlockchain Council
 

What's hot (20)

Blockchain tutorial for MBA
Blockchain tutorial for MBABlockchain tutorial for MBA
Blockchain tutorial for MBA
 
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...
Bitcoin Blockchain Explained | Understanding Bitcoin and Blockchain | Blockch...
 
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...
Blockchain Explained | How Does A Blockchain Work | Blockchain Explained Simp...
 
Basic blockchain
Basic blockchainBasic blockchain
Basic blockchain
 
1. ibm blockchain explained
1. ibm blockchain explained1. ibm blockchain explained
1. ibm blockchain explained
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain
BlockchainBlockchain
Blockchain
 
The Blockchain, Bitcoin and other Cryptocurrencies
The Blockchain, Bitcoin and other CryptocurrenciesThe Blockchain, Bitcoin and other Cryptocurrencies
The Blockchain, Bitcoin and other Cryptocurrencies
 
Testing in the blockchain
Testing in the blockchainTesting in the blockchain
Testing in the blockchain
 
Security in the blockchain
Security in the blockchainSecurity in the blockchain
Security in the blockchain
 
BigchainDB and Beyond
BigchainDB and BeyondBigchainDB and Beyond
BigchainDB and Beyond
 
Blockchain
BlockchainBlockchain
Blockchain
 
The Cloud is dead ?! Blockchain in the new cloud
The Cloud is dead ?! Blockchain in the new cloudThe Cloud is dead ?! Blockchain in the new cloud
The Cloud is dead ?! Blockchain in the new cloud
 
Deja vu Security - Blockchain Security Summit - Adam Cecchetti
Deja vu Security - Blockchain Security Summit - Adam CecchettiDeja vu Security - Blockchain Security Summit - Adam Cecchetti
Deja vu Security - Blockchain Security Summit - Adam Cecchetti
 
Blockchain overview, use cases, implementations and challenges
Blockchain overview, use cases, implementations and challengesBlockchain overview, use cases, implementations and challenges
Blockchain overview, use cases, implementations and challenges
 
01 what is blockchain
01 what is blockchain01 what is blockchain
01 what is blockchain
 
Transaction speed
Transaction speedTransaction speed
Transaction speed
 
Blockchain 101
Blockchain 101Blockchain 101
Blockchain 101
 
List of best Open Source Blockchain platforms
List of best Open Source Blockchain platformsList of best Open Source Blockchain platforms
List of best Open Source Blockchain platforms
 
Blockchain
BlockchainBlockchain
Blockchain
 

Similar to [JSDC 2021] Blockchain 101 for Frontend Engs

Introduction to Blockchain Web3 Session
Introduction to Blockchain Web3 SessionIntroduction to Blockchain Web3 Session
Introduction to Blockchain Web3 SessionDSCIITPatna
 
Blockchain based Banking System
Blockchain based Banking SystemBlockchain based Banking System
Blockchain based Banking SystemGaurav Singh
 
tezos_hands-on-training.pdf
tezos_hands-on-training.pdftezos_hands-on-training.pdf
tezos_hands-on-training.pdfNeven6
 
Encode x Tezos Hack: Hands-on dApp Training
Encode x Tezos Hack: Hands-on dApp Training Encode x Tezos Hack: Hands-on dApp Training
Encode x Tezos Hack: Hands-on dApp Training KlaraOrban
 
Blockchain. A Guide For Beginners
Blockchain. A Guide For BeginnersBlockchain. A Guide For Beginners
Blockchain. A Guide For BeginnersElifTech
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractThanh Nguyen
 
leewayhertz.com-How to build a dApp on Avalanche blockchain
leewayhertz.com-How to build a dApp on Avalanche blockchainleewayhertz.com-How to build a dApp on Avalanche blockchain
leewayhertz.com-How to build a dApp on Avalanche blockchainMdSaifulIslam289
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by BlockchainSlash
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network libraryShuo Chen
 
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018Svetlin Nakov
 
How to Build a Decentralized Cloud Computing Platform?
How to Build a Decentralized Cloud Computing Platform?How to Build a Decentralized Cloud Computing Platform?
How to Build a Decentralized Cloud Computing Platform?Samy Fodil
 
2019 blockchain economy
2019 blockchain economy2019 blockchain economy
2019 blockchain economyHeung-No Lee
 
Block chain 101 what it is, why it matters
Block chain 101  what it is, why it mattersBlock chain 101  what it is, why it matters
Block chain 101 what it is, why it mattersPaul Brody
 
Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Lothar Wieske
 
BlockChain for the Banker
BlockChain for the BankerBlockChain for the Banker
BlockChain for the BankerBohdan Szymanik
 
Token platform based on sidechain
Token platform based on sidechainToken platform based on sidechain
Token platform based on sidechainLuniverse Dunamu
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowWilliam Lee
 
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityIntroducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityPureStake
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxWijdenBenothmen1
 

Similar to [JSDC 2021] Blockchain 101 for Frontend Engs (20)

Introduction to Blockchain Web3 Session
Introduction to Blockchain Web3 SessionIntroduction to Blockchain Web3 Session
Introduction to Blockchain Web3 Session
 
Blockchain based Banking System
Blockchain based Banking SystemBlockchain based Banking System
Blockchain based Banking System
 
tezos_hands-on-training.pdf
tezos_hands-on-training.pdftezos_hands-on-training.pdf
tezos_hands-on-training.pdf
 
Encode x Tezos Hack: Hands-on dApp Training
Encode x Tezos Hack: Hands-on dApp Training Encode x Tezos Hack: Hands-on dApp Training
Encode x Tezos Hack: Hands-on dApp Training
 
Blockchain. A Guide For Beginners
Blockchain. A Guide For BeginnersBlockchain. A Guide For Beginners
Blockchain. A Guide For Beginners
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart Contract
 
leewayhertz.com-How to build a dApp on Avalanche blockchain
leewayhertz.com-How to build a dApp on Avalanche blockchainleewayhertz.com-How to build a dApp on Avalanche blockchain
leewayhertz.com-How to build a dApp on Avalanche blockchain
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by Blockchain
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network library
 
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
 
Kubernetes: My BFF
Kubernetes: My BFFKubernetes: My BFF
Kubernetes: My BFF
 
How to Build a Decentralized Cloud Computing Platform?
How to Build a Decentralized Cloud Computing Platform?How to Build a Decentralized Cloud Computing Platform?
How to Build a Decentralized Cloud Computing Platform?
 
2019 blockchain economy
2019 blockchain economy2019 blockchain economy
2019 blockchain economy
 
Block chain 101 what it is, why it matters
Block chain 101  what it is, why it mattersBlock chain 101  what it is, why it matters
Block chain 101 what it is, why it matters
 
Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017Blockchain IoT Night / 25th Oct 2017
Blockchain IoT Night / 25th Oct 2017
 
BlockChain for the Banker
BlockChain for the BankerBlockChain for the Banker
BlockChain for the Banker
 
Token platform based on sidechain
Token platform based on sidechainToken platform based on sidechain
Token platform based on sidechain
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call Flow
 
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum CompatibilityIntroducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
Introducing Moonbeam: A Smart Contract Parachain with Ethereum Compatibility
 
EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 

More from Lucien Lee

【真的假的 Cofacts】事實查核案例分享
【真的假的 Cofacts】事實查核案例分享【真的假的 Cofacts】事實查核案例分享
【真的假的 Cofacts】事實查核案例分享Lucien Lee
 
Start Prototyping From Keynote
Start Prototyping From KeynoteStart Prototyping From Keynote
Start Prototyping From KeynoteLucien Lee
 
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇Lucien Lee
 
[HackCampus] 圖書館自習區體驗設計-探索篇
[HackCampus] 圖書館自習區體驗設計-探索篇[HackCampus] 圖書館自習區體驗設計-探索篇
[HackCampus] 圖書館自習區體驗設計-探索篇Lucien Lee
 
Hack the hacking
Hack the hackingHack the hacking
Hack the hackingLucien Lee
 
Multidisciplinary @NTUIM
Multidisciplinary @NTUIMMultidisciplinary @NTUIM
Multidisciplinary @NTUIMLucien Lee
 
智慧家庭音樂體驗設計工作坊
智慧家庭音樂體驗設計工作坊智慧家庭音樂體驗設計工作坊
智慧家庭音樂體驗設計工作坊Lucien Lee
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassLucien Lee
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略Lucien Lee
 

More from Lucien Lee (9)

【真的假的 Cofacts】事實查核案例分享
【真的假的 Cofacts】事實查核案例分享【真的假的 Cofacts】事實查核案例分享
【真的假的 Cofacts】事實查核案例分享
 
Start Prototyping From Keynote
Start Prototyping From KeynoteStart Prototyping From Keynote
Start Prototyping From Keynote
 
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇
[HackCampus] 圖書館自習區體驗設計-行政及閱覽組回饋篇
 
[HackCampus] 圖書館自習區體驗設計-探索篇
[HackCampus] 圖書館自習區體驗設計-探索篇[HackCampus] 圖書館自習區體驗設計-探索篇
[HackCampus] 圖書館自習區體驗設計-探索篇
 
Hack the hacking
Hack the hackingHack the hacking
Hack the hacking
 
Multidisciplinary @NTUIM
Multidisciplinary @NTUIMMultidisciplinary @NTUIM
Multidisciplinary @NTUIM
 
智慧家庭音樂體驗設計工作坊
智慧家庭音樂體驗設計工作坊智慧家庭音樂體驗設計工作坊
智慧家庭音樂體驗設計工作坊
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略
 

Recently uploaded

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 

Recently uploaded (20)

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 

[JSDC 2021] Blockchain 101 for Frontend Engs

  • 1. Lucien Lee Blockchain 101 for Frontend Engs 前端工程師也可以懂的區塊鏈 2021
  • 2. Lucien Lee・鹿尋 2 Tech Lead Dapps Fullstack Eng The first Taiwanese Defi CEO Co-founder The largest crowdsourcing fact-check platform in Asia PREVIOUS
  • 3. What is Blockchain? 3 a semantic overloaded word
  • 4. 4 We only discuss this today
  • 5. So blockchain is a P2P Network that… 5 Public Permissionless Distributed Decentralized Immutable Unforgeable Data Storage Compute Engine +
  • 6. You can believe the justification of computing on this P2P Network 6 Robust Public Trust(less) Machine
  • 8. How to achieve that Unforgeable 8 Public-key cryptograph Digital Signature
  • 9. How to achieve that Immutable 9 Block Hash Chain https://andersbrownworth.com/blockchain/
  • 10. How to achieve that Decentralized 10 Kademlia Msg exchange consensus POW, POS, PBFT…
  • 11. Example of ETH Tx POW version 11 1. A user init an TX 2. Input Tx Info in wallet, 3. Sign TX with private key 4. Broadcast “Signed Tx” to nearby ETH node Broadcast to ( nearby ) node 4 Creat a Tx Steve 0x123… 0x321… ether FROM Dave TO 12 AMOUNT 10 gwei GAS PRICE units 21,000 GAS LIMIT Welcome to Pelith! … INPUT DATA Tx Signature 3 Wallet Private Key Steve 2 1
  • 12. 12 State Database SQL BALANCE ( ether ) ADDRESS 34 16 9 Steve Dave W 130 X 0.7 Y 0.02 Z 9 First Miner finding out the “nonce” Generate new block and get the ETH award Tx Pool Filtered by “Gas Price” Tx Gas Limit Gas Price W X 3.5 Y Z 0.7 Depoly Contract Call Contract I J 25 S D 12 21,000 21,000 21,000 500,000 120,000 21,000 11 10 10 8 8 7 Check Status 5 Join Wait List 6 Executed in EVM 8 ( ≈ 2.4 TB ) Node 7 New Block Calculating “nonce” for block <PoW> (Competing with other nodes) Total Gas Limit < 8,000,000 EVM Ether Balance Updated Smart Contract Deployed / Called 1 Block ≤ 8M Gas Blockchain New Block 8660586 Block 8660585 Block 8660584 5. Check the balance 6. Put Tx in the pool 7. Nodes keep broadcast and received new Tx 8. Nodes select more tips tx, calc and prepare to pack them into new block 9. Mine the block
  • 13. 13 Node Node Node Node Node Node Node Node Node Node Broadcast with each other to update latest status 10 P2P Network 11 12 10. Broadcast the new block to the network 11. Nodes sync the new block, state and Tx pool 12. Loop
  • 14. Smart Contract 14 Computing Engine Code is Rule Resistance to Censorship Verifiable Behavior
  • 15. It’s like serverless Architecture Function-as-a-Service 15 Source: https://medium.com/@tanmayct/serverless-architecture-function-as-a-service-19e127b8c990
  • 16. 16 Todo App as example const { AWS } = require('../connection'); const docClient = new AWS.DynamoDB.DocumentClient(); exports.getTodo = async function (event, context) { let response; let todoId; const table = "Todos"; if (event.body) { let body = JSON.parse(event.body); todoId = body.id; } const params = { TableName: table, Key: { "id": todoId, } }; try { const data = await docClient.get(params).promise(); response = { 'statusCode': 200, 'body': JSON.stringify({ message: data, }) } } catch (err) { response = { 'statusCode': 400, 'body': JSON.stringify({ message: err, }) } } return response; } getTodo
  • 17. 17 Cost is based on actual execution time
  • 18. 18 Cost is based on sum of opcode, storage usage, message call…
  • 20. 20 RPC, Remote Procedure Call balanceOf(address) 0x70a08231b98ef4ca268c9c……db06bb5d45e689f2a360be 8 sha3 { "jsonrpc":"2.0" , "method":"eth_call" , "params": [ { “to":"<contract address>" , "data":"0x70a08231<arg> " } , "latest " ] , “id": 1 } Post to RPC endpoint
  • 21. Why we need trust(less) computing Loot drop rate is a blackbox 21
  • 22. How does JS get involved in blockchain? 22
  • 23. Dapps The UI for users interacting with blockchain 23
  • 24. Why Frontend Engs are so important? Put an elephant into refrigerator 24 Gas fee too expensive Lightweight Backend Move user-friendly logic to FE Isomorphic-like app 
 solidity <-> JS/TS contract blockchain TypeChain, @symfoni/hardhat-react
  • 26. What’s good scenario of blockchain? 26 Assets To incentivize validators, blockchain network native has money system