Programming Bitcoin : Learn How to Program Bitcoin from Scratch

個数:
  • ポイントキャンペーン

Programming Bitcoin : Learn How to Program Bitcoin from Scratch

  • 提携先の海外書籍取次会社に在庫がございます。通常9日~2週間で発送いたします。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合が若干ございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。

  • 提携先の海外書籍取次会社に在庫がございます。通常約2週間で発送いたします。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合が若干ございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 294 p.
  • 言語 ENG,ENG
  • 商品コード 9781492031499
  • DDC分類 658

Full Description


Dive into Bitcoin technology with this hands-on guide from one of the leading teachers on Bitcoin and Bitcoin programming. Author Jimmy Song shows Python programmers and developers how to program a Bitcoin library from scratch. You'll learn how to work with the basics, including the math, blocks, network, and transactions behind this popular cryptocurrency and its blockchain payment system. By the end of the book, you'll understand how this cryptocurrency works under the hood by coding all the components necessary for a Bitcoin library. Learn how to create transactions, get the data you need from peers, and send transactions over the network. Whether you're exploring Bitcoin applications for your company or considering a new career path, this practical book will get you started. Parse, validate, and create bitcoin transactions Learn how to use the Bitcoin Script smart contract language Work with exercises in each chapter to build a Bitcoin library from scratch Understand how to secure a blockchain by verifying proof of work Program Bitcoin using Python 3 and libraries including pycoin Understand how simplified payment verification and light wallets work Work with public-key cryptography and cryptographic primitives

Table of Contents

