SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Ethereum Blockchain & Dapps - Theory and Real World Applications
OCTOBER 2017, SOFTWARE UNIVERSITY
Jordan Jambazov (JJ)Dobromir Kovachev
Who we are?
Developers @ Open Source University Project
Trusted 3rd party
Peer-to-Peer
Bitcoin: Currency and technology
Bitcoin is the first decentralized digital currency.
“Satoshi Nakamoto”
2009
Mining
21 milion
Volatile value
> 50% in hands of 880
individuals
Litecoin, Ripple, Zerocoin
Blockchain
Distributed shared ledger
Cryptography (SHA-256, PKI)
Consensus model
Smart contracts
Information & asset exchange in business networks –
Separate ledgers
Consistency, efficiency, security and scalability
Blockchain advantages
The internet of everything needs a
ledger of everything
What is blockchain?
Public:
Private:
Cryptography
Key concepts of blockchain
Distributed ledger
Consensus Smart Contracts
Key concepts of blockchain - Distributed ledgers
- Group of replicated nodes
- Transactions distributed in blocks
- Parties identified with public key
- Accessibility of transactions depending on blockchain implementation
- Resilient for failure of one or more nodes
- Group of nodes operate tamper proof
Key concepts of blockchain - Cryptography
Hashing
Creation of a bit string (digest) representing integrity of content other string. Changing one character in
the original string results in complete different hash. Changing multiple characters in original string
that results in the same hash requires large amount of processing power for a long
period of time.
Input data
Input data
Example how SHA-256
works
Example how SHA-256
works.
79e8a584005254f7717547b
5829fd01fa
c19617618972f1dc643b2bb
7075c7cac
Hashing Hashing
Extra dot
Key concepts of blockchain - Cryptography
Public & private keys and wallets
Two large prime numbers that have a mathematical relation with each other. A string encrypted with one key can only be decrypted with the
other. One needs to be kept private, the other one can be made publicly known so that it can be used
by other parties to exchange data with you in a secure manner.
Encryption
Scrambling of clear text with the public key of the recipient so that the holder of that private key is the only one that can descramble the
message guarantee the confidentiality of the data exchanged.
a66b311c9b158c1e55d4e6cc5
55016d2e554ac....
Confidential text
encryption decription
Confidential text
Public key Private key
PKI management
Digital signature
2626043be7d913ff5d8520b39253eef6240e
31d…
2100f86450888dc01725
af78a0e70415…
encryption decription
2100f86450888dc01725
af78a0e70415…
Private key Public key
PKI managementHash of data to be secured
Hash to be checked with
the original
Key concepts of blockchain - Consensus
4 main methods of finding consensus in the blockchain:
- byzantine fault tolerance algorithm (PBFT)
- proof-of-work algorithm(PoW)
- proof-of-stake algorithm (PoS)
- delegated proof-of-stake algorithm (DPoS)
Possible scaling solution
http://plasma.io/plasma.pdf
Ethereum scaling solution, Plasma, could facilitate
‘billions of transactions per second’
Joseph Poon Vitalik Buterin
Key concepts of blockchain -
Smart Contract
Business logic that can be assigned to
a transaction on the blockchain
Acts as a ‘notary’ of blockchain
transactions
Holds conditions under which specific
actions can/must be performed
Can’t be modified without predefined
permissions
● Data of the transaction is the compiled contract
● Contracts can call other contracts (they can even call themselves)
● High level languages (for which compilers exist)
- Solidity (Javascript like)
- Serpent (Python like)
- LLL (Lisp like)
● Everything you use in a smart contract is publicly visible
Key concepts of blockchain - Smart Contract
1. Setting up a project with Truffle
Getting ready to write Smart Contract
Initialize Truffle Project
Contract Skeleton
Deploy / Migrate
Getting ready to write Smart Contract - initialize
Truffle project
● Create directory for the project
> truffle init
● Create new contract skeleton
> truffle create contract Calculator
Getting ready to write Smart Contract - initialize
Truffle project
● Add the contract to migrations/deploy_contracts.js
● Run TestRPC
● Deploy contract to TestRPC
Deploy / Migrate
> truffle migrate
Truffle & TestRPC - Coding smart contracts
Specifications Code contract Compile contract
Add Test Cases Test contract TestRPC
Truffle & TestRPC - Coding smart contracts
● Calculator contract
State = Number
State will change by operations:
- addToNumber(uint x)
- subtractFromNumber(uint x)
- multiplyWithNumber(uint x)
- divideNumberBy(uint x)
- getResult() returns current value
Specifications
Truffle & TestRPC - Coding smart contracts
● Test #1 Calculator should have result initialized to 10
● Test #2 Adding 10 & subtracting 5 should lead to result =
15
Add Test Cases
> truffle create test Calculator
Truffle & TestRPC - Coding smart contracts
● Test #1 Calculator should have result initialized to 10
Add Test Cases
Truffle & TestRPC - Coding smart contracts
● Test #2 Adding 10 & subtracting 5 should lead to result =
15
Add Test Cases
Truffle & TestRPC -
Coding smart contracts
● Code the contract
● Code the functions
- addToNumber(uint x)
- subtractFromNumber(uint x)
- multiplyWithNumber(uint x)
- divideNumberBy(uint x)
- getResult() returns current value
Code contract
● Compilation is done by Truffle framework
> truffle compile
● Change in deployment configuration - Redeploy contract
> truffle migrate
● Test smart contract
> truffle test
OR
> truffle <specific script>
Compile contract
C:ProgramsicoCalculator>truffle migrate
Running migration: 1_initial_migration.js
Deploying Migrations...
... 0x18ebd894d886dc4c6bfb286990efe682aa57a6a9c15b817c8b8d949db980ab2f
Migrations: 0xc8fa60795442def0b8df0a79e51e8d42714e84bd
Saving successful migration to network...
... 0xeb8cc164b73e4e6999c8868d7a21b0aa1cd39cb524ff25037a339135eb620174
Saving artifacts...
Running migration: 2_deploy_contracts.js
Deploying Calculator...
... 0x0fc6de85ea4cf7aa143b015204b0b547e2f51989cecdfa5fc085b9ec6a3f6824
Calculator: 0xbff49106559d670bd71e868ba7d2caab2aaef734
Saving successful migration to network...
... 0x463494b042367e8ea9396e4a43fd2815929016a46b6d27c0ac4c0da050bcce90
Saving artifacts...
Test contract&
Truffle & TestRPC - Coding smart contracts
Compilation
Contract Deployment - overview
Testing during
development
TestRPC
QA on testnet
ROPSTEN
KOVAN
RINKEBY
Production
Live
Now we have a way to create
complex transactions between
untrusted individuals
Ethereum Virtual Machine (EVM)
Ethereum VM handles internal state
and computation.
- States are stored on distributed
global ledger
- Computation is paid for with
Ether, per computational step
- Large decentralized computer
with millions of account objects.
Overview
Necessary APIs you need to know
Web3
● eth Ethereum blockchain related methods
● net Node’s network status
● personal Account functions and sending
● db Get/put for local LevelDB
● shh P2P messaging using Whisper
Play with web3 functionality http://thedapps.com/
DApp Browser
DApp Ethereum client
web3.js
HTML/CSS/JS
Smart Contract
Block n
Block 3
Block 2
Block 1
EVM
JSON RPC
Deployed as
EVM
bytecode
Programming Smart Contracts
Solidity
Ethereum Blockchain and DApps  - Workshop at Software University

