grokking techtalk #17: introduction to blockchain

31
INTRODUCTION TO BLOCKCHAIN

Upload: grokking-vn

Post on 12-Apr-2017

404 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Grokking TechTalk #17: Introduction to blockchain

INTRODUCTION TO BLOCKCHAIN

Page 2: Grokking TechTalk #17: Introduction to blockchain

2

Agenda

1. What is a Blockchain?

2. Introduction to Ethereum

Page 3: Grokking TechTalk #17: Introduction to blockchain

3

1. WHAT IS A BLOCKCHAIN?

Page 4: Grokking TechTalk #17: Introduction to blockchain

4

FIRST, WHYDO WE CARE ABOUT BLOCKCHAINS?A blockchain allows for trustless transactions between multiple parties.Or, more importantly, it allows transactions without trust of a third party intermediary!

Page 5: Grokking TechTalk #17: Introduction to blockchain

5

BLOCKCHAIN = DISTRIBUTED LEDGER + CONSENSUS

Page 6: Grokking TechTalk #17: Introduction to blockchain

6

BLOCKCHAIN = DISTRIBUTED LEDGER + CONSENSUS

A list of transactions between accounts (a ledger) are stored on distributed “nodes”. New transactions are periodically added into a block. Nodes use an agreed upon protocol to reach consensus on when a new block is appended to the chain of previous blocks.

Page 7: Grokking TechTalk #17: Introduction to blockchain

7

A TRANSACTION THAT OCCURS BETWEEN ACCOUNTS

Transaction #399

Account A Account BE.g. Send 10 tokens

An example transaction could be:Account A will send 10 tokens to Account B

Page 8: Grokking TechTalk #17: Introduction to blockchain

8

A LEDGER IS A LIST OF TRANSACTIONS (GROUPED INTO BLOCKS)

LEDGERBlock #100 Last Block: #99

Transaction #399

Transaction #400

Transaction #401

Block #97Block #98

Block #99

Page 9: Grokking TechTalk #17: Introduction to blockchain

9

BLOCKS ARE CHAINED TOGETHER

LEDGERBlock #100 Last Block: #99

Transaction #399

Transaction #400

Block #97 Block #98 Block #99

The ledger is a chain of blocks! Each block is created with a pointer to the previous block creating a blockchain!

The ledger is a chain of blocks! Each block is created with a pointer to the previous block creating a blockchain!

Page 10: Grokking TechTalk #17: Introduction to blockchain

10

THE LEDGER IS COPIED AND DISTRIBUTED AMONG NODES

��

� �

Page 11: Grokking TechTalk #17: Introduction to blockchain

11

EACH NODE HAS A COPY OF THE LEDGER AND AT LEAST ONE OF THEM WILL CREATE THE NEXT BLOCK!

��

� �

�11

Page 12: Grokking TechTalk #17: Introduction to blockchain

12

EXAMPLE CONSENSUSPROTOCOL:PROOF OF WORKDifferent methods or protocols exist for distributed nodes to reach consensus

Page 13: Grokking TechTalk #17: Introduction to blockchain

13

NODES ATTEMPTING TO CREATE NEW BLOCKS ARE USUALLY CALLED “MINERS”

��

� �The first Miner to solve

a hard math problemcreates the next block

and is rewarded

Page 14: Grokking TechTalk #17: Introduction to blockchain

14

E.g. BitcoinMiners currently receive 12.5 BTC plus all included transaction fees

New block:Every ~10 minutes

THE MAJORITY OF PoW BLOCKCHAINS INCENTIVIZE MINERS WITH REWARDS

E.g. EthereumMiners currently receive 5 ETH plus all included gas fees (more on this shortly)

New block:Every ~15 seconds

Page 15: Grokking TechTalk #17: Introduction to blockchain

15

A BRIEF HISTORY OF BLOCKCHAINS

▸ 2008: Bitcoin and blockchain idea gifted to world by “Satoshi Nakamoto”

▸ 2009: Bitcoin client released (open source)▸ 2011: Litecoin, first “altcoin,” released (based

on bitcoin source code)▸ 2014: Ethereum whitepaper

released/crowdsale▸ 2015: Ethereum “Frontier” launched

Page 16: Grokking TechTalk #17: Introduction to blockchain

16

2.INTRODUCTION TO ETHEREUM

Page 17: Grokking TechTalk #17: Introduction to blockchain

17

WHAT IS ETHEREUM?

OPEN SOURCELike Bitcoin, Ethereum is a public blockchain no one controls or owns.

Page 18: Grokking TechTalk #17: Introduction to blockchain

18

WHAT IS ETHEREUM?

OPEN SOURCELike Bitcoin, Ethereum is a public blockchain no one controls or owns.

PROOF OF WORK CONSENSUSThe Ethereum Whitepaper specifies the PoW rules and 4+ major clients exist and run the “nodes”.