Foreword                                           xi
Preface xiii
1 Finite Fields 1 (18)
Learning Higher-Level Math 1 (1)
Finite Field Definition 2 (1)
Defining Finite Sets 3 (2)
Constructing a Finite Field in Python 3 (2)
Exercise 1 5 (1)
Modulo Arithmetic 5 (3)
Modulo Arithmetic in Python 7 (1)
Finite Field Addition and Subtraction 8 (2)
Exercise 2 9 (1)
Coding Addition and Subtraction in 9 (1)
Python
Exercise 3 10 (1)
Finite Field Multiplication and 10 (3)
Exponentiation
Exercise 4 11 (1)
Exercise 5 11 (1)
Coding Multiplication in Python 12 (1)
Exercise 6 12 (1)
Coding Exponentiation in Python 12 (1)
Exercise 7 13 (1)
Finite Field Division 13 (3)
Exercise 8 15 (1)
Exercise 9 16 (1)
Redefining Exponentiation 16 (1)
Conclusion 17 (2)
2 Elliptic Curves 19 (22)
Definition 19 (8)
Coding Elliptic Curves in Python 26 (1)
Exercise 1 27 (1)
Exercise 2 27 (1)
Point Addition 27 (4)
Math of Point Addition 31 (2)
Coding Point Addition 33 (2)
Exercise 3 34 (1)
Point Addition for When x1≠x2 35 (1)
Exercise 4 36 (1)
Coding Point Addition for When x1≠x2 36 (1)
Exercise 5 36 (1)
Point Addition for When P1 = P2 37 (1)
Exercise 6 38 (1)
Coding Point Addition for When P1 = P2 38 (1)
Exercise 7 39 (1)
Coding One More Exception 39 (1)
Conclusion 40 (1)
3 Elliptic Curve Cryptography 41 (32)
Elliptic Curves over Reals 41 (1)
Elliptic Curves over Finite Fields 42 (2)
Exercise 1 44 (1)
Coding Elliptic Curves over Finite Fields 44 (1)
Point Addition over Finite Fields 45 (2)
Coding Point Addition over Finite Fields - 47 (1)
Exercise 2 47 (1)
Exercise 3 47 (1)
Scalar Multiplication for Elliptic Curves 47 (3)
Exercise 4 49 (1)
Scalar Multiplication Redux 50 (1)
Mathematical Groups 51 (6)
Identity 51 (1)
Closure 52 (1)
Invertibility 53 (1)
Commutativity 54 (1)
Associativity 55 (1)
Exercise 5 56 (1)
Coding Scalar Multiplication 57 (1)
Defining the Curve for Bitcoin 58 (3)
Working with secp256kl 60 (1)
Public Key Cryptography 61 (1)
Signing and Verification 62 (10)
Inscribing the Target 63 (2)
Verification in Depth 65 (1)
Verifying a Signature 66 (1)
Exercise 6 67 (1)
Programming Signature Verification 67 (1)
Signing in Depth 68 (1)
Creating a Signature 68 (1)
Exercise 7 69 (1)
Programming Message Signing 70 (2)
Conclusion 72 (1)
4 Serialization 73 (14)
Uncompressed SEC Format 73 (2)
Exercise 1 75 (1)
Compressed SEC Format 75 (4)
Exercise 2 79 (1)
DER Signatures 79 (2)
Exercise 3 81 (1)
Base58 81 (4)
Transmitting Your Public Key 81 (2)
Exercise 4 83 (1)
Address Format 83 (1)
Exercise 5 84 (1)
WIF Format 84 (1)
Exercise 6 85 (1)
Big- and Little-Endian Redux 85 (1)
Exercise 7 86 (1)
Exercise 8 86 (1)
Exercise 9 86 (1)
Conclusion 86 (1)
5 Transactions 87 (16)
Transaction Components 87 (3)
Version 90 (1)
Exercise 1 90 (1)
Inputs 90 (6)
Parsing Script 95 (1)
Exercise 2 96 (1)
Outputs 96 (2)
Exercise 3 97 (1)
Locktime 98 (1)
Exercise 4 98 (1)
Exercise 5 98 (1)
Coding Transactions 99 (1)
Transaction Fee 100 (2)
Calculating the Fee 102 (1)
Exercise 6 102 (1)
Conclusion 102 (1)
6 Script 103 (26)
Mechanics of Script 103 (2)
How Script Works 105 (1)
Example Operations 105 (2)
Coding Opcodes 106 (1)
Exercise 1 107 (1)
Parsing the Script Fields 107 (4)
Coding a Script Parser and Serializer 108 (3)
Combining the Script Fields 111 (1)
Coding the Combined Instruction Set 111 (1)
Standard Scripts 111 (1)
P2pk 112 (6)
Coding Script Evaluation 115 (2)
Stack Elements Under the Hood 117 (1)
Exercise 2 118 (1)
Problems with p2pk 118 (2)
Solving the Problems with p2pkh 120 (4)
P2pkh 120 (4)
Scripts Can Be Arbitrarily Constructed 124 (4)
Exercise 3 127 (1)
Utility of Scripts 127 (1)
Exercise 4 127 (1)
SHA-1 Pinata 128 (1)
Conclusion 128 (1)
7 Transaction Creation and Validation 129 (14)
Validating Transactions 129 (7)
Checking the Spentness of Inputs 130 (1)
Checking the Sum of the Inputs Versus 130 (1)
the Sum of the Outputs
Checking the Signature 131 (4)
Exercise 1 135 (1)
Exercise 2 135 (1)
Verifying the Entire Transaction 135 (1)
Creating Transactions 136 (5)
Constructing the Transaction 136 (3)
Making the Transaction 139 (2)
Signing the Transaction 141 (1)
Exercise 3 141 (1)
Creating Your Own Transactions on testnet 141 (1)
Exercise 4 142 (1)
Exercise 5 142 (1)
Conclusion 142 (1)
8 Pay-to-Script Hash 143 (20)
Bare Multisig 143 (5)
Coding OP_CHECKMULTISIG 148 (1)
Exercise 1 148 (1)
Problems with Bare Multisig 148 (1)
Pay-to-Script-Hash (p2sh) 149 (7)
Coding p2sh 156 (5)
More Complicated Scripts 157 (1)
Addresses 157 (1)
Exercise 2 158 (1)
Exercise 3 158 (1)
p2sh Signature Verification 158 (3)
Exercise 4 161 (1)
Exercise 5 161 (1)
Conclusion 161 (2)
9 Blocks 163 (14)
Coinbase Transactions 164 (2)
Exercise 1 164 (1)
ScriptSig 165 (1)
BIP0034 165 (1)
Exercise 2 166 (1)
Block Headers 166 (4)
Exercise 3 167 (1)
Exercise 4 167 (1)
Exercise 5 167 (1)
Version 168 (1)
Exercise 6 169 (1)
Exercise 7 169 (1)
Exercise 8 169 (1)
Previous Block 169 (1)
Merkle Root 169 (1)
Timestamp 169 (1)
Bits 170 (1)
Nonce 170 (1)
Proof-of-Work 170 (6)
How a Miner Generates New Hashes 171 (1)
The Target 172 (1)
Exercise 9 173 (1)
Difficulty 173 (1)
Exercise 10 173 (1)
Checking That the Proof-of-Work Is 174 (1)
Sufficient
Exercise 11 174 (1)
Difficulty Adjustment 174 (2)
Exercise 12 176 (1)
Exercise 13 176 (1)
Conclusion 176 (1)
10 Networking 177 (12)
Network Messages 177 (2)
Exercise 1 179 (1)
Exercise 2 179 (1)
Exercise 3 179 (1)
Parsing the Payload 179 (2)
Exercise 4 181 (1)
Network Handshake 181 (1)
Connecting to the Network 181 (3)
Exercise 5 184 (1)
Getting Block Headers 184 (1)
Exercise 6 185 (1)
Headers Response 185 (3)
Conclusion 188 (1)
11 Simplified Payment Verification 189 (22)
Motivation 189 (1)
Merkle Tree 190 (1)
Merkle Parent 191 (1)
Exercise 1 192 (1)
Merkle Parent Level 192 (1)
Exercise 2 193 (1)
Merkle Root 193 (1)
Exercise 3 194 (1)
Merkle Root in Blocks 194 (1)
Exercise 4 195 (1)
Using a Merkle Tree 195 (2)
Merkle Block 197 (13)
Merkle Tree Structure 199 (1)
Exercise 5 199 (1)
Coding a Merkle Tree 199 (6)
The merkleblock Command 205 (1)
Exercise 6 206 (1)
Using Flag Bits and Hashes 206 (4)
Exercise 7 210 (1)
Conclusion 210 (1)
12 Bloom Filters 211 (10)
What Is a Bloom Filter? 211 (4)
Exercise 1 213 (1)
Going a Step Further 214 (1)
BIP0037 Bloom Filters 215 (1)
Exercise 2 216 (1)
Exercise 3 216 (1)
Loading a Bloom Filter 216 (1)
Exercise 4 217 (1)
Getting Merkle Blocks 217 (1)
Exercise 5 218 (1)
Getting Transactions of Interest 218 (2)
Exercise 6 220 (1)
Conclusion 220 (1)
13 Segwit 221 (26)
Pay-to-Witness-Pubkey-Hash (p2wpkh) 221 (2)
Transaction Malleability 222 (1)
Fixing Malleability 222 (1)
P2wpkh Transactions 223 (3)
P2sh-p2wpkh 226 (5)
Coding p2wpkh and p2sh-p2wpkh 231 (4)
Pay-to-Witness-Script-Hash (p2wsh) 235 (4)
P2sh-p2wsh 239 (5)
Coding p2wsh and p2sh-p2wsh 244 (2)
Other Improvements 246 (1)
Conclusion246 (1)
14 Advanced Topics and Next Steps 247 (4)
Suggested Topics to Study Next 247 (1)
Wallets 247 (1)
Payment Channels and Lightning Network 248 (1)
Contributing 248 (1)
Suggested Next Projects 249 (1)
Testnet Wallet 249 (1)
Block Explorer 249 (1)
Web Shop 249 (1)
Utility Library 250 (1)
Finding a Job 250 (1)
Conclusion 250 (1)
A. Solutions 251 (38)
Index 289