SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
How to develop Decentralized App
on Ethereum
Feb-2018
Phi Huynh & Thien Nguyen
Follow us on
https://facebook.com/devcafevn
https://slideshare.com/devcafevn https://github.com/devcafevn
Agenda
• Blockchain introduction
• Ethereum
• Đapp – General architecture
• Đapp – Environment development
• Đapp – Demo building Auction application
Digital Signature
Hash
• Arbitrary input
• Same length output
• Unlikely that two inputs
share the same output
Blocks
Blockchain
• Distributed (Everybody keep their own copy of the ledger)
• Transaction immutability achieved by way of blocks & chaining
• Leverages consensus mechanism for validating the
transactions
• Uses cryptography for trust, accountability, security
• There is no single point of failure
Ethereum
• A blockchain app platform that runs smart
contracts
Go Ethereum Client
Geth
ÐΞVp2p [TCP, 30303]
> JS API Console
IPC-RPC
WS-RPC [8546]
JSON-RPC [HTTP, 8545]
Disabled by default
Disabled by default
Ethereum Network
• Network Id = 1
• Morden: Network Id = 2 (retired)
• Ropsten: Network Id = 3
• Rinkerby: Network Id = 4
• Kovan: Network Id = 42
• Network Id = Asigned
Live Network
Testnet
Private Network
Demo
Setup private Ethereum network
Setup private Ethereum network
• Install geth https://geth.ethereum.org/downloads/
• Create genesis.json
• Initialize geth node “$ geth init path/to/genesis.json”
• Start geth
• Attach to geth
• JS console
• Create account
• Start mining
https://github.com/devcafevn/ethereum-auction-app/tree/master/private-network
Using Ethereum Wallet and MetaMask
Ethereum Wallet MetaMask
You can install the MetaMask add-on in Chrome,
Firefox, Opera
https://github.com/ethereum/mist/releases
Ethereum account types
• Has an address
• Controlled by a private key
• Has an address
• No private key
• Holds and run code
External Owned
Account
Contract Account
Denominations
Unit Wei Value Wei
wei 1 wei 1
Kwei (babbage) 1e3 wei 1,000
Mwei (lovelace) 1e6 wei 1,000,000
Gwei (shannon) 1e9 wei 1,000,000,000
microether (szabo) 1e12 wei 1,000,000,000,000
milliether (finney) 1e15 wei 1,000,000,000,000,000
ether 1e18 wei 1,000,000,000,000,000,000
GAS
• Gas is the unit in which EVM resource usage is measured
• Gas limit (start gas): max amount of gas you willing to spend
• Gas price: price of gas on ether you willing to pay. Miners
decides the minimal acceptable price
Transaction Fee = Gas used * Gas price
Gas used < Gas limit
=> Refund
Gas used > Gas limit
=> Out of gas exception, no change made
Dapp development
Remix
• https://remix.ethereum.org
• Writing your first smart contract
pragma solidity ^0.4.0;
contract MyAccount {
uint private myBalance;
function MyAccount(uint _myBalance) public{
myBalance = _myBalance;
}
function getBalance() public constant returns(uint){
return myBalance;
}
function add(uint _amount) public returns(uint){
myBalance += _amount;
return myBalance;
}
}
Dapp - general architecture
Network
Dapp - General architecture 2
Network
DB
Server
Demo
Online Auction App
Online Auction App
• Everyone can send their bids to
a contract
• The highest current bid is visible
to every one
• At the end of the bidding period
- The highest bid is sent to the
beneficiary
- Other bidders can withdraw their
bids
Source code: https://github.com/devcafevn/ethereum-auction-app
Image source: https://kryptomoney.com/italian-auction-house-now-accepting-payments-
bitcoins/
Blockchain Landscape Big Picture
Developer Tools Fin Tech File Storage
Gaming
Social
Digital Asset
Video
Security
And much much more …
SMART CONTRACTS
TOMO
CHAIN
Blockchain – Innovation Journey
When the journey began
2008
Adopting Tokenomics
2nd., beyond
currency
Inter organizational
cooperation
3rd., Smart Contracts
PoS, Scaling, on-chain,
off-chain, …
https://hbr.org/2017/02/a-brief-history-of-blockchain
Q & A
Share to get more
THANK YOU
https://facebook.com/devcafevn

Weitere ähnliche Inhalte

Was ist angesagt?

Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise BlockchainHyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
Altoros
 
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
Дмитрий Плахов
 

Was ist angesagt? (20)

Blockchains and Smart Contracts: Architecture Design and Model-Driven Develop...
Blockchains and Smart Contracts: Architecture Design and Model-Driven Develop...Blockchains and Smart Contracts: Architecture Design and Model-Driven Develop...
Blockchains and Smart Contracts: Architecture Design and Model-Driven Develop...
 