Page 19: Grokking TechTalk #17: Introduction to blockchain

19

WHAT IS ETHEREUM?

OPEN SOURCELike Bitcoin, Ethereum is a public blockchain no one controls or owns.

PROOF OF WORK CONSENSUSThe Ethereum Whitepaper specifies the PoW rules and 4+ major clients exist and run the “nodes”.

ETHEREUM VIRTUAL MACHINE (EVM)Transactions are more than just values, but “Turing” complete programs that run when blocks are processed by nodes.

Page 20: Grokking TechTalk #17: Introduction to blockchain

20

ETHEREUM VIRTUAL MACHINE

General PurposeSupports Bitcoin-like value transactions (e.g. send 10 ETH from account A to B) or more complex applications.

Page 21: Grokking TechTalk #17: Introduction to blockchain

21

ETHEREUM VIRTUAL MACHINE

General PurposeSupports Bitcoin-like value transactions (e.g. send 10 ETH from account A to B) or more complex applications.

Smart ContractsTuring complete languages (e.g. Solidity) allow the Ethereum transactions to be programmed to do different operations.

Page 22: Grokking TechTalk #17: Introduction to blockchain

22

ETHEREUM VIRTUAL MACHINE

General PurposeSupports Bitcoin-like value transactions (e.g. send 10 ETH from account A to B) or more complex applications.

Smart ContractsTuring complete languages (e.g. Solidity) allow the Ethereum transactions to be programmed to do different operations.

Decentralized Apps (DApps)GUIs for smart contracts allow users to interact in ways similar to web 2.0 (HTML/JS/CSS).

Page 23: Grokking TechTalk #17: Introduction to blockchain

23

THINK: WORLD COMPUTERThe Ethereum blockchain is the first “decentralized world computer” to ever exist!

Page 24: Grokking TechTalk #17: Introduction to blockchain

24

TRANSACTIONS AND CONTRACTS

Two types of Accounts▸ Externally owned accounts (controlled by

people/keys similar to Bitcoin)▸ Contract accounts (controlled by smart

contract code)

Page 25: Grokking TechTalk #17: Introduction to blockchain

25

TRANSACTIONS AND CONTRACTS

Transactions can include more than just value transfer; they can include programming or bytecode that does things (smart contracts)

Transaction #3512If (Account A == Member) && (Date >= 4Q):

Dividend = 25% the current value of Contract C:Transaction:

Contract C Account ASend Dividend

Page 26: Grokking TechTalk #17: Introduction to blockchain

26

TRANSACTIONS AND CONTRACTS

Submitting transactions and contracts to the blockchain has an associated “gas” cost paid in Ether based on the complexity of the operations.

Transaction #256If (Account A == Member) && (Date >= 4Q):

Dividend = 50% the current value of Contract C:Transaction:

Contract CSend Dividend

IF +70 GasAND +30 GasEQUAL? +40 GasDIVIDE +120 GasSEND +20 Gas

TOTAL COST = 280 Gas

Page 27: Grokking TechTalk #17: Introduction to blockchain

27

TRANSACTIONS AND CONTRACTS

LEDGERBlock #26 Last Block: #25

Transaction #256

Transaction #257

Transaction #258

Block #23Block #24

Block #25

Page 28: Grokking TechTalk #17: Introduction to blockchain

28

TRANSACTIONS AND CONTRACTS

Think of the Ethereum Ledger like a SPREADSHEETCells can just have a value or they can give the result of a macro/script.

Trans-action

Account A Account B Account C(Contract)

#256 10 10 0

#257 5 5 10

#258 10 5 Dividend(A)

Page 29: Grokking TechTalk #17: Introduction to blockchain

29

THIS IS AN EXAMPLE SMART CONTRACT WRITTEN IN SOLIDITY

contract MyToken { /* This creates an array with all balances */ mapping (address => uint256) public balanceOf;

/* Initializes contract with initial supply tokens to the creator of the contract */ function MyToken( uint256 initialSupply ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens }

/* Send coins */ function transfer(address _to, uint256 _value) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient }}

Page 30: Grokking TechTalk #17: Introduction to blockchain

30

USE CASES FOR DAPPS AND PROJECTS IN DEVELOPMENT

Decentralized ExchangeConvert between crypto-currencies and tokens EtherDelta, EtherEx

Prediction MarketUtilize the wisdom of the crowd to predict future eventsAugur, Gnosis

Distributed ComputingEnable users to lease out spare compute cycles (think: uber for your computer, dAWS)Golem

Identity ManagementRetain ownership of your online identity, metadata, and relationships.uPort

Crowd Sale PlatformCreate a custom token for trade, payment, customer loyalty, etc. and take it to market.Ethereum, Firstblood

Digital Asset ManagementManage, buy, sell physical objects cryptographically tied to digital tokens.Digix

Page 31: Grokking TechTalk #17: Introduction to blockchain

31

Thank you for your listening