Slide 1

Slide 1 text

2 SFC / CSO [email protected] — 2 — 2017-02-08 – p.1/48

Slide 2

Slide 2 text

Proof of Work API — 2 — 2017-02-08 – p.2/48

Slide 3

Slide 3 text

1. 2. 3. 4. - 5. - 6. — 2 — 2017-02-08 – p.3/48

Slide 4

Slide 4 text

1. — 2 — 2017-02-08 – p.4/48

Slide 5

Slide 5 text

vs. ( ) http://www.post.japanpost.jp/service/letax/index.html https://e-naiyo.post.japanpost.jp/ ( ⇒ ) ( ) — 2 — 2017-02-08 – p.5/48

Slide 6

Slide 6 text

Satoshi Nakamoto, “Bitcoin: A Peer-to-Peer Electronic Cash System”, 2008 P2P http://bitcoin.org/ BTC (ISO XBT ) 2013 11 1BTC 10 — 2 — 2017-02-08 – p.6/48

Slide 7

Slide 7 text

2. — 2 — 2017-02-08 – p.7/48

Slide 8

Slide 8 text

(1) 2,100 cm3 1 1cm3 10 12.5cm3 ⇒ — 2 — 2017-02-08 – p.8/48

Slide 9

Slide 9 text

(2) ( ) ( ) ( ) ( ) → — 2 — 2017-02-08 – p.9/48

Slide 10

Slide 10 text

= or : → — 2 — 2017-02-08 – p.10/48

Slide 11

Slide 11 text

3. — 2 — 2017-02-08 – p.11/48

Slide 12

Slide 12 text

- — 2 — 2017-02-08 – p.12/48

Slide 13

Slide 13 text

- RSA, DSA, ECDSA ( DSA) ( RSA) PKI — 2 — 2017-02-08 – p.13/48

Slide 14

Slide 14 text

4. - — 2 — 2017-02-08 – p.14/48

Slide 15

Slide 15 text

— 2 — 2017-02-08 – p.15/48

Slide 16

Slide 16 text

(1) (= ) → — 2 — 2017-02-08 – p.16/48

Slide 17

Slide 17 text

(2) M A 60BTC (SegWit . . . ) — 2 — 2017-02-08 – p.17/48

Slide 18

Slide 18 text

— 2 — 2017-02-08 – p.18/48

Slide 19

Slide 19 text

1. 10 ( ) 2. 3. 1 — 2 — 2017-02-08 – p.19/48

Slide 20

Slide 20 text

End-to-End ( ) ( ) — 2 — 2017-02-08 – p.20/48

Slide 21

Slide 21 text

— 2 — 2017-02-08 – p.21/48

Slide 22

Slide 22 text

21 ( 4 ) ( ) 2,100 BTC 1 1 BTC 2140 20,999,999.9769 BTC — 2 — 2017-02-08 – p.22/48

Slide 23

Slide 23 text

— 2 — 2017-02-08 – p.23/48

Slide 24

Slide 24 text

CPU → GPU → FPGA → ASIC ( ) → → — 2 — 2017-02-08 – p.24/48

Slide 25

Slide 25 text

— 2 — 2017-02-08 – p.25/48

Slide 26

Slide 26 text

POW ( ) Proof Of Work . . . — 2 — 2017-02-08 – p.26/48

Slide 27

Slide 27 text

(2014 2 ∼2016 1 ) — 2 — 2017-02-08 – p.27/48

Slide 28

Slide 28 text

( ) — 2 — 2017-02-08 – p.28/48

Slide 29

Slide 29 text

5. - — 2 — 2017-02-08 – p.29/48

Slide 30

Slide 30 text

Transaction Data Structure Field Description Size (bytes) Version Currently 1 4 # of inputs Positive var-int 1∼9 List of inputs Variable # of outputs Positive var-int 1∼9 List of outputs Variable Lock time 4 Lock time is used for micropayment channels, for example — 2 — 2017-02-08 – p.30/48

Slide 31

Slide 31 text

Output Data Structure Field Description Size (bytes) Amount Value in 10−8BTC 8 Script length Positive var-int 1∼9 Script Variable — 2 — 2017-02-08 – p.31/48

Slide 32

Slide 32 text

Input Data Structure Field Description Size (bytes) Referred TX Double SHA-256 value 32 Referred output Index of the output 4 Script length Positive var-int 1∼9 Script Variable Sequence # 4 — 2 — 2017-02-08 – p.32/48

Slide 33

Slide 33 text

