Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to Block Chain Bitcoin. Blocks ●Ethereum - block chain ●Dogecoin - block chain ●Ripple - not a block chain ●Stellar - not a block chain ●Bitcoin.

Similar presentations


Presentation on theme: "Intro to Block Chain Bitcoin. Blocks ●Ethereum - block chain ●Dogecoin - block chain ●Ripple - not a block chain ●Stellar - not a block chain ●Bitcoin."— Presentation transcript:

1 Intro to Block Chain Bitcoin

2 Blocks

3 ●Ethereum - block chain ●Dogecoin - block chain ●Ripple - not a block chain ●Stellar - not a block chain ●Bitcoin - definitely a block chain

4 Blocks Q. What makes a block chain? A. Blocks + Proof of Work/Mining

5 Consensus ●Paxos - Google’s chubby ●Raft - CoreOS etcd ●Proof of work - Bitcoin

6 Proof of Work A function which is hard to compute but easy to verify.

7 Proof of Work Example var target = '00'; var data = 'block chain u'; var result = ''; var nonce = 0; for(;;) { var f = crypto.createHash('sha256'); var h = f.update(data + ++nonce); result = h.digest('hex'); if (result.slice(0, target.length) == target) { break; } var check = crypto.createHash('sha256').update(data+nonce).digest('hex'); if (check.slice(0, target.length) == target) { console.log('Verified nonce='+nonce); }

8 Proof of Work ƒ(data,nonce) < 2^256 / difficulty

9 Block Creation

10 Coinbase Transactions If you proved the work you send yourself 25 BTC as a reward. You also get to collect fees.

11 Miners Are Important They decide which transactions make it into a block and ingest new BTC.

12 Addresses Private Key -> Public Key -> Address

13 Addresses ●Don’t contain 0 O I l (base58) ●Start with a 1 ●33 or 34 characters long ●Shorter and more recognizable than public key ●Might help if there is an ECDSA Attack ●Should be used only once

14 Private Key Storage ●If you lose your private key, the funds are forever gone

15 var bitcoin = require('bitcoinjs-lib'); var prv = bitcoin.ECKey.makeRandom() var pub = prv.pub; console.log('private=' + prv.toWIF()); console.log('public=' + pub.toHex()); console.log('address=' + pub.getAddress()); //Output: private=L44GNX8FAMENVyae31mK34p5mpSVGBfEW5xZvmVrD8gULNfTAv3Y public=02570b2cec80ac066f7ebbf3ac10f13710707525a5b2effca71c47b87ecd8b78cc address=19aHhFTKfH7Zuccjrkc4H1gkJNQJ8mC15Q Creating an Address

16 Transactions

17 Satoshi ●1 BTC = 100000000 Satoshis ●Minimum transactions size = 5430 Satoshis

18 Transaction Outputs ●Must consume entire value ●Value not consumed will be left as fee ●If an output isn’t named in an input, it is considered unspent ●You can be named in an output without consent

19 Standard Transaction Types ●P2PKH - Pay to Public Key Hash ●P2SH - Pay to Script Hash ●Multisig - Most people use P2SH ●Null Data - Store 40 arbitrary bytes ●Public Key - Most people use P2PKH

20 P2PKH Script Validation

21 Creating A Transaction var key = bitcoin.ECKey.fromWIF("L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy") var tx = new bitcoin.TransactionBuilder() tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0); tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000); tx.sign(0, key); console.log(tx.build().toHex());

22 Smart Contracts ●Arbitration using P2SH ●Wills & Inheritance using nLockTime ●Bets using Oracles and hashed scripts

23 Payment Requests ●Generate addresses on demand ●Meta-data for building the transaction

24 Software ●Libraries ●Full nodes ●SPV nodes ●Wire protocol

25 Bitcoin Core (bitcoind) ●C++ ●The original Bitcoin software ●Full node ●Stores data on disk ●JSON RPC ●Wallet code will most likely be pulled

26 btcd ●Go ●btcwire ●btcutil ●btcscript ●btcnet

27 bitcoinj ●Java ●Wallet features

28 bitcoinlib-js ●Node.js / Browser ●Really easy to use

29 APIs ●Unspents by address ●Transactions by address ●Transaction broadcasting ●Network propagation levels ●Push data

30 Resources ●reddit.com/r/bitcoin ●bitcoin.org/en/developer-guide ●bitcoin.org/en/development ●BIPS: github.com/bitcoin/bips ●Testnet ●http://blog.chain.com/post/92058053671/ios- 8-touch-id-wallet-demo


Download ppt "Intro to Block Chain Bitcoin. Blocks ●Ethereum - block chain ●Dogecoin - block chain ●Ripple - not a block chain ●Stellar - not a block chain ●Bitcoin."

Similar presentations


Ads by Google