Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
More Than You Need To Know About Bitcoin Technology
1. More Than You Need To Know About
Bitcoin Technology
Kenji Saito
Senior Visiting Researcher, Keio Research Institute at SFC
ks91@sfc.wide.ad.jp
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.1/46
2. And you are. . .?
Kenji Saito, Ph.D. (Media and Governance)
Senior Visiting Researcher of Keio Research Institute at SFC
Representative Director of Academy Camp
http://twitter.com/ks91020 http://www.facebook.com/ks91media
Doing research on the Internet and Society
Focus :
Human digital currencies and applications
Organizing camps for children in Fukushima
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.2/46
3. And you are. . .?
Kenji Saito, Ph.D. (Media and Governance)
Senior Visiting Researcher of Keio Research Institute at SFC
Representative Director of Academy Camp
http://twitter.com/ks91020 http://www.facebook.com/ks91media
Doing research on the Internet and Society
Focus :
Human digital currencies and applications
Organizing camps for children in Fukushima
! Well-connected in my mind
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.2/46
4. Bibliography (1)
“NEO in Wonderland”
(2009)
Genre:
“Sci-Fi Monetary Fantasy”
Digital currency that
changes money
Which creates a drama
Free English translation
http://grsj.jp/neo.pdf
(CC-BY-SA 3.0)
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.3/46
5. Bibliography (2)
“Now You Understand Bitcoin”
(2014)
Genre:
“Stealth Marketing”
Looks like a book on
Bitcoin. . .
A 180-degree different
concept
A Trojan horse
(that you can read)
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.4/46
6. Bibliography (3)
“The Internet Changes
‘Money’ ” (2014)
Genre:
“Short Story”
A fantasy on who Satoshi
Nakamoto is
And how the Internet
changes everything
And how quick a Uber
taxi comes
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.5/46
7. What’s Bitcoin?
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.6/46
8. What’s Bitcoin Anyway?
“What is needed is an electronic payment system
based on cryptographic proof instead of trust”
Satoshi Nakamoto, “Bitcoin: A Peer-to-Peer Electronic
Cash System”, 2008
As if putting the first button in the wrong hole
P2P digital currency developed based on the belief
http://bitcoin.org/
Hostility against inflation
Traded as a commodity
Made a fuss late 2013 when 1 BTC > 1,100 USD
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.7/46
9. Market Price (USD)
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.8/46
10. User Software (Wallet)
Easy transfer using QR code
Screenshots from “Bit Osaifu” by Mr. Hoshino
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.9/46
11. What’s Bitcoin System?
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.10/46
12. Beaker Model (1)
21 million cm
3 useless fluid
in a tank
Can use any number of
beakers that can measure
down to 1
100
,
000
,
000
3
cm
Every 10 minutes on average,
a selected party can scoop
25cm
3 (as of today) to their
beaker
Selected by a special
lottery
Winning tickets are in
everyone’s box
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.11/46
13. Beaker Model (2)
Can move fluids among
beakers with simple rules
The ‘selected party’ must
audit the moves and add
records in the ledger
Can have leftovers too
Sometimes, someone breaks
their beaker
Implemented above digitally
to call it a currency
! Bitcoin
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.12/46
14. Technology Basics
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.13/46
15. Basics - Cryptographic Hash Functions
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.14/46
16. Basics - Digital Signature
Assures the authenticity of the originator and the content
ECDSA (Elliptic Curve DSA) is used in Bitcoin
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.15/46
17. Overview
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.16/46
18. Overview of Bitcoin System
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.17/46
19. Realizing Digital Coins (1)
A referred output (=coin) is spent, and cannot be double-spent
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.18/46
20. Realizing Digital Coins (2)
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.19/46
21. What A Wallet Does
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.20/46
22. Maintaining the Blockchain
1. Miners collect correct transactions and each make a data
block, and participate in a lottery
2. Who won the lottery broadcasts the block as the new tail
3. Other miners, if they approve, go back to 1 to append a new
block to the blockchain
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.21/46
23. Transaction Chain
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.22/46
24. Quantitative Limit
Rewards (besides fees) are halved at every 210 thousand blocks
(about 4 years)
The limit is therefore 21 million BTC
Rewards (besides fees) will become none around year 2140,
because the smallest unit is 1
100
,
000
,
000BTC
20,999,999.9769 BTC in total to be exact
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.23/46
25. Mining (Lottery)
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.24/46
26. Miners’ Behaviour
Efficiency is pursued
Dedicated hardware rose
Mining costs
If the benefit is (expected to be) greater than the
cost, more miners join and more invest on the
hardware
If the benefit is (feared to be) less than the cost,
miners leave
Mining becomes collective, and mining becomes a
service
Easier for individuals to join and leave
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.25/46
27. Retargeting
A target is usually copied from the previous block
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.26/46
28. Proof Of Work
Nonce and the digest in a block prove a work has been done
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.27/46
29. State Machine of a Coin
Paler the arrows are, less probable they are actually taken
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.28/46
30. Overlapped State Machines
Major state transfers only
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.29/46
31. Technological Detail
Yes, those were just overview
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.30/46
32. Transaction Data Structure
Field Description Size (bytes)
Version Currently 1 4
# of inputs Positive var-int 19
List of inputs Variable
# of outputs Positive var-int 19
List of outputs Variable
Lock time 4
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.31/46
33. Output Data Structure
Field Description Size (bytes)
Amount Value in 10−8BTC 8
Script length Positive var-int 19
Script Variable
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.32/46
34. 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 19
Script Variable
Sequence # 4
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.33/46
35. Major Script Operators
Operator Code Description
OP_0 0 Push 0 byte
N/A 10x4b 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_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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.34/46
36. Script (General)
Output:
OP_DUP OP_HASH160
OP_PUSHDATA* Public-key digest
OP_EQUALVERIFY OP_CHECKSIG
Input:
OP_PUSHDATA* Signature
OP_PUSHDATA* Public key
TX output addressed to a public-key digest and referring
input
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.35/46
37. Script Processing
Concatinates scripts: input ! output
Stack-based processing
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.36/46
38. Script (Generation)
Output:
OP_PUSHDATA* Public key OP_CHECKSIG
Input:
OP_PUSHDATA* Signature
Gen. TX otuput and referring input
No need to specify public key by its digest
Can avoid compromising security down to 160bit
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.37/46
39. Block Data Structure
Field Description Size (bytes)
Block header 6 items 80
# of TXs Positive var-int 19
List of TXs Variable
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.38/46
40. 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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.39/46
41. Merkle Tree
Digest = double SHA-256 value
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.40/46
42. Networking
No structure
All TCP, default port number: 8333
IPv6 supported since v0.7 of reference
implementation (v0.9.3 as of Dec. 2014)
Can use IPv4, IPv6 or Tor
In reference implementation
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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.41/46
43. 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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.42/46
44. 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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.43/46
45. 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
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.44/46
46. Transfer Protocol
block message is handled in the same manner
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.45/46
47. Discussion
More Than You Need To Know About Bitcoin Technology — 2014-12-13 – p.46/46