blockchain, ethereum and business applications · 2017-11-07 · completely decentral currency (no...

50
Blockchain, Ethereum and Business Applications @ZimMatthias Matthias Zimmermann BSI Business Systems Integration AG

Upload: others

Post on 20-May-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Blockchain, Ethereum and Business Applications @ZimMatthias Matthias Zimmermann BSI Business Systems Integration AG

The «Valley»

Blockchain Market

Towards understanding Bitcoin …

«history’s first» Blockchain • Satoshi Nakamoto (?) • White Paper 2008 • Open Source Software 2009

Coffee at Bob‘s

Source: «Mastering Bitcoin», Andreas M. Antonopoulos

Address Amount [B]

1GdK9UzpHBzqzX2A9JFP3Di4weBwqgmoQA 0.015

Addresses == «Accounts» Encoded Numbers Example: 1GdK9UzpHBzqzX2A9JFP3Di4weBwqgmoQA Derived from a public/private key pair Getting, using and loosing it Create your own addresses, no need to ask anyone No ID required, no showing up at local branch, … To send Bitcoins you need your private Key You loose your private key you loose your money

What is a Bitcoin Address?

Bitcoin Network

Bitcoin Client • Sends TX to network • Mines new blocks • Holds local copy of

blockchain

Peer-to-Peer Network

Mobile Wallet

Distribution of unconfirmed TX

To confirm TX: − TX mined into block − 5 new blocks on top

Network mines TX in ~ 10 min. Sometimes this takes hours …

The Coffee Transaction

Screenshot: blockchain.info

Bob’s Address Coffee Price

My Address

Link to TX Block TX Fee

Block #277316 includes coffee TX

Genesis Block

TX Blocks and the Blockchain

419 TX (€495,000)

Link to previous Block #277316

#277315

#2

#1

Screenshot: blockchain.info

Block Hash do you see the leading zeros?

1. New TX are propagated through Bitcoin peer-to-peer network 2. Bitcoin client receive new TX and add it to local «mempool» 3. Client starts to «mine» transactions:

− Assemble TX from mempool to block candidate

− Starts to solve the block candidate’s crypto challenge

− Client solving the challenge first, gets block reward and all TX fees

3. Winning client sends the new block to its peers

4. Arrival of new block triggers the next challenge

From Transactions to Blocks (Mining)

mzi@BSI ~/Desktop/oss/events/2017/jug_blockchain_2017

$ java DummyBitcoinMiner 1

B37060F28617A5DFA3DB9A3D547663B3:I am Satoshi Nakamoto:lubf -> CF6BB3C636DF380E357E28271D948BBC

B37060F28617A5DFA3DB9A3D547663B3:I am Satoshi Nakamoto:jauj -> E6F1EB09AEF0BF331261B64E1C798EAB

B37060F28617A5DFA3DB9A3D547663B3:I am Satoshi Nakamoto:dwpt -> 0CEE0B104F133062073BDD810D3DB6CF

Success with nonce 'dwpt' for difficulty '0'. Hashes calculated: 29

$ java DummyBitcoinMiner 4

B37060F28617A5DFA3DB9A3D547663B3:I am Satoshi Nakamoto:quyc -> 89BD526A2DF7EBF41ACD227BFC6B78FE

B37060F28617A5DFA3DB9A3D547663B3:I am Satoshi Nakamoto:ceaw -> 0000AD30B2DDD8A773B8E5AABB5282AD

Success with nonce 'ceaw' for difficulty '0000'. Hashes calculated: 11584

Block Hashes and Crypto Challenge

Difficulty Oct’ 17: 18 leading zeros

Bitcoin Success Completely decentral currency (no need for banks) Open Source (GitHub) and Open Data (complete TX history) First successful implementation of any crypto currency «Gold Standard» since 2009 Record price levels in 2017

Bitcoin Challenges Scaling debate/war Declining market share (Ethereum, …)

Bitcoin Recap

Bitcoin Resources

https://github.com/bitcoin/bitcoin https://github.com/bitcoinbook/bitcoinbook

Ethereum

Currency and Smart Contracts • 2014 by Vitalik Buterin • Distributed VM (Turing complete) • Open source software

Ethereum vs Bitcoin Common Traits Virtual currency Peer-to-peer network/nodes with local blockchain Concepts of addresses, transactions, mining

Main Differences Specification with different implementations (Bitcoin reference client) Smart contracts and Ethereum virtual machine Gas to execute smart contracts and TX

What is gas? Unit to pay mining nodes Unit of gas has price in Ethers

What can we buy with gas? Pay TX fees Execute smart contracts Computations performed by clients: Ethereum Virtual Machine (EVM) EVM is working as long as there is gas Example 1: SHA3 computation costs 30 gas Example 2: EVM always terminates (stays in infinite loop until gas runs out)

Gas

What is a Smart Contract? Code written in high level language «Solidity» Code is compiled into byte code Byte code executed on client by EVM Has owner Has address Can hold currency

Examples 1. Flight delay insurance 2. «Truly» autonomous cars

Ethereum Smart Contracts

Flight Delay App

https://fdd.etherisc.com http://oraclize.it http://www.flightstats.com

Smart contract: Order car to transport people (fees go to car contract) Smart contract: Car pays for energy/services (car pays with it’s own funds)

«Truly» Autonomous Cars

In 2017 RWE introduces charging stations connected to Ethereum blockchain

http://www.trustnodes.com/2017/04/29/germanys-energy-giant-launches-100s-ethereum-based-electric-cars-charging-stations https://www.theverge.com/2017/2/21/14687346/uber-self-driving-car-arizona-pilot-ducey-california

«Greeter» with web3 Smart Contract Hello World

Ethereum and Applications

Ethereum Client Geth/TestRPC/…

Ethereum Peer-to-Peer Network

Interface http://localhost:8545 JSON-RPC

JavaScript

web3 web3j

Java

«Hello World» (greeter.sol)

greeter.sol + additional state

+ ‘payable’

Solidity Compiler (online)

byte code (EVM) to deploy contract

Deploy script (JS)

Deploy (Console)

Contract address

Successs

«Greeter» with web3j

1. Compile greeter.sol

greeter.bin

greeter.abi

2. Create wrapper class (use Web3j command line tool)

Greeter.java

greeter.sol Greeter.java

https://github.com/matthiaszimmermann/web3j_demo

Trading-Network Demo Ethereum, web3j, Eclipse Scout

Use Case Currency Hedging: Manage buy and sell orders for € / US$

Classical Business App

− Idendity management: Map users with Ethereum addresses

− web3j library to access Ethereum client

− Eclipse Scout to build application

Blockchain Benefits

− Efficiency: No central organization/infrastructure

− Trust: Tampering-proof ledger, trust by blockchain

Trading Network Demo

PostgreSQL

Ethereum Client TestRPC

web3

Eclipse Scout Backend

web3j JDBC

Eclipse Scout UI (web application)

https://github.com/BSI-Business-Systems-Integration-AG/trading-network/tree/features/matthiaszimmermann/jugch_talk_2017

Resources

https://www.ethereum.org/ https://github.com/ethereum/ https://docs.web3j.io/ https://www.eclipse.org/scout/

Summary

Blockchain Internet of decentralized trust Cool new technology

Technology is great for «unbanked»: Machines AND people Efficient trustless global exchange for values (and information) Distributed business models

Challenges Privacy Scalability (Bitcoin can do 7 tx/s) Energy consuption (Bitcoin power consumption ~ Ecuador) Maturity (blockchain still in it’s infancy) Regulatory (it’s a mess …)

Wrap-up

Thanks! «Blockchain, Ethereum and Business Applications»

Additional Material

Bitcoin Market Share

Bitcoin Mining Today

Mining-pools: Include many ASIC computers (PC way too slow) AntMiner: 10,000x faster than PC, burns 10x more electricity Energy Costs: # of hashes per KWh is central criteria + cooling(!) Hashing Power over the Years

10.4 x 1018 H/s

Bitcoin Energy Consumption Index

Bitcoin vs VISA Bitcoin compared to countries

The Challenge Mining clients build block candidates independently Several new blocks might be found at the «same» time Clients may receive new blocks that are inconsistent The local copy of the blockchain may have forks

The Solution The «true» blockchain is defined by the highest cumulative PoW (difficulty) By selecting the greatest-difficulty chain, eventual consensus is achieved Miner majority vote defines the true chain Miners «vote» for the true chain by deciding which block/fork to extend

Consensus Mechanism «Preventing Forks»

? ?

Financial Industry getting nervous …