Major Script Operators Operator Code Description OP_0 0 Push 0 byte N/A 1∼0x4b Push # bytes OP_PUSHDATA1 0x4c Push length specified by 1-byte suffix OP_PUSHDATA2 0x4d Push length specified by 2-byte suffix OP_PUSHDATA4 0x4e Push length specified by 4-byte suffix OP_NOP 0x61 Do nothing OP_VERIFY 0x69 TX invalid if not true OP_RETURN 0x6a Fail immediately (unspendable) OP_DUP 0x76 Copy 1 item OP_EQUAL 0x87 If 2 items match OP_EQUALVERIFY 0x88 OP_EQUAL → OP_VERIFY OP_HASH160 0xa9 Apply SHA-256→RIPEMD-160 OP_CHECKSIG 0xac If signature for TX verified OP_CHECKMULTISIG 0xae If multiple signatures for TX verified Script is a stack-oriented language with postfix notation — 2 — 2017-02-08 – p.33/48

Slide 34

Slide 34 text

Script (General) Output: OP_DUP OP_HASH160 OP_PUSHDATA* OP_EQUALVERIFY OP_CHECKSIG Input: OP_PUSHDATA* OP_PUSHDATA* TX output addressed to a public-key digest and referring input — 2 — 2017-02-08 – p.34/48

Slide 35

Slide 35 text

Script Processing Concatinates scripts: input → output Stack-based processing — 2 — 2017-02-08 – p.35/48

Slide 36

Slide 36 text

Script (Generation) Output: OP_PUSHDATA* OP_CHECKSIG Input: OP_PUSHDATA* Gen. TX otuput and referring input No need to specify public key by its digest Can avoid compromising security down to 160bit — 2 — 2017-02-08 – p.36/48

Slide 37

Slide 37 text

Block Data Structure Field Description Size (bytes) Block header 6 items 80 # of TXs Positive var-int 1∼9 List of TXs Variable — 2 — 2017-02-08 – p.37/48

Slide 38

Slide 38 text

Block Header Data Structure Field Description Size (bytes) Version 4 Digest Double SHA-256 value 32 Merkle root Double SHA-256 value 32 Time Seconds (since 1970-01-01T00:00 UTC) 4 Target Compressed format 4 Nonce Appropriate value 4 Merkle root is the digest of all TXs — 2 — 2017-02-08 – p.38/48

Slide 39

Slide 39 text

Merkle Tree Digest = double SHA-256 value Existence of a TX can be verified if a relevant subtree is provided — 2 — 2017-02-08 – p.39/48

Slide 40

Slide 40 text

Networking No structure All TCP, default port number: 8333 IPv6 supported since v0.7 of reference implementation (v0.13.2 as of Feb. 2017) Can use IPv4, IPv6 or Tor In reference implementation (as of v0.9) Max # of outbound connections : 8 Max # of all connections : 125 (by default) Only one outbound connection to an address group High 16bit in IPv4 High 32bit in IPv6 — 2 — 2017-02-08 – p.40/48

Slide 41

Slide 41 text

Major Messages Category Name Function Connection version Sends version and block # verack Acknowledges version addr (address) Sends list of IP address/port # getaddr Requests addr Data inv (inventory) Sends (new) blocks and/or txs transfer getblocks Requests inv for all blocks within range getdata Requests block/tx by the digest block Sends block replying to getdata tx (transaction) Sends tx replying to getdata Header getheaders Requests headers for all blocks within range transfer headers Sends block headers up to 2,000 Others alert Broadcasts alert ping Confirms connection pong Acknowledges ping — 2 — 2017-02-08 – p.41/48

Slide 42

Slide 42 text

Message Structure Field Description Size (bytes) Magic number 0xd9b4bef9 4 Command Message name (ASCII string) 12 Payload length Size of payload in bytes 4 Checksum Double SHA-256 value of payload First 4 Payload Message data Variable All integers are encoded in Little Endian except IP address and port # We’ve just seen the payloads for block and tx messages — 2 — 2017-02-08 – p.42/48

Slide 43

Slide 43 text

DNS Seed seed.bitcoin.sipa.be dnsseed.bluematt.me dnsseed.bitcoin.dashjr.org seed.bitcoinstats.com seed.bitnodes.io bitseed.xf2.org Maintained by volunteers None of these uses DNSSEC (as of v0.10) — 2 — 2017-02-08 – p.43/48

Slide 44

Slide 44 text

Transfer Protocol block message is handled in the same manner — 2 — 2017-02-08 – p.44/48

Slide 45

Slide 45 text

For more detail, see https://bitcoin.org/en/developer-reference — 2 — 2017-02-08 – p.45/48

Slide 46

Slide 46 text

6. — 2 — 2017-02-08 – p.46/48

Slide 47

Slide 47 text

BTC ( ) LTC ( ) DOGE ( ) ETH ( ) — 2 — 2017-02-08 – p.47/48

Slide 48

Slide 48 text

— 2 — 2017-02-08 – p.48/48