blockchain 101 - introduction for developers

41
Blockchain 101 – Introduction for Developers Razi Rais |Microsoft @razibinrais www.razibinrais.com

Upload: razi-rais

Post on 22-Jan-2018

113 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Blockchain 101 - Introduction for Developers

Blockchain 101 – Introduction for Developers

Razi Rais |Microsoft

@razibinrais

www.razibinrais.com

Page 2: Blockchain 101 - Introduction for Developers

About Me

www.razibinrais.com

Page 3: Blockchain 101 - Introduction for Developers

Join THIS group!

Page 4: Blockchain 101 - Introduction for Developers

What we going to cover today?

{Developer Focus}

Page 5: Blockchain 101 - Introduction for Developers

What we NOT going to cover today?

Page 6: Blockchain 101 - Introduction for Developers

Level Set

Page 7: Blockchain 101 - Introduction for Developers

Crypto 101

� Hashing

� Public Key Encryption

Page 8: Blockchain 101 - Introduction for Developers

Hashing Function f(x)

What is Hashing?

Fixed Size Output Variable Size Input

Page 9: Blockchain 101 - Introduction for Developers

Hashing Function f(x)

What is Hashing?

Fixed Size Output Hash/Digest

Variable Size Input

Page 10: Blockchain 101 - Introduction for Developers

Hashing Function f(x)

Example:

I want to have a cup of coffee 3f7f81df1a1d31cc1af434b711bd8e33b1ce

HashInput

Page 11: Blockchain 101 - Introduction for Developers

Hashing Function f(x)

Similar input results in very different hash values

I want to have a cup of coffee 3f7f81df1a1d31cc1af434b711bd8e33b1ce

HashInput

I want to have a cup of coffee.3bf6ca1f84bccfbe63b23d08b6adfb630899

Page 12: Blockchain 101 - Introduction for Developers

Hashing Function f(x)

Also..

Hash

Strictly One Way

Page 13: Blockchain 101 - Introduction for Developers

Common Hashing Algorithms

Secure Hashing Algorithm (SHA)

SHA3 | SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128 and SHAKE256

SHA-2 |SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256

Keccak256 ß Ethereum uses it. Similar to SHA3 but..http://keccak.noekeon.org

MD2/4/5, SHAKE128/256/512. Many more explore http://emn178.github.io/online-tools/index.html

Page 14: Blockchain 101 - Introduction for Developers

Public Key Encryption

How to send messages secretly?

How to verify message source?

Page 15: Blockchain 101 - Introduction for Developers

Public Key Encryption

Key Generation Function f(x)

Key 1

Key 2Input

Page 16: Blockchain 101 - Introduction for Developers

Public Key Encryption

Key Generation Function f(x)

Key 1

Key 2Input

Page 17: Blockchain 101 - Introduction for Developers

Public Key Encryption

Rivest Shamir Adleman (RSA) | PKCS#1

Elliptic Curve Cryptography| ECDSA (secp256k1) | Others

Early Days| Homomorphic Encryption

Page 18: Blockchain 101 - Introduction for Developers

Public Key Encryption In Action!

Bob And Alice World Domination Plan

Page 19: Blockchain 101 - Introduction for Developers

Bob and Alice generates key pair

Bob’s Public

Key

Bob’s Private

Key

Bob generates a key pair

Alice’s Public

Key

Alice’s Private

Key

Alice generates a key pair

Page 20: Blockchain 101 - Introduction for Developers

Bob and Alice generates key pair

Bob’s Public

Key

Bob’s Private

Key

Bob generates a key pair

Alice’s Public

Key

Alice’s Private

Key

Alice generates a key pair

Page 21: Blockchain 101 - Introduction for Developers

Bob and Alice share their Public Keys

Bob’s Private

Key

Bob share his public key with Alice.

Bob’s Public

Key

Alice’s Public

Key

Alice’s Private

Key

Alice share her public key with Bob.Alice’s Public

Key

Bob’s Public

Key