Anatomy of a hyperledger application
Anatomy of a hyperledger applicationAnatomy of a hyperledger application
Anatomy of a hyperledger application
 
What is Hyperledger Technology?
What is Hyperledger Technology?What is Hyperledger Technology?
What is Hyperledger Technology?
 
What is MultiChain Technology?
What is MultiChain Technology?What is MultiChain Technology?
What is MultiChain Technology?
 
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020
 
Blockchain technology
Blockchain technologyBlockchain technology
Blockchain technology
 
Demystify blockchain development with hyperledger fabric
Demystify blockchain development with hyperledger fabricDemystify blockchain development with hyperledger fabric
Demystify blockchain development with hyperledger fabric
 
Blockchain Technology
Blockchain TechnologyBlockchain Technology
Blockchain Technology
 
Litecoin Crypto Currency Bootcamp
Litecoin Crypto Currency BootcampLitecoin Crypto Currency Bootcamp
Litecoin Crypto Currency Bootcamp
 
Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise BlockchainHyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
Hyperledger Sawtooth Lake Intel's OSS Contribution to Enterprise Blockchain
 
BLOCKCHAIN TECHNOLOGY
BLOCKCHAIN TECHNOLOGYBLOCKCHAIN TECHNOLOGY
BLOCKCHAIN TECHNOLOGY
 
Information security in private blockchains
Information security in private blockchainsInformation security in private blockchains
Information security in private blockchains
 
Introduction to blockchain
Introduction to blockchainIntroduction to blockchain
Introduction to blockchain
 
Metadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN ExplosionMetadata in the Blockchain: The OP_RETURN Explosion
Metadata in the Blockchain: The OP_RETURN Explosion
 
Tangle: An alternative to Block chain for future of crypto currency
Tangle: An alternative to Block chain for future of crypto currency Tangle: An alternative to Block chain for future of crypto currency
Tangle: An alternative to Block chain for future of crypto currency
 
Introducing the Blockchain and Distributed Ledger Technology
Introducing the Blockchain and  Distributed Ledger TechnologyIntroducing the Blockchain and  Distributed Ledger Technology
Introducing the Blockchain and Distributed Ledger Technology
 
Meetup 19/12/2016 - Blockchain-as-a-service voor Antwerpen?
Meetup 19/12/2016 - Blockchain-as-a-service voor Antwerpen?Meetup 19/12/2016 - Blockchain-as-a-service voor Antwerpen?
Meetup 19/12/2016 - Blockchain-as-a-service voor Antwerpen?
 
Software Architecture and Model-Driven Engineering for Blockchain
Software Architecture and Model-Driven Engineering for BlockchainSoftware Architecture and Model-Driven Engineering for Blockchain
Software Architecture and Model-Driven Engineering for Blockchain
 
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
Доклад Владимира Бичева на третьем митапе сообщества блокчейн-разработчиков С...
 
Blockchain 101
Blockchain 101Blockchain 101
Blockchain 101
 

Ähnlich wie How to develop Decentralized App (ĐApp) on Ethereum

Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1
KlaraOrban
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Ruben Tan
 

Ähnlich wie How to develop Decentralized App (ĐApp) on Ethereum (20)

B4uConference_ethereum
B4uConference_ethereumB4uConference_ethereum
B4uConference_ethereum
 
Ethereum Solidity Fundamentals
Ethereum Solidity FundamentalsEthereum Solidity Fundamentals
Ethereum Solidity Fundamentals
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
Ethereum
EthereumEthereum
Ethereum
 
20221110 MetaCoin
20221110 MetaCoin20221110 MetaCoin
20221110 MetaCoin
 
Ethereum dapps20171205
Ethereum dapps20171205Ethereum dapps20171205
Ethereum dapps20171205
 
Create your first Smart Contract with Solidity
Create your first Smart Contract with SolidityCreate your first Smart Contract with Solidity
Create your first Smart Contract with Solidity
 
Ethereum.pptx
Ethereum.pptxEthereum.pptx
Ethereum.pptx
 
Build your own private blockchain based on ethereum
Build your own private blockchain based on ethereumBuild your own private blockchain based on ethereum
Build your own private blockchain based on ethereum
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1
 
Ethereum A to Z
Ethereum A to ZEthereum A to Z
Ethereum A to Z
 
Best practices to build secure smart contracts
Best practices to build secure smart contractsBest practices to build secure smart contracts
Best practices to build secure smart contracts
 
How to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart ContractsHow to not Destroy Millions in Smart Contracts
How to not Destroy Millions in Smart Contracts
 
Blockchain for Developers
Blockchain for DevelopersBlockchain for Developers
Blockchain for Developers
 
Developing Blockchain Applications
Developing Blockchain Applications Developing Blockchain Applications
Developing Blockchain Applications
 