Weitere ähnliche Inhalte

Was ist angesagt?

01204427-Hash_Crypto (1).ppt
01204427-Hash_Crypto (1).ppt01204427-Hash_Crypto (1).ppt
01204427-Hash_Crypto (1).ppt
GnanalakshmiV
 

Was ist angesagt? (19)

OpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chainOpenZeppelin + Remix + BNB smart chain
OpenZeppelin + Remix + BNB smart chain
 
Hash function
Hash functionHash function
Hash function
 
More Than You Need To Know About Bitcoin Technology
More Than You Need To Know About Bitcoin TechnologyMore Than You Need To Know About Bitcoin Technology
More Than You Need To Know About Bitcoin Technology
 
Ergo Hong Kong meetup
Ergo Hong Kong meetupErgo Hong Kong meetup
Ergo Hong Kong meetup
 
01204427-Hash_Crypto (1).ppt
01204427-Hash_Crypto (1).ppt01204427-Hash_Crypto (1).ppt
01204427-Hash_Crypto (1).ppt
 
Smart contracts in Solidity
Smart contracts in SoliditySmart contracts in Solidity
Smart contracts in Solidity
 
Smart Contract Security
Smart Contract SecuritySmart Contract Security
Smart Contract Security
 
آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)آموزش پرایس اکشن (price action)
آموزش پرایس اکشن (price action)
 
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
Ethereum VM and DSLs for Smart Contracts (updated on May 12th 2015)
 