Page 22: Blockchain 101 - Introduction for Developers

Great!

Bob And Alice Lets send messages secretly!

Page 23: Blockchain 101 - Introduction for Developers

Alice and Bob encrypted message exchange

Q198$2#(*NEncryption Function

Bob’s Public

Key

Decryption Function

Bob’s Private

Key

Anarchy

Alice

Anarchy

BobEvil (Eve)

Page 24: Blockchain 101 - Introduction for Developers

Bob has a concern?

How do I know that message was send by Alice and not Eve?

Page 25: Blockchain 101 - Introduction for Developers

How about we do this….

(1) Hash the Message(2) Sign the Message | Alice’s Private Key

(3) Encrypt Message | Bob’s Public Key

(4) Send All of Above to Bob

(1) Decrypt Message | Bob’s Private Key(2) Verify Signature | Alice’s Public Key

(3) Alice’s Message Hash == Bob’s Message Hash

(4) All of above works? we are good!

Alice

Bob

Page 26: Blockchain 101 - Introduction for Developers

How about we do this….

(1) Hash the Message(2) Sign the Message | Alice’s Private Key

(3) Encrypt Message | Bob’s Public Key

(4) Send All of Above to Bob

(1) Decrypt Message | Bob’s Private Key(2) Verify Signature | Alice’s Public Key

(3) Alice’s Message Hash == Bob’s Message Hash

(4) All of above works? we are good!

Alice

Bob

Page 27: Blockchain 101 - Introduction for Developers

Signing + Hashing + Encryption

Evil (Eve)

Alice

Anarchy

Bob’s Public

Key

Alice’s Private Key

Hashing

Signing

BC1EFC

Encryption

HASH: BC1EFCSIG:0E#N8OOMSG: 0E#N8OO

Bob’s Private Key

Alice’s Public Key

Decryption

Verify Signature

Verify Hash BC1EFC == BC1EFC

HASH: BC1EFCSIG:0E#N8OOMSG: 0E#N8OO

Anarchy

Bob

Page 28: Blockchain 101 - Introduction for Developers

Eve …

I will find new ways.. Gradatim Ferociter

Evil (Eve)

Page 29: Blockchain 101 - Introduction for Developers

Blockchain - Core Concepts

Others ..

Page 30: Blockchain 101 - Introduction for Developers

Blockchain - Core Concepts

Visual Approach

Page 31: Blockchain 101 - Introduction for Developers

Ethereum

Project was bootstrapped in august 2014

Decentralized platform for Smart Contracts

Public/Private

www.ethereum.org/foundation

Page 32: Blockchain 101 - Introduction for Developers

Enterprise Ethereum Alliance

https://entethalliance.org/members

https://entethalliance.org/about

Page 33: Blockchain 101 - Introduction for Developers

Ethereum Accounts

Externally Owned Accounts | Contract Accounts

Page 34: Blockchain 101 - Introduction for Developers

Externally Owned Accounts (EOA)

Keyfile (JSON)

Public

Private

Account Address

Last 20 bytes of Public Key

Page 35: Blockchain 101 - Introduction for Developers

Never lose your private key!

Page 36: Blockchain 101 - Introduction for Developers

How to get started with Ethereum?

Tools | Truffle | Remix | Others

Software| Eth |Geth | Parity | Others

Test/Deployment | TestNet | Private | Public

Page 37: Blockchain 101 - Introduction for Developers

Transaction

Signed data package sent from an externally owned account to another account on the blockchain.

tx( recipient, sender-signature, value-in-ether, start-gas, gas-price)

Page 38: Blockchain 101 - Introduction for Developers

Transaction

DEMO

Page 39: Blockchain 101 - Introduction for Developers

Truffle

DEMO

Page 40: Blockchain 101 - Introduction for Developers

Smart Contract

{ code } + state<<Specific Address>>

EVM byte codeSolidity| High Level Language

LLL| Low level Language

Page 41: Blockchain 101 - Introduction for Developers

Smart Contract

DEMO