Ceilometer presentation ODS Grizzly.pdf
Ceilometer presentation ODS Grizzly.pdfCeilometer presentation ODS Grizzly.pdf
Ceilometer presentation ODS Grizzly.pdf
 
The Ethereum Geth Client
The Ethereum Geth ClientThe Ethereum Geth Client
The Ethereum Geth Client
 
Ethereum_New.pptx
Ethereum_New.pptxEthereum_New.pptx
Ethereum_New.pptx
 
Ingredients for creating dapps
Ingredients for creating dappsIngredients for creating dapps
Ingredients for creating dapps
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
 

Kürzlich hochgeladen

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Kürzlich hochgeladen (20)

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

How to develop Decentralized App (ĐApp) on Ethereum

  • 1. How to develop Decentralized App on Ethereum Feb-2018 Phi Huynh & Thien Nguyen
  • 3. Agenda • Blockchain introduction • Ethereum • Đapp – General architecture • Đapp – Environment development • Đapp – Demo building Auction application
  • 5. Hash • Arbitrary input • Same length output • Unlikely that two inputs share the same output
  • 7. Blockchain • Distributed (Everybody keep their own copy of the ledger) • Transaction immutability achieved by way of blocks & chaining • Leverages consensus mechanism for validating the transactions • Uses cryptography for trust, accountability, security • There is no single point of failure
  • 8.
  • 9. Ethereum • A blockchain app platform that runs smart contracts
  • 10. Go Ethereum Client Geth ÐΞVp2p [TCP, 30303] > JS API Console IPC-RPC WS-RPC [8546] JSON-RPC [HTTP, 8545] Disabled by default Disabled by default
  • 11. Ethereum Network • Network Id = 1 • Morden: Network Id = 2 (retired) • Ropsten: Network Id = 3 • Rinkerby: Network Id = 4 • Kovan: Network Id = 42 • Network Id = Asigned Live Network Testnet Private Network
  • 13. Setup private Ethereum network • Install geth https://geth.ethereum.org/downloads/ • Create genesis.json • Initialize geth node “$ geth init path/to/genesis.json” • Start geth • Attach to geth • JS console • Create account • Start mining https://github.com/devcafevn/ethereum-auction-app/tree/master/private-network
  • 14. Using Ethereum Wallet and MetaMask Ethereum Wallet MetaMask You can install the MetaMask add-on in Chrome, Firefox, Opera https://github.com/ethereum/mist/releases
  • 15. Ethereum account types • Has an address • Controlled by a private key • Has an address • No private key • Holds and run code External Owned Account Contract Account
  • 16. Denominations Unit Wei Value Wei wei 1 wei 1 Kwei (babbage) 1e3 wei 1,000 Mwei (lovelace) 1e6 wei 1,000,000 Gwei (shannon) 1e9 wei 1,000,000,000 microether (szabo) 1e12 wei 1,000,000,000,000 milliether (finney) 1e15 wei 1,000,000,000,000,000 ether 1e18 wei 1,000,000,000,000,000,000
  • 17. GAS • Gas is the unit in which EVM resource usage is measured • Gas limit (start gas): max amount of gas you willing to spend • Gas price: price of gas on ether you willing to pay. Miners decides the minimal acceptable price Transaction Fee = Gas used * Gas price Gas used < Gas limit => Refund Gas used > Gas limit => Out of gas exception, no change made
  • 19. Remix • https://remix.ethereum.org • Writing your first smart contract pragma solidity ^0.4.0; contract MyAccount { uint private myBalance; function MyAccount(uint _myBalance) public{ myBalance = _myBalance; } function getBalance() public constant returns(uint){ return myBalance; } function add(uint _amount) public returns(uint){ myBalance += _amount; return myBalance; } }
  • 20. Dapp - general architecture Network
  • 21. Dapp - General architecture 2 Network DB Server
  • 23. Online Auction App • Everyone can send their bids to a contract • The highest current bid is visible to every one • At the end of the bidding period - The highest bid is sent to the beneficiary - Other bidders can withdraw their bids Source code: https://github.com/devcafevn/ethereum-auction-app Image source: https://kryptomoney.com/italian-auction-house-now-accepting-payments- bitcoins/
  • 24. Blockchain Landscape Big Picture Developer Tools Fin Tech File Storage Gaming Social Digital Asset Video Security And much much more … SMART CONTRACTS TOMO CHAIN
  • 25. Blockchain – Innovation Journey When the journey began 2008 Adopting Tokenomics 2nd., beyond currency Inter organizational cooperation 3rd., Smart Contracts PoS, Scaling, on-chain, off-chain, … https://hbr.org/2017/02/a-brief-history-of-blockchain
  • 26. Q & A Share to get more