Introduction to Blockchain with an Ethereuem Hands-on

26
Introduction to Blockchain with an Ethereum Hands-on June 2016 01 by Johann Romefort

Transcript of Introduction to Blockchain with an Ethereuem Hands-on

Page 1: Introduction to Blockchain with an Ethereuem Hands-on

Introduction to Blockchain with an Ethereum Hands-on

June 2016

01by Johann Romefort

Page 2: Introduction to Blockchain with an Ethereuem Hands-on

About Johann• Tech Evangelist @Stylight

• 15+ years in tech

• In Germany for 2 years

• 7 years in San Francisco doing startups

• Organizer of many meetups

2

Page 3: Introduction to Blockchain with an Ethereuem Hands-on

Agenda - Introduction

3

• What is blockchain, what is Ethereum, and what about Bitcoin?

• Basic concepts of Ethereum:

• Ether

• Wallet

• Transactions, Blocks, Smart Contracts, ĐApps and The Ethereum Virtual Machine.

Page 4: Introduction to Blockchain with an Ethereuem Hands-on

Agenda - Hands-on

4

• Local, Test and Production blockchains. Let's browse them, and find transactions.

• How to get the first Ether in your wallet.

• Get a local Ethereum node running and make your first transaction.

• Write, compile and deploy a Smart Contract with Truffle.

• Invoke your Smart Contract and see your transactions.

• - Where is this going? A quick intro to the DAO and potential future use cases of the technology.

Page 5: Introduction to Blockchain with an Ethereuem Hands-on

What do you need?

5

• Terminal

• Code Editor

Page 6: Introduction to Blockchain with an Ethereuem Hands-on

What is blockchain?

6

• Blockchain is the technology behind bitcoin .

• Bitcoin was created in 2008 by Satoshi Nakamoto

• Ethereum is a blockchain 2.0 - it retains the same principles but add some new ones (like Smart Contracts)

Page 7: Introduction to Blockchain with an Ethereuem Hands-on

Blockchain principles

7

The Blockchain is a distributed public ledger. An ordered and timestamped record of transactions. This system is used to protect against double spending and modification of previous transaction records.

Page 8: Introduction to Blockchain with an Ethereuem Hands-on

What is a “Hash”?

8

A hash function is a type of mathematical function which turns data into a fingerprint of that data called a hash:

SHA-256 of “Hello from Microsoft”:

a11a19a7a180e0d0f5173fd89a77ff67fde082f59f75d157ca1aa3395411e30b

SHA-256 of “Hello from Microsoft!”:

d9b8515817907bdebfa29d4b7591f7336035ecf3bed3bedda93e2a9a10a0f896

Page 9: Introduction to Blockchain with an Ethereuem Hands-on

Properties of good Hashing functions

9

• Impossible to deduce the data from the hash

• Slight change to data modify the hash in a very unpredictable way

Page 10: Introduction to Blockchain with an Ethereuem Hands-on

What is a “Block”?

10

• Bundles transactions

• Containers previous block hash

• Blocks are linked through their hashes

• You can’t change the data in one block in the chain without changing the subsequent chain

• Unless you mine it all over again

Page 11: Introduction to Blockchain with an Ethereuem Hands-on

A few words about Mining

11

• Mining is computationally expensive (on purpose)

• Mining a block means guessing a hash that matches particular criteria

• Miners can’t change the transaction data, but only something called a “nonce”

• finding the right nonce that makes the hash of the block match a particular criteria is called the “proof of work”

Page 12: Introduction to Blockchain with an Ethereuem Hands-on

What can I do with a distributed immutable ledger?

12

• Cryptocurrencies

• Property titles

• Notarised acts

• Digital certificates

• And more

Page 13: Introduction to Blockchain with an Ethereuem Hands-on

A gentle introduction to Ethereum

Page 14: Introduction to Blockchain with an Ethereuem Hands-on

What’s Ethereum?

14

• Initially conceptualised in 2013 by Vitalik Buterin

• Development was crowdfunded and launched in July 2015

• “A Next-Generation Cryptocurrency and Decentralized Application Platform”

• Does not rely on the bitcoin blockchain

• Ether (ETH) is the “fuel” to operate the platform.

Page 15: Introduction to Blockchain with an Ethereuem Hands-on

What’s the Ethereum Wallet?

15

• Entry point in the Ethereum platform

• Holds your accounts

• Let you send/receive ETH

• Let you create / invoke Smart Contracts

Page 16: Introduction to Blockchain with an Ethereuem Hands-on

What’s a Transaction?

16

• In Ethereum’s world it’s an operation that writes data on the blockchain

• You have to pay a fee for each transactions you make

• the simplest transaction is sending ETH from one account to another

• More complicated transaction involve Smart Contracts

Page 17: Introduction to Blockchain with an Ethereuem Hands-on

What’s a Smart Contract?

17

• It’s code running on the Ethereum Virtual Machine

• A Smart Contract can hold Ether, write data to the blockchain and be invoked from another Smart Contract.

• It’s written using one of the supported language, most likely Solidity

Page 18: Introduction to Blockchain with an Ethereuem Hands-on

Hands-on!

June 2016

01

Page 19: Introduction to Blockchain with an Ethereuem Hands-on

Browsing the blockchain

19

• A few web interface available

• Ether.camp is great : https://live.ether.camp/

• Different chains for different purposes:

• Homestead: “production”

• Morden: Staging

• Local testrpc : https://github.com/ethereumjs/testrpc

Page 20: Introduction to Blockchain with an Ethereuem Hands-on

Writing a Smart Contract

20

• Language: Solidity (JS-like)

• Supports inheritance

• Compiled with Solc

• Can use tooling to compile and deploy

Page 21: Introduction to Blockchain with an Ethereuem Hands-on

Installing Geth

21

• https://github.com/ethereum/go-ethereum/releases

• Launching Geth:

$ geth --rpc \ --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "eth,web3" \ --unlock 0 \ console

Page 22: Introduction to Blockchain with an Ethereuem Hands-on

Truffle - A development framework for Ethereum

22

• https://github.com/ConsenSys/truffle

• Built-in contract compilation, linking, deployment

• Interactive console for managing deployed contracts

Page 23: Introduction to Blockchain with an Ethereuem Hands-on

Play around with Truffle

23

• List of commands

• Initialise a project

• Compile a contract

• Deploy a contract

• Make a call

• Make a transaction

• Build a front-end

Page 24: Introduction to Blockchain with an Ethereuem Hands-on

A few words on the DAO and recent events…

Page 25: Introduction to Blockchain with an Ethereuem Hands-on

Microsoft & Blockchain?

25

• Project Bletchey: Blockchain As A Service (BaaS)

• https://azure.microsoft.com/en-us/blog/bletchley-blockchain/

Page 26: Introduction to Blockchain with an Ethereuem Hands-on

Questions?