Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ethereum Blockchain and DApps - Workshop at Software University

78 views

Published on

We are happy to invite you all to participate in the lecture, which our blockchain specialists are going to present on at SoftUni.

On that lecture we’ll explain fundamentals of blockchain technology, real live examples and upcoming challenges for the future applications of that new and beneficial technology.

Our team will present also the Open Source University project, how it will reshape the future of education, enhancing the connection between businesses and learning content providers. (www.os.university)

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Ethereum Blockchain and DApps - Workshop at Software University

  1. 1. Ethereum Blockchain & Dapps - Theory and Real World Applications OCTOBER 2017, SOFTWARE UNIVERSITY
  2. 2. Jordan Jambazov (JJ)Dobromir Kovachev Who we are? Developers @ Open Source University Project
  3. 3. Trusted 3rd party
  4. 4. Peer-to-Peer
  5. 5. 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
  6. 6. Information & asset exchange in business networks – Separate ledgers
  7. 7. Consistency, efficiency, security and scalability Blockchain advantages
  8. 8. The internet of everything needs a ledger of everything
  9. 9. What is blockchain?
  10. 10. Public: Private:
  11. 11. Cryptography Key concepts of blockchain Distributed ledger Consensus Smart Contracts
  12. 12. 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
  13. 13. 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
  14. 14. 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
  15. 15. 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)
  16. 16. Possible scaling solution http://plasma.io/plasma.pdf Ethereum scaling solution, Plasma, could facilitate ‘billions of transactions per second’ Joseph Poon Vitalik Buterin
  17. 17. 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
  18. 18. ● 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
  19. 19. 1. Setting up a project with Truffle Getting ready to write Smart Contract Initialize Truffle Project Contract Skeleton Deploy / Migrate
  20. 20. Getting ready to write Smart Contract - initialize Truffle project ● Create directory for the project > truffle init ● Create new contract skeleton > truffle create contract Calculator
  21. 21. 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
  22. 22. Truffle & TestRPC - Coding smart contracts Specifications Code contract Compile contract Add Test Cases Test contract TestRPC
  23. 23. 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
  24. 24. 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
  25. 25. Truffle & TestRPC - Coding smart contracts ● Test #1 Calculator should have result initialized to 10 Add Test Cases
  26. 26. Truffle & TestRPC - Coding smart contracts ● Test #2 Adding 10 & subtracting 5 should lead to result = 15 Add Test Cases
  27. 27. 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
  28. 28. ● 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
  29. 29. Compilation Contract Deployment - overview Testing during development TestRPC QA on testnet ROPSTEN KOVAN RINKEBY Production Live
  30. 30. Now we have a way to create complex transactions between untrusted individuals
  31. 31. 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.
  32. 32. Overview
  33. 33. 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/
  34. 34. 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
  35. 35. Programming Smart Contracts Solidity

×