Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Blockchains and co, with only 2 hours (ENSSAT)

Blockchains and co, with only 2 hours (ENSSAT)

Technical conference given to students of ENSSAT (enssat.fr) to introduce to them the universe of blockchains (in 2 hours).

Talk about history of cypherpunks, blockchains, cryptocurrencies, tokens, decentralized applications, use cases and laws.

Slidedeck under CC-BY.

You enjoyed reading these slides? Buy me a beer, thanks<3
(https://pylapersonne.info/buymeacoffee)

Pierre-Yves Lapersonne

November 13, 2018
Tweet

More Decks by Pierre-Yves Lapersonne

Other Decks in Technology

Transcript

  1. Blockchains & co with only ~120’ Release 4 - 11/23/2018

    ✿✿✿✿ ʕ •ᴥ•ʔ/ ︻デ═一 Cette œuvre est mise à disposition selon les termes de la Licence Creative Commons Attribution 4.0 International.
  2. crypto-anarchism, cypherpunk and mathematics... • 1992: cypherpunks ◦ Timothy May

    ◦ The Cypherpunks Mailing List ◦ release of The Cyphernomicon (1994) ◦ missions including protection of privacy using encryption ◦ crypto-anarchism • 1998: b-money ◦ Wei Dai ◦ b-money, an anonymous, distributed electronic cash system ◦ base of future blockchains: proof of work, transactions, broadcast • 2005: bit gold ◦ Nick Szabo ◦ Bit Gold: Towards Trust-Independent Digital Money 5
  3. and shit happened. • 2008: subprimes crisis ! ◦ too

    much speculation ◦ massive loss of money for people ◦ some banks were definitely closed ◦ some banks were nationalized ◦ loss of confidence to usual financial systems • 2008: Bitcoin ◦ Satoshi Nakamoto ◦ Bitcoin: A Peer to Peer Electronic Cash System ◦ birth of the 1st cryptocurrency! 6
  4. the first block • 3 January 2009 ◦ 1st mined

    block - block genesis ◦ 1st blockchain started ◦ 1st transaction including a troll 7
  5. the first blockchain • new paradigm, new hopes ◦ decentralized

    architecture ◦ without regulation ◦ unfalsifiable content ◦ not anonymous ◦ holds only bitcoin transactions ◦ based on a fair consensus: mathematical challenge ◦ dedicated to micro-transactions 8 bitcoin BTC 1 milli-bitcoin mBTC 0.001 micro-bitcoin μBTC 0.000001 satoshi sat 0.00000001 millisatoshi msat 0.00000000001
  6. 1a - transaction • sender • receiver • balance of

    tokens • payload (depending to the blockchain in use) 10
  7. 1b - transactions • triggered once registered in the blockchain

    • each transaction has a cost (Tx fees) • transactions are stored inside a pool before being added • Tx fees order the transactions 13 Number of BTC transactions in pool (10/30/2018) bitcointicker.co
  8. 2 - block • gathers several transactions • contains useful

    details for the blockchain, e.g. : ◦ timestamp ◦ transaction fees ◦ relay ◦ difficulty, nonce ◦ hashtree root ◦ ... • must be added only 1 time 14
  9. 15 inside a block mining pool hash of block #493761

    root of the hash tree blockchain.info
  10. 3a - consensus • miners may solve a hard mathematical

    problem to choose the one who will add the block and trigger the transactions stored inside • challenge = consensus ◦ Proof Of Work ◦ Proof of Stake ◦ Proof of Authority ◦ Proof of Importance ◦ ... 16 ? ? ? ? ?
  11. 3b - proof of work 1. build of a local

    block with ◦ hash of previous block ◦ hashtree root for tx ◦ difficulty ◦ ... 1. find the golden nonce, i.e. the random value with makes the block hash lower than the difficulty ➔ brute force! 17 Blockchain Bitcoin Ethereum Monero Dogecoin Difficulty 7 184 404 942 702 2 986 685 821 724 284 61 820 335 411 2 716 801 Block time 10’50’’ 14.3’’ 2’2’’ 1’2’’ • 11/07/2018 • bitinfocharts.com hash n-1 hash algorithm hash n nonce
  12. 3c - block mining • with CPU or GPU •

    with FPGA or ASIC • with mining pools 18 Distribution of hashrates in Bitcoin blockchain (11/09/2018) blockchain.info/pools
  13. 3d - rewards • blockchains are alive thanks to their

    transactions • transactions use tokens • tokens should be released regularly ➔ how can we make the system dynamic and attractive? Miners earn transaction fees and rewards 19 Blockchain Reward USD Bitcoin 12.5 BTC $ 81 846.75 Bitcoin Cash 12.5 BCH $ 7 865.63 Bitcoin Gold 12.5 BTG $ 392.38 Litecoin 25 LTC $ 1 373.5 ZCash 12.5 ZEC $ 1 626 Ethereum 3 ETH $ 660.24 Ethereum Classic 4 ETC $ 38.96 Monero 3.6 XMR $ 400.176 • 11/07/2018 • bitinfocharts.com
  14. 4a - blockchain 20 • each block has a fingerprint

    of the previous block (hash) • each block has a fingerprint of the previous block (hash) hash n-1 hash n hash n-2 bloc n - 1 bloc n bloc n + 1 hash hash
  15. 4b - blockchain • each block has a fingerprint of

    the previous block (hash) 21 hash n-1 hash n hash n-2 bloc n - 1 bloc n bloc n + 1 hash hash • each block has a fingerprint of the previous block (hash) • to corrupt a block, we must modify all the following blocks • a strong protocol is applied to check the blockchain and ensure its integrity hash of corrupted block
  16. 5 - network • the blockchain is replicated in each

    node of the network • if we want to corrupt a blockchain, we have to corrupt all blockchains before the next update • this kind of attack implies too much energy and computational power 22 full node lite node
  17. 2090 cryptocurrencies in use at least (899 coins + 1191

    tokens) • 11/07/2018 • coinmarketcap.com 25
  18. tokens or not tokens... “Simple” cryptocurrencies • more for “1st

    generation blockchains” Tokens • related to “2nd generation blockchains” • implement ERC20 or ERC721 standards • used with smart contracts 26
  19. ERC {20 | 721} ERC 20 • fungible • ~

    implemented by a lot of cryptocurrencies • looks like fiat currencies • can be sliced into smaller fragments ERC 721 • not fungible (= unique) • cannot be sliced • “manufactured collectible” 27
  20. types of tokens payment tokens • dedicated blockchains • inherent

    value • for financial transactions • real cryptocurrencies security/equity tokens • represent assets • can be seen like securities, derivatives, ... • used in ICO 28 utility tokens • provided access to services • dedicated for use cases
  21. bubbling world 29 ETH vs ETC • June 17, 2016

    • hack of TheDAO • ~ 3 600 000 stolen ETH (~ 70 000 000 USD at the time) • → hard fork to cancel the theft (Ethereum) • a part of the community refused • = birth of Ethereum Classic (no fork)
  22. bubbling world 30 BTC vs BTG vs BCH... • upgrade

    of BTC blockchains with SegWit to increase speed of transactions and blocks sizes • → contentions in community • = hardfork (07/2017) giving birth to Bitcoin Cash • need to mine bitcoins without ASIC • = hardfork (10/2017) giving birth to Bitcoin Gold
  23. really bubbling world 31 (ノಥ益ಥ)ノ ... vs BCHABC vs BCHSV

    • November 2018 • a civil war between two camps... • conflict between rich people about vision, control, influence (and also block sizes) • Craig Wright vs Roger Ver (and the rest of the world) • hashwar to get rid of the opponents • = hardfork splitting Bitcoin Cash to Bitcoin ABC and Bitcoin SV
  24. Bitcoin • January 3, 2009 • limited quantity to 21

    millions of BTC • 1 BTC = 6 544.28 USD • 10’5’’ blocktime • 12.50 BTC + Tx Fees rewarded • hashrate of 47.46 Ehash/s • proof of work (Hashcash) Grandpa cryptocurrency 33 BitInfoCharts (11/07/2018)
  25. Bitcoin • no privacy • not anonymous • too few

    minable without mining pool • massive speculation • very bubbling • network consumption ~ 1% of world energy consumption Grandpa cryptocurrency 34
  26. Monero • April 18, 2014 • unlimited quantity of XMR

    • 1 XMR = 111.6 USD • 2’2’’ blocktime • 3.63 XMR + Tx Fees rewarded • hashrate of 502 Mhash/s • proof of work (CryptoNight) “secure, private, untraceable” (today) 35 BitInfoCharts (11/07/2018)
  27. Monero • sender address is protected (Ring Signatures) • receiver

    address is protected (Stealth Addresses) • transaction balance is protected (Ring Confidential Transactions) • broadcast of transactions is protected (Kovri) • XMR balances not related to public addresses “secure, private, untraceable” (today) 36
  28. ZCash • October 28, 2016 • limited quantity to 21

    millions of ZEC • 1 ZEC = 130.88 USD • 2’32’’ blocktime • 12.50 ZEC + Tx Fees rewarded • hashrate of 2.27 Ghash/s • proof of work (Equihash) Snowden approved 37 BitInfoCharts (11/07/2018)
  29. ZCash • sender and receiver addresses are shielded (z-addr) or

    not (t-addr) • z-addr are protected with a Non Interactive Zero Knowledge Proof method (zk-SNARK) • public blockchain but private project driven by the Zerocoin Electric Coin Company Snowden approved 38
  30. Ether • July 30, 2015 • unlimited quantity of ETH

    • 1 ETH = 220.11 USD • 14.3’’ blocktime • 3 ETH + Tx Fees rewarded • hashrate of 238 Thash/s • proof of work (Ethash) Ethereum powered 39 BitInfoCharts (11/07/2018)
  31. Ether Ethereum powered 40 • token for the 1st blockchain

    of 2nd generation • cryptocurrency in use for smart contracts
  32. Basic Attention Token Be brave 41 • May 31, 2017

    • hosted on Ethereum • 1 BAT = 0.33 USD • created by Brendan Eich • integrated to Brave browser • designed to value and price humain attention (for fair ads) • 30’’ to raise 35 millions USD during the ICO
  33. 42 • ICO from 12/01/2017 to 01/01/2018 • hosted on

    Ethereum • 1 CO2 = 3.81 USD • trade the carbon using tokens • try to build a “blockchain green ecosystem” (not a joke) Climatecoin Save the planet, trade the carbon
  34. the 2nd generation of blockchains • 2013: Ethereum ◦ Vitalik

    Buterin ◦ was only 19 y.o.! • blockchains are: ◦ decentralized ◦ replicated (distributed) ◦ not regulated ◦ use tokens ◦ have blocks with financial transactions • and what if we put programs in blockchains? ◦ Ðecentralized applications The Ethereum Experience 44
  35. programs in blockchain! 45 • use of virtual machine ◦

    Ethereum Virtual Machine (EVM) • transactions have bytecode in payload • execution of programs are conditioned ◦ tokens are used to process instructions ▪ ETH, ETC, ... ◦ each instruction has a cost ▪ gas • nodes of network check outputs of programs • Ethereum can be seen as kind of “slow” database/register • Ethereum Yellow Paper • Gas Costs from Yellow Paper
  36. a gas story 46 • gas is used so as

    to evaluate: ◦ costs of instructions ◦ fees of transactions (TxFees) ◦ value of transactions earned by miners final cost of the transaction, earned by miner wei = unit for gas the amount of gas to burn to process the program of the smart contract, which depends to the amount of code to process • the lower the price is, the less gainful the transaction is, the later the transaction will be mined • allow to involve the cost of the transaction
  37. TxFees in Ether based on gas 47 Ether = Tx

    Fees = Gas Limit * Gas Price ETH Gas Station
  38. a new paradigm 48 • “Old” paradigms ◦ sequential ➞

    1 computer processing series of N instructions ◦ parallel ➞ 1 computer processing K (in N) instructions at the same time (threads) ◦ distributed ➞ X computers processing samples of the N instructions • Decentralized paradigms • X computers processing at the same time the N instructions • programs are duplicated in computers • no more unique server or backend which hosts the program →no authorities to trust →no centralisation to fail →but slower than centralized solutions
  39. architecture of web Ðapps Ethereum blockchain (dev) Ethereum network (prod)

    web server smart contract sources (.sol) smart contract ABI (.js, .json) web app (.html, .css, .js, ...) hosting compilation inclusion deployment web browser
  40. logic with smart contracts 49 • have balance of tokens

    and unique address • the code is law • hosted in the blockchain • once deployed, cannot be ◦ removed ◦ modified • if bugs or flaws appear ◦ write a new contract! 51 More about smart contracts ÐApps on Ethereum with Solidity
  41. need to optimize Ðapps on blockchains 52 • Ðapps must

    be optimized ◦ choose the best functions ◦ be aware with storage of data ◦ use the most suitable data types ◦ decrease complexity of functions • If the program is: ◦ dirty ◦ heavy ◦ not enough well written ➔ may burn a lot of gas ➔ must be expensive in Ether
  42. which use cases? 54 • payment ◦ e.g. Keplerk •

    products tracking ◦ e.g. IBM Food Trust ◦ e.g. Connecting Food • fight against censorship, fake news... ◦ e.g. PUBLIQ • citizenship ◦ e.g. online vote using blockchains • insurance ◦ e.g Etherisc • documents and securities transfer, ...
  43. governments and states may be scared 56 • forbidden ◦

    e.g Algeria, Bolivia, China, Ecuador, Egypt, Iran, Morocco • more or less regulated ◦ e.g Canada, France, Singapore, USA • supported ◦ e.g Estonia, Japan • used for national cryptocurrencies ◦ e.g Estonia (Estcoin?), Venezuela (Petro)
  44. blockchains & cryptocurrencies 58 • are not yet mature enough

    • may be censored, controlled or regulated by governments • are occulted by the hype around Bitcoin (-_-)” • enhance and boost innovations and technical challenges (ノ^_^)ノ we can think using a new framework: decentralization
  45. Tools • BitInfoCharts • Coinbase • ETH Gas station •

    Ethereum Natural Specification Format • Ethereum Network Status • Ethernodes • Etherscan • Etherscan ByteCode to Opcode Disassembler • Etherscan gas price • Ganache • Geth • Infura • Loom
  46. Tools • Metamask • Mist • Monero Blockchain Explorer •

    Open Zeppelin • Porosity • Remix IDE • State of the ÐApps • Truffle • Web3 • Zchain
  47. References • 9 Types of Consensus Mechanisms That You Didn’t

    Know bout, Daly Bit • A 101 Noob Intro to Programming Smart Contracts on Ethereum, ConsenSys • Basic Attention Token, basicattentiontoken.org • Basic Attention Token (BAT), Brave Software • Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi Nakamoto • Bitcoin: The Cryptoanarchists’ Answer to Cash, Morgen E. Peck • Bitcoin Cash’s ‘Mining War’ Escalates as Blockchain Hard Fork Approaches, Nikhilesh De • Bitcoin Is Terrible for the Environment, Emily Atkin • Bit Gold and Bitcoin, In Search Of Satoshi • Bloc Genesis, bitcoin.fr • Blockchain Security Mechanisms, Shaan Ray • Climatecoin, climatecoin.io • Create Your Own Crypto-currency with Ethereum, ethereum.org • Crossing Over to Web3 - An Introduction to Decentralised Development, Luke Hedger • CryptoKitties, cryptokitties.co • Cryptomonnaies - mode d’emploi en 20’, Pierre-Yves Lapersonne • ÐApps on Ethereum with Solidity, Pierre-Yves Lapersonne • Decentraland, decentraland.org • Demystifying Hashgraph: Benefits and Challenges, Yaoqi Jia • Ethash, github.com/ethereum Web sites visited on 11/23/2018
  48. References • Ethereum ERC 721 vs ERC 20, Patrick Goh

    • Ethereum: Ether, Ether Gas, Gas Limit, Gas Price & Fees [...], Sudhir Khatwani • Ethereum “Gas” - How it works, steemit.com • Everything You Need to Know About [...] Sapling Upgrade [...], John Westbrook • Full-stack smart contract development, Júlio Santos • Hashgraph wants to give you the benefits of blockchain without the limitations, Samantha Stein • Hedera Hashgraph, hederahashgraph.com • How to build your own Ethereum based ERC20 Token and launch an ICO in next 20 minutes, Sandeep Panda • Hyperledger, hyperledger.org • Introduction to Smart Contracts, solidity.readthedocs.io • Kovri, getkovri.rg • La Révolution des Blockchains, Pierre-Yves Lapersonne • Ledger Legends, ledgerlegends.com • Les bitcoins dans les bureaux de tabac, une information fumeuse, Maxime Vaudano & Pierre Breteau • Les cryptomonnaies sont-elle halal ?, Gregory Raymond • Multisignature, en.bitcoin.it • Proof of Work vs Proof of Stake: Basic Mining Guide, blockgeeks.com • Reversing EVM bytecode with radare2, Fedor Sakharov • Ring Confidential Transactions, Shen noether, Adam Mackenzie and Monero Core Team • Ring signature, wikipedia.org Web sites visited on 11/23/2018
  49. References • Stealth Address and Key Management Techniques in Blockchain

    Systems, N. Courtois, R. Mercer • Swarm, swarm-guide.readthedocs.io • The Cyphernomicon, nakamotoinstitute.org • The Ethereum Experience, Ethereum • The Next Generation of Distributed Ledger Technology, iota.org • The Story of the DAO - Its History and Consequences, Samuel Falkon • The Tangle, Serguei Popov • The Tangle: an Illustrated Introduction, Alon Gal • Types of Consensus Protocols Used in Blockchains, Evan Tan • Types of tokens. The four mistakes beginner crypto-investors make, ICOscoring • Understanding Blockchain Fundamentals, Part 1: Byzantine Fault Tolerance, Georgios Konstantopoulos • Understanding Segregated Witness, Jimmy Song • Vie privée, telle est ma devise, Pierre-Yves Lapersonne • W-ETH, weth.io • Walking Through the ERC721 Full Implementation, Karen Scarbrough • WBTC, www.wbtc.network • What are Sidechains?, Shaan Ray • When I say mine you say Coinhive, Pierre-Yves Lapersonne • Whisper, github.com/ethereum Web sites visited on 11/23/2018
  50. Credits • Logo of AudioCoin - ?, modified with GIMP

    • Logo of Augur - AugurProject, CC BY-SA International 4.0, modified with GIMP • Logo of Basic Attention Token - Bradley Richter, CC BY-SA International 4.0, modified with GIMP • Logo of Brave - Copyright © Brave Software Inc.. All Rights Reserved, modified with GIMP • Logo of Bitcoin - Bitboy, public domain, modified with GIMP • Logo of Bitcoin ABC - ?, modified with GIMP • Logo of Bitcoin Cash - Amaury Sechet, CC0 1.0 Universal Public Domain Dedication, modified with GIMP • Logo of Bitcoin Gold - Bitcoin Gold, public domain, modified with GIMP • Logo of Bitcoin SV - ?, modified with GIMP • Logo of climatecoin - ?, modified with GIMP • Logo of Code d’Armor - Copyright © Code d'Armor. All Rights Reserved. • Logo of CSS3 - icones8.fr • Logo of Dash - dash.org, CC BY-SA International 4.0 • Logo of Dogecoin - Copyright © The Ðogecoin Project. All Rights Reserved, modified with GIMP • Logo of ENSSAT - Copyright © ENSSAT. All Rights Reserved. • Logo of eosio - eosio, block.one, public domain, modified wih GIMP • Logo of Ethereum - Ethereum Foundation, CC BY Unported 3.0, modified with GIMP • Logo of Ethereum Classic - Ethereum Classic, CC0 1.0 Universal Public Domain Dedication, modified with GIMP • Logo of Filecoin - Copyright © Protocol Labs. All Rights Reserved, modified with GIMP • Logo of Ganache - Copyright © Consensys. All Rights Reserved, modified with GIMP • Logo of Gnosis - Copyright © Gnosis Ltd. All Rights Reserved, modified with GIMP • Logo of Golem - Copyright © Golem Factory GmbH. All Rights Reserved, modified with GIMP • Logo of HTML5 - Copyright © W3C, CC BY 3.0 • Logo of IOTA - Copyright © IOTA Foundation. All Rights Reserved, modified with GIMP • Logo of Kairos - Copyright © Kairos AR, Inc. All Rights Reserved. • Logo of JavaScript - javatpoint.com, modified with Gimp • Logo of Litecoin - Losh1212, CC BY-SA International 4.0, modified with GIMP • Logo of MetaMask - metamask.io, modified with GIMP • Logo of Monero - The Monero Project, CC BY 3.0, modified with GIMP • Logo of Ripple - Ripple, public domain, modified with GIMP • Logo of Solidity - Copyright © Ethereum Foundation, CC BY-SA 3.0, modified with GIMP • Logo of Truffle - Copyright © Consensys. All Rights Reserved, modified with GIMP • Logo of ZCash - Copyright © ZCash. All Rights Reserved, modified with GIMP • Pictures - Freepik, Flaticon Basic License • Bitcoin free icon - Pixel Buddha, Flaticon Basic License • Exploding free icon - OCHA, CC 3.0 BY • Invisible person of clothes free icon - Freepik, Flaticon Basic License • Troll Face Png Available In Different Size - freeiconspng.com • Runner silhouette running fast free icon - Freepik, Flaticon Basic License