Dsa & Digi Cert
Dsa & Digi CertDsa & Digi Cert
Dsa & Digi Cert
 
AN EFFICIENT PROXY SIGNCRYPTION SCHEME BASED ON THE DISCRETE LOGARITHM PROBLEM
AN EFFICIENT PROXY SIGNCRYPTION SCHEME BASED ON THE DISCRETE LOGARITHM PROBLEMAN EFFICIENT PROXY SIGNCRYPTION SCHEME BASED ON THE DISCRETE LOGARITHM PROBLEM
AN EFFICIENT PROXY SIGNCRYPTION SCHEME BASED ON THE DISCRETE LOGARITHM PROBLEM
 
Blockchain - Introduction and Authoring Smart Contracts
Blockchain - Introduction and Authoring Smart ContractsBlockchain - Introduction and Authoring Smart Contracts
Blockchain - Introduction and Authoring Smart Contracts
 
Hash crypto
Hash cryptoHash crypto
Hash crypto
 
Connecting The Block Cointelligence Academy by Dr Vince Ming
Connecting The Block   Cointelligence Academy by Dr Vince MingConnecting The Block   Cointelligence Academy by Dr Vince Ming
Connecting The Block Cointelligence Academy by Dr Vince Ming
 
Smart contracts using web3.js
Smart contracts using web3.jsSmart contracts using web3.js
Smart contracts using web3.js
 
With a transaction fee market and without a block size limit in Bitcoin netwo...
With a transaction fee market and without a block size limit in Bitcoin netwo...With a transaction fee market and without a block size limit in Bitcoin netwo...
With a transaction fee market and without a block size limit in Bitcoin netwo...
 
Applying Security Algorithms Using openSSL crypto library
Applying Security Algorithms Using openSSL crypto libraryApplying Security Algorithms Using openSSL crypto library
Applying Security Algorithms Using openSSL crypto library
 
Understanding hd wallets design and implementation
Understanding hd wallets  design and implementationUnderstanding hd wallets  design and implementation
Understanding hd wallets design and implementation
 
Web3 Full Stack Development
Web3 Full Stack DevelopmentWeb3 Full Stack Development
Web3 Full Stack Development
 

Ähnlich wie Ethereum Blockchain and DApps - Workshop at Software University

Ähnlich wie Ethereum Blockchain and DApps - Workshop at Software University (20)

EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
Blockchain a-new-disruption-in-financial-servies - IBM
Blockchain a-new-disruption-in-financial-servies - IBMBlockchain a-new-disruption-in-financial-servies - IBM
Blockchain a-new-disruption-in-financial-servies - IBM
 
Blockchain a-new-disruption-in-financial-servies by ibm
Blockchain a-new-disruption-in-financial-servies by ibm Blockchain a-new-disruption-in-financial-servies by ibm
Blockchain a-new-disruption-in-financial-servies by ibm
 
Blockchain a-new-disruption-in-financial-services - IBM
Blockchain a-new-disruption-in-financial-services - IBMBlockchain a-new-disruption-in-financial-services - IBM
Blockchain a-new-disruption-in-financial-services - IBM
 
Introduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart ContractIntroduction to Ethereum Blockchain & Smart Contract
Introduction to Ethereum Blockchain & Smart Contract
 
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger WorkshopIBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
 
Blockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationBlockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentation
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & CodeDeploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
 
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
 
Introduction to Blockchain Development
Introduction to Blockchain DevelopmentIntroduction to Blockchain Development
Introduction to Blockchain Development
 
Interledger DvP Settlement on Amazon Managed Blockchain
Interledger DvP Settlement on Amazon Managed BlockchainInterledger DvP Settlement on Amazon Managed Blockchain
Interledger DvP Settlement on Amazon Managed Blockchain
 
Hyperledger
HyperledgerHyperledger
Hyperledger
 
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 [Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
 
Presentation topalidis giorgos
Presentation topalidis giorgosPresentation topalidis giorgos
Presentation topalidis giorgos
 
Cryptographic Agility in Corda
Cryptographic Agility in CordaCryptographic Agility in Corda
Cryptographic Agility in Corda
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by Blockchain
 
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
 
Blockchain & microsoft
Blockchain & microsoftBlockchain & microsoft
Blockchain & microsoft
 
blockchain-and-trusted-computing
blockchain-and-trusted-computingblockchain-and-trusted-computing
blockchain-and-trusted-computing
 

Mehr von Open Source University

Mehr von Open Source University (6)

3 min. OSU Beta Pitch [oct 2018]
3 min. OSU Beta Pitch [oct 2018]3 min. OSU Beta Pitch [oct 2018]
3 min. OSU Beta Pitch [oct 2018]
 
Blockchain, sorting the wheat from the chaff - sensible commercial applicatio...
Blockchain, sorting the wheat from the chaff - sensible commercial applicatio...Blockchain, sorting the wheat from the chaff - sensible commercial applicatio...
Blockchain, sorting the wheat from the chaff - sensible commercial applicatio...
 
Blockchain for Education and Professional Development
Blockchain for Education and Professional DevelopmentBlockchain for Education and Professional Development
Blockchain for Education and Professional Development
 
Blockchain in Education - Open Source University
Blockchain in Education - Open Source UniversityBlockchain in Education - Open Source University
Blockchain in Education - Open Source University
 
Legal Chains of Blockchain - forum presentation
Legal Chains of Blockchain - forum presentationLegal Chains of Blockchain - forum presentation
Legal Chains of Blockchain - forum presentation
 
Digital Credentials on the Blockchain
Digital Credentials on the BlockchainDigital Credentials on the Blockchain
Digital Credentials on the Blockchain
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
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...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
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
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
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...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%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
 
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 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
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 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 

Ethereum Blockchain and DApps - Workshop at Software University

  • 1. Ethereum Blockchain & Dapps - Theory and Real World Applications OCTOBER 2017, SOFTWARE UNIVERSITY
  • 2. Jordan Jambazov (JJ)Dobromir Kovachev Who we are? Developers @ Open Source University Project
  • 3.
  • 6. Bitcoin: Currency and technology Bitcoin is the first decentralized digital currency. “Satoshi Nakamoto” 2009 Mining 21 milion Volatile value > 50% in hands of 880 individuals Litecoin, Ripple, Zerocoin Blockchain Distributed shared ledger Cryptography (SHA-256, PKI) Consensus model Smart contracts
  • 7. Information & asset exchange in business networks – Separate ledgers
  • 8. Consistency, efficiency, security and scalability Blockchain advantages
  • 9.
  • 10. The internet of everything needs a ledger of everything
  • 13. Cryptography Key concepts of blockchain Distributed ledger Consensus Smart Contracts
  • 14. Key concepts of blockchain - Distributed ledgers - Group of replicated nodes - Transactions distributed in blocks - Parties identified with public key - Accessibility of transactions depending on blockchain implementation - Resilient for failure of one or more nodes - Group of nodes operate tamper proof
  • 15. Key concepts of blockchain - Cryptography Hashing Creation of a bit string (digest) representing integrity of content other string. Changing one character in the original string results in complete different hash. Changing multiple characters in original string that results in the same hash requires large amount of processing power for a long period of time. Input data Input data Example how SHA-256 works Example how SHA-256 works. 79e8a584005254f7717547b 5829fd01fa c19617618972f1dc643b2bb 7075c7cac Hashing Hashing Extra dot
  • 16. Key concepts of blockchain - Cryptography Public & private keys and wallets Two large prime numbers that have a mathematical relation with each other. A string encrypted with one key can only be decrypted with the other. One needs to be kept private, the other one can be made publicly known so that it can be used by other parties to exchange data with you in a secure manner. Encryption Scrambling of clear text with the public key of the recipient so that the holder of that private key is the only one that can descramble the message guarantee the confidentiality of the data exchanged. a66b311c9b158c1e55d4e6cc5 55016d2e554ac.... Confidential text encryption decription Confidential text Public key Private key PKI management Digital signature 2626043be7d913ff5d8520b39253eef6240e 31d… 2100f86450888dc01725 af78a0e70415… encryption decription 2100f86450888dc01725 af78a0e70415… Private key Public key PKI managementHash of data to be secured Hash to be checked with the original
  • 17. Key concepts of blockchain - Consensus 4 main methods of finding consensus in the blockchain: - byzantine fault tolerance algorithm (PBFT) - proof-of-work algorithm(PoW) - proof-of-stake algorithm (PoS) - delegated proof-of-stake algorithm (DPoS)
  • 18. Possible scaling solution http://plasma.io/plasma.pdf Ethereum scaling solution, Plasma, could facilitate ‘billions of transactions per second’ Joseph Poon Vitalik Buterin
  • 19. Key concepts of blockchain - Smart Contract Business logic that can be assigned to a transaction on the blockchain Acts as a ‘notary’ of blockchain transactions Holds conditions under which specific actions can/must be performed Can’t be modified without predefined permissions
  • 20. ● Data of the transaction is the compiled contract ● Contracts can call other contracts (they can even call themselves) ● High level languages (for which compilers exist) - Solidity (Javascript like) - Serpent (Python like) - LLL (Lisp like) ● Everything you use in a smart contract is publicly visible Key concepts of blockchain - Smart Contract
  • 21. 1. Setting up a project with Truffle Getting ready to write Smart Contract Initialize Truffle Project Contract Skeleton Deploy / Migrate
  • 22. Getting ready to write Smart Contract - initialize Truffle project ● Create directory for the project > truffle init ● Create new contract skeleton > truffle create contract Calculator
  • 23. Getting ready to write Smart Contract - initialize Truffle project ● Add the contract to migrations/deploy_contracts.js ● Run TestRPC ● Deploy contract to TestRPC Deploy / Migrate > truffle migrate
  • 24. Truffle & TestRPC - Coding smart contracts Specifications Code contract Compile contract Add Test Cases Test contract TestRPC
  • 25. Truffle & TestRPC - Coding smart contracts ● Calculator contract State = Number State will change by operations: - addToNumber(uint x) - subtractFromNumber(uint x) - multiplyWithNumber(uint x) - divideNumberBy(uint x) - getResult() returns current value Specifications
  • 26. Truffle & TestRPC - Coding smart contracts ● Test #1 Calculator should have result initialized to 10 ● Test #2 Adding 10 & subtracting 5 should lead to result = 15 Add Test Cases > truffle create test Calculator
  • 27. Truffle & TestRPC - Coding smart contracts ● Test #1 Calculator should have result initialized to 10 Add Test Cases
  • 28. Truffle & TestRPC - Coding smart contracts ● Test #2 Adding 10 & subtracting 5 should lead to result = 15 Add Test Cases
  • 29. Truffle & TestRPC - Coding smart contracts ● Code the contract ● Code the functions - addToNumber(uint x) - subtractFromNumber(uint x) - multiplyWithNumber(uint x) - divideNumberBy(uint x) - getResult() returns current value Code contract
  • 30. ● Compilation is done by Truffle framework > truffle compile ● Change in deployment configuration - Redeploy contract > truffle migrate ● Test smart contract > truffle test OR > truffle <specific script> Compile contract C:ProgramsicoCalculator>truffle migrate Running migration: 1_initial_migration.js Deploying Migrations... ... 0x18ebd894d886dc4c6bfb286990efe682aa57a6a9c15b817c8b8d949db980ab2f Migrations: 0xc8fa60795442def0b8df0a79e51e8d42714e84bd Saving successful migration to network... ... 0xeb8cc164b73e4e6999c8868d7a21b0aa1cd39cb524ff25037a339135eb620174 Saving artifacts... Running migration: 2_deploy_contracts.js Deploying Calculator... ... 0x0fc6de85ea4cf7aa143b015204b0b547e2f51989cecdfa5fc085b9ec6a3f6824 Calculator: 0xbff49106559d670bd71e868ba7d2caab2aaef734 Saving successful migration to network... ... 0x463494b042367e8ea9396e4a43fd2815929016a46b6d27c0ac4c0da050bcce90 Saving artifacts... Test contract& Truffle & TestRPC - Coding smart contracts
  • 31. Compilation Contract Deployment - overview Testing during development TestRPC QA on testnet ROPSTEN KOVAN RINKEBY Production Live
  • 32. Now we have a way to create complex transactions between untrusted individuals
  • 33. Ethereum Virtual Machine (EVM) Ethereum VM handles internal state and computation. - States are stored on distributed global ledger - Computation is paid for with Ether, per computational step - Large decentralized computer with millions of account objects.
  • 35. Necessary APIs you need to know Web3 ● eth Ethereum blockchain related methods ● net Node’s network status ● personal Account functions and sending ● db Get/put for local LevelDB ● shh P2P messaging using Whisper Play with web3 functionality http://thedapps.com/
  • 36.
  • 37. DApp Browser DApp Ethereum client web3.js HTML/CSS/JS Smart Contract Block n Block 3 Block 2 Block 1 EVM JSON RPC Deployed as EVM bytecode