From 072d2f3cadeb1089c71e1ea35d9b489c77aed19b Mon Sep 17 00:00:00 2001 From: Matthew Hacker Date: Wed, 25 Nov 2015 16:13:53 -0500 Subject: [PATCH] updating passthroughs for htmlbook toolchain --- .gitignore | 1 - appdx-scriptops.asciidoc | 4 - atlas.json | 6 +- author_bio.html | 10 ++ author_bio.xml | 11 -- ch01.asciidoc | 4 - ch03.asciidoc | 270 +++++++++++++++++++++++++-------------- ch04.asciidoc | 17 +-- ch05.asciidoc | 2 +- ch07.asciidoc | 8 +- ch09.asciidoc | 4 +- colo.asciidoc | 12 -- colo.html | 13 ++ copyright.html | 12 +- preface.asciidoc | 28 ++-- tools/oneoffs/oneoff.css | 4 +- 16 files changed, 237 insertions(+), 169 deletions(-) create mode 100644 author_bio.html delete mode 100644 author_bio.xml delete mode 100644 colo.asciidoc create mode 100644 colo.html diff --git a/.gitignore b/.gitignore index 881a5259..599f7b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -*.html dump.asciidoc code/python-env *.csv diff --git a/appdx-scriptops.asciidoc b/appdx-scriptops.asciidoc index e9824662..495baa4b 100644 --- a/appdx-scriptops.asciidoc +++ b/appdx-scriptops.asciidoc @@ -164,10 +164,6 @@ |======= -++++ - -++++ - <> shows operator codes reserved for use by the internal script parser.(((range="endofrange", startref="ix_appdx-scriptops-asciidoc1")))(((range="endofrange", startref="ix_appdx-scriptops-asciidoc0"))) [[tx_script_ops_table_internal]] diff --git a/atlas.json b/atlas.json index 73d730ae..ecf8175a 100644 --- a/atlas.json +++ b/atlas.json @@ -23,8 +23,8 @@ "appdx-pycoin.asciidoc", "appdx-bx.asciidoc", "ix.html", - "author_bio.xml", - "colo.asciidoc" + "author_bio.html", + "colo.html" ], "formats": { "pdf": { @@ -64,4 +64,4 @@ "title": "Mastering Bitcoin", "print_isbn13": "9781449374044", "templating": false -} \ No newline at end of file +} diff --git a/author_bio.html b/author_bio.html new file mode 100644 index 00000000..2ffbae0b --- /dev/null +++ b/author_bio.html @@ -0,0 +1,10 @@ +
+

About the Author

+

Andreas M. Antonopoulos is a noted technologist and serial entrepreneur who has become one of the most well-known and well-respected figures in bitcoin. As an engaging public speaker, teacher, and writer, Andreas makes complex subjects accessible and easy to understand. As an advisor, he helps startups recognize, evaluate, and navigate security and business risks.

+ +

Andreas grew up with the Internet, starting his first company, an early BBS and proto-ISP, as a teenager in his home in Greece. He earned degrees in computer science, data communications, and distributed systems from University College London (UCL), recently ranked among the world’s top 10 universities. After moving to the US, Andreas co-founded and managed a successful technology research company, and in that role advised dozens of Fortune 500 company executives on networking, security, data centers, and cloud computing. More than 200 of his articles on security, cloud computing, and data centers have been published in print and syndicated worldwide. He holds two patents in networking and security.

+ +

In 1990, Andreas started teaching various IT topics in private, professional, and academic environments. He honed his speaking skills in front of audiences ranging in size from five executives in a boardroom to thousands of people in large conferences. With more than 400 speaking engagements under his belt he is considered a world-class and charismatic public speaker and teacher. In 2014, he was appointed as a teaching fellow with the University of Nicosia, the first university in the world to offer a masters degree in digital currency. In this role, he helped develop the curriculum and co-taught the Introduction to Digital Currencies course, offered as a massive open online course (MOOC) through the university.

+ +

As a bitcoin entrepreneur, Andreas has founded a number of bitcoin businesses and launched several community open source projects. He serves as an advisor to several bitcoin and cryptocurrency companies. He is a widely published author of articles and blog posts on bitcoin, a permanent host on the popular Let’s Talk Bitcoin podcast, and a frequent speaker at technology and security conferences worldwide.

+
diff --git a/author_bio.xml b/author_bio.xml deleted file mode 100644 index 6e16667f..00000000 --- a/author_bio.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Andreas M. Antonopoulos is a noted technologist and serial entrepreneur who has become one of the most well-known and well-respected figures in bitcoin. As an engaging public speaker, teacher, and writer, Andreas makes complex subjects accessible and easy to understand. As an advisor, he helps startups recognize, evaluate, and navigate security and business risks. - -Andreas grew up with the Internet, starting his first company, an early BBS and proto-ISP, as a teenager in his home in Greece. He earned degrees in computer science, data communications, and distributed systems from University College London (UCL), recently ranked among the world’s top 10 universities. After moving to the US, Andreas co-founded and managed a successful technology research company, and in that role advised dozens of Fortune 500 company executives on networking, security, data centers, and cloud computing. More than 200 of his articles on security, cloud computing, and data centers have been published in print and syndicated worldwide. He holds two patents in networking and security. - -In 1990, Andreas started teaching various IT topics in private, professional, and academic environments. He honed his speaking skills in front of audiences ranging in size from five executives in a boardroom to thousands of people in large conferences. With more than 400 speaking engagements under his belt he is considered a world-class and charismatic public speaker and teacher. In 2014, he was appointed as a teaching fellow with the University of Nicosia, the first university in the world to offer a masters degree in digital currency. In this role, he helped develop the curriculum and co-taught the Introduction to Digital Currencies course, offered as a massive open online course (MOOC) through the university. - -As a bitcoin entrepreneur, Andreas has founded a number of bitcoin businesses and launched several community open source projects. He serves as an advisor to several bitcoin and cryptocurrency companies. He is a widely published author of articles and blog posts on bitcoin, a permanent host on the popular Let’s Talk Bitcoin podcast, and a frequent speaker at technology and security conferences worldwide. - - \ No newline at end of file diff --git a/ch01.asciidoc b/ch01.asciidoc index 24d31c80..a83ab7af 100644 --- a/ch01.asciidoc +++ b/ch01.asciidoc @@ -193,10 +193,6 @@ Joe then enters the bitcoin value for the transaction, 0.10 bitcoin. He carefull If Alice has a smartphone or laptop with her, she will also be able to see the transaction. The bitcoin ledger—a constantly growing file that records every bitcoin transaction that has ever occurred—is public, meaning that all she has to do is look up her own address and see if any funds have been sent to it. She can do this quite easily at the((("blockchain.info website"))) blockchain.info website by entering her address in the search box. The website will show her a http://bit.ly/1u0FFKL[page] listing all the transactions to and from that address. If Alice is watching that page, it will update to show a new transaction transferring 0.10 bitcoin to her balance soon after Joe hits Send. -++++ - -++++ - .Confirmations **** ((("confirmation of transactions")))At first, Alice's address will show the transaction from Joe as "Unconfirmed." This means that the transaction has been propagated to the network but has not yet been included in the bitcoin transaction ledger, known as the blockchain. To be included, the transaction must be "picked up" by a miner and included in a block of transactions. Once a new block is created, in approximately 10 minutes, the transactions within the block will be accepted as "confirmed" by the network and can be spent. The transaction is seen by all instantly, but it is only "trusted" by all when it is included in a newly mined block. diff --git a/ch03.asciidoc b/ch03.asciidoc index 4f984dff..35aef667 100644 --- a/ch03.asciidoc +++ b/ch03.asciidoc @@ -597,10 +597,11 @@ Commands: +gettransaction+, +getrawtransaction+, +decoderawtransaction+ ++++ - -$ bitcoin-cli gettransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3 +
+$ bitcoin-cli gettransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66↵
+c309acbae2c14ae3
 
-
+
++++ [source,json] ---- @@ -629,35 +630,56 @@ Transaction IDs are not authoritative until a transaction has been confirmed. Ab The transaction form shown with the command +gettransaction+ is the simplified form. To retrieve the full transaction code and decode it, we will use two commands: +getrawtransaction+ and +decoderawtransaction+. First, +getrawtransaction+ takes the _transaction hash (txid)_ as a parameter and returns the full transaction as a "raw" hex string, exactly as it exists on the bitcoin network: ++++ - -$ bitcoin-cli getrawtransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3 - -0100000001d717279515f88e2f56ce4e8a31e2ae3e9f00ba1d0add648e80c480ea22e0c7d3000000008b483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5ceaffffffff02404b4c00000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac1f312906000000001976a914107b7086b31518935c8d28703d66d09b3623134388ac00000000 - +
+$ bitcoin-cli getrawtransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1f↵
+c66c309acbae2c14ae3
+
+0100000001d717279515f88e2f56ce4e8a31e2ae3e9f00ba1d0add648e80c480ea22e0c7d3000↵
+000008b483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0758e22↵
+7383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1bd193dfba2014↵
+104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b884ac5b5b6dede↵
+05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5ceaffffffff02404b4c0000000↵
+0001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac1f312906000000001976a9↵
+14107b7086b31518935c8d28703d66d09b3623134388ac00000000
+
++++ To decode this hex string, use the +decoderawtransaction+ command. Copy and paste the hex as the first parameter of +decoderawtransaction+ to get the full contents interpreted as a JSON data structure (for formatting reasons the hex string is shortened in the following example): ++++ - -$ bitcoin-cli decoderawtransaction 0100000001d717279515f88e2f56ce4e8a31e2ae3e9f00ba1d0add648e80c480ea22e0c7d3000000008b483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5ceaffffffff02404b4c00000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac1f312906000000001976a914107b7086b31518935c8d28703d66d09b3623134388ac00000000 - +
+$ bitcoin-cli decoderawtransaction 0100000001d717279515f88e2f56ce4e8a31e2ae3e↵
+9f00ba1d0add648e80c480ea22e0c7d3000000008b483045022100a4ebbeec83225dedead659b↵
+bde7da3d026c8b8e12e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1↵
+f2c975b192d34c5b9b2ac1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44↵
+fa59248be58ede65e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc7↵
+9e05dbfe5ceaffffffff02404b4c00000000001976a91407bdb518fa2e6089fd810235cf1100c↵
+9c13d1fd288ac1f312906000000001976a914107b7086b31518935c8d28703d66d09b36231343↵
+88ac00000000
+
++++ ++++ - +
 {
     "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3",
     "version" : 1,
     "locktime" : 0,
     "vin" : [
         {
-            "txid" : "d3c7e022ea80c4808e64dd0a1dba009f3eaee2318a4ece562f8ef815952717d7",
+            "txid" : "d3c7e022ea80c4808e64dd0a1dba009f3eaee2318a4ece562f8ef815↵
+952717d7",
             "vout" : 0,
             "scriptSig" : {
-                "asm" : "3045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1bd193dfba20104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea",
-                "hex": "483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea"
+                "asm" : "3045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e↵
+61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2↵
+ac1bd193dfba20104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4c4b↵
+884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea",
+                "hex": "483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e1↵
+2e61a2df0dd0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9↵
+b2ac1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e↵
+4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea"
             },
             "sequence" : 4294967295
         }
@@ -667,7 +689,8 @@ $ bitcoin-cli decoderawtransaction 0100000001d717279515f88e2f56ce4e8a31e2ae3e13d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c↵
+13d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -680,7 +703,8 @@ $ bitcoin-cli decoderawtransaction 0100000001d717279515f88e2f56ce4e8a31e2ae3e231343 OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 107b7086b31518935c8d28703d66d09b36↵
+231343 OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a914107b7086b31518935c8d28703d66d09b3623134388ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -691,7 +715,7 @@ $ bitcoin-cli decoderawtransaction 0100000001d717279515f88e2f56ce4e8a31e2ae3e
+
++++ The transaction decode shows all the components of this transaction, including the transaction inputs and outputs. In this case we see that the transaction that credited our new address with 50 millibits used one input and generated two outputs. The input to this transaction was the output from a previously confirmed transaction (shown as the vin txid starting with +d3c7+). The two outputs correspond to the 50 millibit credit and an output with change back to the sender. @@ -702,18 +726,20 @@ Once the transaction we received has been confirmed by inclusion in a block, the ++++ - -$ bitcoin-cli gettransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3 - +
+$ bitcoin-cli gettransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66↵
+c309acbae2c14ae3
+
++++ ++++ - +
 {
     "amount" : 0.05000000,
     "confirmations" : 1,
-    "blockhash" : "000000000000000051d2e759c63a26e247f185ecb7926ed7a6624bc31c2a717b",
+    "blockhash" : "000000000000000051d2e759c63a26e247f185ecb7926ed7a6624bc31c↵
+2a717b",
     "blockindex" : 18,
     "blocktime" : 1392660808,
     "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3",
@@ -728,7 +754,7 @@ $ bitcoin-cli gettransaction 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66
+
++++ Here, we see the new information in the entries +blockhash+ (the hash of the block in which the transaction was included), and +blockindex+ with value 18 (indicating that our transaction was the 18th transaction in that block). @@ -747,21 +773,24 @@ Commands: +getblock+, +getblockhash+ ++++ - -$ bitcoin-cli getblock 000000000000000051d2e759c63a26e247f185ecb7926ed7a6624bc31c2a717b true - +
+$ bitcoin-cli getblock 000000000000000051d2e759c63a26e247f185ecb7926ed7a6624b↵
+c31c2a717b true
+
++++ ++++ - +
 {
-    "hash" : "000000000000000051d2e759c63a26e247f185ecb7926ed7a6624bc31c2a717b",
+    "hash" : "000000000000000051d2e759c63a26e247f185ecb7926ed7a6624bc31c2a717↵
+b",
     "confirmations" : 2,
     "size" : 248758,
     "height" : 286384,
     "version" : 2,
-    "merkleroot" : "9891747e37903016c3b77c7a0ef10acf467c530de52d84735bd55538719f9916",
+    "merkleroot" : "9891747e37903016c3b77c7a0ef10acf467c530de52d84735bd555387↵
+19f9916",
     "tx" : [
         "46e130ab3c67d31d2b2c7f8fbc1ca71604a72e6bc504c8a35f777286c6d89bf0",
         "2d5625725b66d6c1da88b80b41e8c07dc5179ae2553361c96b14bcf1ce2c3868",
@@ -790,11 +819,14 @@ $ bitcoin-cli getblock 000000000000000051d2e759c63a26e247f185ecb7926ed7a6624b79e466",
-    "previousblockhash" : "0000000000000000177e61d5f6ba6b9450e0dade9f39c257b4d48b4941ac77e7",
-    "nextblockhash" : "0000000000000001239d2c3bf7f4c68a4ca673e434702a57da8fe0d829a92eb6"
-
-
+    "chainwork" : "000000000000000000000000000000000000000000001931d1658fc048↵
+79e466",
+    "previousblockhash" : "0000000000000000177e61d5f6ba6b9450e0dade9f39c257b4↵
+d48b4941ac77e7",
+    "nextblockhash" : "0000000000000001239d2c3bf7f4c68a4ca673e434702a57da8fe0↵
+d829a92eb6"
+
+
++++ The block contains 367 transactions and as you can see, the 18th transaction listed (+9ca8f9...+) is the txid of the one crediting 50 millibits to our address. The +height+ entry tells us this is the 286384th block in the blockchain. @@ -803,32 +835,34 @@ We can also retrieve a block by its block height using the +getblockhash+ comman ++++ - +
 $ bitcoin-cli getblockhash 0
 
 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
-
+
++++ Here, we retrieve the block hash of the "genesis block," the first block mined by Satoshi Nakamoto, at height zero. Retrieving this block shows: ++++ - -$ bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f - +
+$ bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1↵b60a8ce26f
+
++++ ++++ - +
 {
-    "hash" : "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
+    "hash" : "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26↵
+f",
     "confirmations" : 286388,
     "size" : 285,
     "height" : 0,
     "version" : 1,
-    "merkleroot" : "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
+    "merkleroot" : "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7af↵
+deda33b",
     "tx" : [
         "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
     ],
@@ -836,16 +870,18 @@ $ bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1010001",
-    "nextblockhash" : "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
+    "chainwork" : "0000000000000000000000000000000000000000000000000000000100↵
+010001",
+    "nextblockhash" : "00000000839a8e6886ab5951d76f411475428afc90947ee320161b↵
+bf18eb6048"
 }
-
+
++++ The +getblock+, +getblockhash+, and +gettransaction+ commands can be used to explore the blockchain database, programmatically. -==== Creating, Signing, and Submitting Transactions Based on pass:[Unspent Outputs] +==== Creating, Signing, and Submitting Transactions Based on pass:[Unspent Outputs] Commands: +listunspent+, +gettxout+, +createrawtransaction+, +decoderawtransaction+, +signrawtransaction+, +sendrawtransaction+ @@ -860,10 +896,11 @@ $ bitcoin-cli listunspent ++++ - +
 [
     {
-        "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3",
+        "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c↵
+14ae3",
         "vout" : 0,
         "address" : "1hvzSofGwT8cjb8JU7nBsCSfEVQX5u9CL",
         "account" : "",
@@ -872,7 +909,7 @@ $ bitcoin-cli listunspent
         "confirmations" : 7
     }
 ]
-
+
++++ We see that the transaction +9ca8f9...+ created an output (with vout index 0) assigned to the address +1hvzSo...+ for the amount of 50 millibits, which at this point has received seven confirmations. Transactions use previously created outputs as their inputs by referring to them by the previous txid and vout index. We will now create a transaction that will spend the 0th vout of the txid +9ca8f9...+ as its input and assign it to a new output that sends value to a new address. @@ -881,16 +918,18 @@ First, let's look at the specific output in more detail. We use +gettxout+ to ge ++++ - -$ bitcoin-cli gettxout 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3 0 - +
+$ bitcoin-cli gettxout 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309ac↵
+bae2c14ae3 0
+
++++ ++++ - +
 {
-    "bestblock" : "0000000000000001405ce69bd4ceebcdfdb537749cebe89d371eb37e13899fd9",
+    "bestblock" : "0000000000000001405ce69bd4ceebcdfdb537749cebe89d371eb37e13↵
+899fd9",
     "confirmations" : 7,
     "value" : 0.05000000,
     "scriptPubKey" : {
@@ -906,7 +945,7 @@ $ bitcoin-cli gettxout 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309ac
+
++++ What we see here is the output that assigned 50 millibits to our address +1hvz...+. To spend this output we will create a new transaction. First, let's make an address to which we will send the money: @@ -922,31 +961,42 @@ We will send 25 millibits to the new address +1LnfTn...+ we just created in our We use +createrawtransaction+ to create this transaction. As parameters to +createrawtransaction+ we provide the transaction input (the 50 millibit unspent output from our confirmed transaction) and the two transaction outputs (money sent to the new address and change sent back to the previous address): ++++ - -$ bitcoin-cli createrawtransaction '[{"txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3", "vout" : 0}]' '{"1LnfTndy3qzXGN19Jwscj1T8LR3MVe3JDb": 0.025, "1hvzSofGwT8cjb8JU7nBsCSfEVQX5u9CL": 0.0245}' - -0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000 - +
+$ bitcoin-cli createrawtransaction '[{"txid" : "9ca8f969bd3ef5ec2a8685660fdbf↵
+$ bitcoin-cli createrawtransaction '[{"txid" : "9ca8f969bd3ef5ec2a8685660fdbf↵
+7a8bd365524c2e1fc66c309acbae2c14ae3", "vout" : 0}]' '{"1LnfTndy3qzXGN19Jwscj1↵
+T8LR3MVe3JDb": 0.025, "1hvzSofGwT8cjb8JU7nBsCSfEVQX5u9CL": 0.0245}'
+
+0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000↵
+0000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a↵
+9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac0↵
+0000000
+
++++ The +createrawtransaction+ command produces a raw hex string that encodes the transaction details we supplied. Let's confirm everything is correct by decoding this raw string using the +decoderawtransaction+ command: ++++ - -$ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000 - +
+$ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bd↵
+a8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d↵
+90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa↵
+2e6089fd810235cf1100c9c13d1fd288ac00000000
+
++++ ++++ - +
 {
-    "txid" : "0793299cb26246a8d24e468ec285a9520a1c30fcb5b6125a102e3fc05d4f3cba",
+    "txid" : "0793299cb26246a8d24e468ec285a9520a1c30fcb5b6125a102e3fc05d4f3cb↵
+a",
     "version" : 1,
     "locktime" : 0,
     "vin" : [
         {
-            "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3",
+            "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acb↵
+ae2c14ae3",
             "vout" : 0,
             "scriptSig" : {
                 "asm" : "",
@@ -960,7 +1010,8 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bd6a9bcf OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a15↵
+6a9bcf OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -973,7 +1024,8 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bd3d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c1↵
+3d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -984,7 +1036,7 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bd
+
++++ That looks correct! Our new transaction "consumes" the unspent output from our confirmed transaction and then spends it in two outputs, one for 25 millibits to our new address and one for 24.5 millibits as change back to the original address. The difference of 0.5 millibits represents the transaction fee and will be credited to the miner who finds the block that includes our transaction. @@ -997,45 +1049,67 @@ As you might notice, the transaction contains an empty +scriptSig+ because we ha ==== ++++ - +
 $ bitcoin-cli walletpassphrase foo 360
-$ bitcoin-cli signrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000
-
+$ bitcoin-cli signrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8↵
+f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90↵
+d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e↵
+6089fd810235cf1100c9c13d1fd288ac00000000
+
++++ ++++ - +
 {
-    "hex" : "0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000",
+    "hex" : "0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53e↵
+bd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54↵
+e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af↵
+52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc512↵
+7ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88↵
+ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000",
     "complete" : true
 }
-
+
++++ The +signrawtransaction+ command returns another hex-encoded raw transaction. We decode it to see what changed, with +decoderawtransaction+: ++++ - -$ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000 - +
+$ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda↵
+8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c↵
+800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87↵
+e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac↵
+1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9b↵
+bd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100↵
+c9c13d1fd288ac00000000
+
++++ ++++ - +
 {
-    "txid" : "ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346",
+    "txid" : "ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b34↵
+6",
     "version" : 1,
     "locktime" : 0,
     "vin" : [
         {
-            "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3",
+            "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acb↵
+ae2c14ae3",
             "vout" : 0,
             "scriptSig" : {
-                "asm" : "304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a0601 03c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127",
-                "hex" : "47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127"
+                "asm" : "304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86↵
+a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e↵
+4af52051a0601 03c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5↵
+127",
+                "hex" : "47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d↵
+86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b27↵
+7e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71↵
+dc5127"
             },
             "sequence" : 4294967295
         }
@@ -1045,7 +1119,8 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda6a9bcf OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a15↵
+6a9bcf OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -1058,7 +1133,8 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda3d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
+                "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c1↵
+3d1fd2 OP_EQUALVERIFY OP_CHECKSIG",
                 "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac",
                 "reqSigs" : 1,
                 "type" : "pubkeyhash",
@@ -1069,7 +1145,7 @@ $ bitcoin-cli decoderawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda
+
++++ Now, the inputs used in the transaction contain a +scriptSig+, which is a digital signature proving ownership of address +1hvz...+ and removing the lock on the output so that it can be spent. The signature makes this transaction verifiable by any node in the bitcoin network. @@ -1077,17 +1153,25 @@ Now, the inputs used in the transaction contain a +scriptSig+, which is a digita Now it's time to submit the newly created transaction to the network. We do that with the command +sendrawtransaction+, which takes the raw hex string produced by +signrawtransaction+. This is the same string we just decoded: ++++ - -$ bitcoin-cli sendrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346 - +
+$ bitcoin-cli sendrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8↵
+f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c8↵
+00c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e↵
+3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1↵
+d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bb↵
+d68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c↵
+9c13d1fd288ac00000000ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584↵
+ac17b346
+
++++ The command +sendrawtransaction+ returns a _transaction hash (txid)_ as it submits the transaction on the network. We can now query that transaction ID with +gettransaction+: ++++ - -$ bitcoin-cli gettransaction ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346 - +
+$ bitcoin-cli gettransaction ae74538baa914f3799081ba78429d5d84f36a0127438e9f7↵
+21dff584ac17b346
+
++++ [source,json] diff --git a/ch04.asciidoc b/ch04.asciidoc index a41d838f..12ac27ab 100644 --- a/ch04.asciidoc +++ b/ch04.asciidoc @@ -112,7 +112,6 @@ $ bx seed | bx ec-new | bx ec-to-wif image::images/msbt_0402.png["ecc-curve"] Bitcoin uses a specific elliptic curve and set of mathematical constants, as defined in a standard called((("secp256k1 curve standard"))) +secp256k1+, established by the((("National Institute of Standards and Technology (NIST)"))) National Institute of Standards and Technology (NIST). The +secp256k1+ curve is defined by the following function, which produces an elliptic curve: - [latexmath] ++++ \begin{equation} @@ -292,10 +291,6 @@ image::images/msbt_0406.png["Base58CheckEncoding"] In bitcoin, most of the data presented to the user is Base58Check-encoded to make it compact, easy to read, and easy to detect errors. The version prefix in Base58Check encoding is used to create easily distinguishable formats, which when encoded in Base58 contain specific characters at the beginning of the Base58Check-encoded payload. These characters make it easy for humans to identify the type of data that is encoded and how to use it. This is what differentiates, for example, a Base58Check-encoded bitcoin address that starts with a 1 from a Base58Check-encoded private key WIF format that starts with a 5. Some example version prefixes and the resulting Base58 characters are shown in <>.((("Base58Check encoding","prefixes, listed"))) -++++ - -++++ - [[base58check_versions]] .Base58Check version prefix and encoded result examples [options="header"] @@ -358,10 +353,6 @@ Address: 1PRTTaJesdNovgne6Ehcdu1fpEdX7913CK <> shows the private key generated in these three formats. -++++ - -++++ - [[table_4-3]] .Example: Same key, different formats [options="header"] @@ -520,7 +511,7 @@ include::code/key-to-address-ecc-example.py[] .Running key-to-address-ecc-example.py ==== ++++ - +
 $ python key-to-address-ecc-example.py 
 Private Key (hex) is:  
  3aba4162c7251c891207b747840551a71939b0de081f85c4e44cf7c13e41daa6
@@ -543,7 +534,7 @@ Bitcoin Address (b58check) is:
  1thMirt546nngXqyPEz532S8fLwbozud8
 Compressed Bitcoin Address (b58check) is: 
  14cxpo3MBCYYWCgF74SWTdcmxipnGUsPw3
-
+
++++ ==== @@ -636,7 +627,7 @@ BIP0039 defines the creation of a mnemonic code and seed as a follows: The mnemonic code represents 128 to 256 bits, which are used to derive a longer (512-bit) seed through the use of the key-stretching function PBKDF2. The resulting seed is used to create a deterministic wallet and all of its derived keys. -Tables pass:[] and pass:[] show some examples of mnemonic codes and the seeds they produce. +Tables pass:[#table_4-6] and pass:[#table_4-7] show some examples of mnemonic codes and the seeds they produce. [[table_4-6]] .128-bit entropy mnemonic code and resulting seed @@ -1059,7 +1050,7 @@ image::images/msbt_0415.png[] ((("paper wallets","spending")))((("private keys","exposing with paper wallets")))Although you can deposit funds into a paper wallet several times, you should withdraw all funds only once, spending everything. This is because in the process of unlocking and spending funds some wallets might generate a change address if you spend less than the whole amount. Additionally, if the computer you use to sign the transaction is compromised, you risk exposing the private key. By spending the entire balance of a paper wallet only once, you reduce the risk of key compromise. If you need only a small amount, send any remaining funds to a new paper wallet in the same transaction. ==== -Paper wallets come in many designs and sizes, with many different features. Some are intended to be given as gifts and have seasonal themes, such as Christmas and New Year's themes. Others are designed for storage in a bank vault or safe with the private key hidden in some way, either with opaque scratch-off stickers, or folded and sealed with tamper-proof adhesive foil. Figures pass:[] through pass:[] show various examples of paper wallets with security and backup features. +Paper wallets come in many designs and sizes, with many different features. Some are intended to be given as gifts and have seasonal themes, such as Christmas and New Year's themes. Others are designed for storage in a bank vault or safe with the private key hidden in some way, either with opaque scratch-off stickers, or folded and sealed with tamper-proof adhesive foil. Figures pass:[#paper_wallet_bpw] through pass:[#paper_wallet_spw] show various examples of paper wallets with security and backup features. [[paper_wallet_bpw]] .An example of a paper wallet from bitcoinpaperwallet.com with the private key on a folding flap. diff --git a/ch05.asciidoc b/ch05.asciidoc index 8035431b..4d3937a9 100644 --- a/ch05.asciidoc +++ b/ch05.asciidoc @@ -377,7 +377,7 @@ The two scripts together would form the following combined validation script: When executed, this combined script will evaluate to TRUE if, and only if, the unlocking script matches the conditions set by the locking script. In other words, the result will be TRUE if the unlocking script has a valid signature from the cafe's private key that corresponds to the public key hash set as an encumbrance. -Figures pass:[] and pass:[] show (in two parts) a step-by-step execution of the combined script, which will prove this is a valid transaction.(((range="endofrange", startref="ix_ch05-asciidoc16")))(((range="endofrange", startref="ix_ch05-asciidoc15"))) +Figures pass:[#P2PubKHash1] and pass:[#P2PubKHash2] show (in two parts) a step-by-step execution of the combined script, which will prove this is a valid transaction.(((range="endofrange", startref="ix_ch05-asciidoc16")))(((range="endofrange", startref="ix_ch05-asciidoc15"))) [[P2PubKHash1]] .Evaluating a script for a P2PKH transaction (Part 1 of 2) diff --git a/ch07.asciidoc b/ch07.asciidoc index 07aae50b..5843c7c3 100644 --- a/ch07.asciidoc +++ b/ch07.asciidoc @@ -52,11 +52,11 @@ The nonce, difficulty target, and timestamp are used in the mining process and w [[block_hash]] === Block Identifiers: Block Header Hash and Block Height -((("blocks","header hash")))((("blocks","height")))((("blocks","identifiers")))The primary identifier of a block is its cryptographic hash, a digital fingerprint, made by hashing the block header twice through the SHA256 algorithm. The resulting 32-byte hash is called the((("block hash")))((("block header hash"))) _block hash_ but is more accurately the _block header hash_, pass:[because only the block header is used to compute it. For example,] +000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f+ is the block hash of the first bitcoin block ever created. The block hash identifies a block uniquely and unambiguously and can be independently derived by any node by simply hashing the block header. +((("blocks","header hash")))((("blocks","height")))((("blocks","identifiers")))The primary identifier of a block is its cryptographic hash, a digital fingerprint, made by hashing the block header twice through the SHA256 algorithm. The resulting 32-byte hash is called the((("block hash")))((("block header hash"))) _block hash_ but is more accurately the _block header hash_, pass:[because only the block header is used to compute it. For example,] +000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f+ is the block hash of the first bitcoin block ever created. The block hash identifies a block uniquely and unambiguously and can be independently derived by any node by simply hashing the block header. Note that the block hash is not actually included inside the block's data structure, neither when the block is transmitted on the network, nor when it is stored on a node's persistence storage as part of the blockchain. Instead, the block's hash is computed by each node as the block is received from the network. The block hash might be stored in a separate database table as part of the block's metadata, to facilitate indexing and faster retrieval of blocks from disk. -A second way to identify a block is by its position in the blockchain, called the((("block height"))) pass:[block height. The first block ever created is at block height 0 (zero) and is the] pass:[same block that was previously referenced by the following block hash] +000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f+. A block can thus be identified two ways: by referencing the block hash or by referencing the block height. Each subsequent block added "on top" of that first block is one position "higher" in the blockchain, like boxes stacked one on top of the other. The block height on January 1, 2014, was approximately 278,000, meaning there were 278,000 blocks stacked on top of the first block created in January 2009. +A second way to identify a block is by its position in the blockchain, called the((("block height"))) pass:[block height. The first block ever created is at block height 0 (zero) and is the] pass:[same block that was previously referenced by the following block hash] +000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f+. A block can thus be identified two ways: by referencing the block hash or by referencing the block height. Each subsequent block added "on top" of that first block is one position "higher" in the blockchain, like boxes stacked one on top of the other. The block height on January 1, 2014, was approximately 278,000, meaning there were 278,000 blocks stacked on top of the first block created in January 2009. Unlike the block hash, the block height is not a unique identifier. Although a single block will always have a specific and invariant block height, the reverse is not true—the block height does not always identify a single block. Two or more blocks might have the same block height, competing for the same position in the blockchain. This scenario is discussed in detail in the section <>. The block height is also not a part of the block's data structure; it is not stored within the block. Each node dynamically identifies a block's position (height) in the blockchain when it is received from the bitcoin network. The block height might also be stored as metadata in an indexed database table for faster retrieval. @@ -202,10 +202,6 @@ image::images/msbt_0705.png["merkle_tree_path"] The code in <> demonstrates the process of creating a merkle tree from the leaf-node hashes up to the root, using the libbitcoin library for some helper functions. -++++ - -++++ - [[merkle_example]] .Building a merkle tree ==== diff --git a/ch09.asciidoc b/ch09.asciidoc index f7873781..163ddf6e 100644 --- a/ch09.asciidoc +++ b/ch09.asciidoc @@ -1,5 +1,5 @@ [[ch9]] -== Alternative Chains, Currencies, pass:[and Applications] +== Alternative Chains, Currencies, pass:[and Applications] Bitcoin was the result of 20 years of research in distributed systems and currencies and brought a revolutionary new technology into the space: the decentralized consensus mechanism based on proof of work. This invention at the heart of bitcoin has ushered a wave of innovation in currencies, financial services, economics, distributed systems, voting systems, corporate governance, and contracts. @@ -354,4 +354,4 @@ else: === Future of Currencies -The future of cryptographic currencies overall is even brighter than the future of bitcoin. Bitcoin introduced a completely new form of decentralized organization and consensus that has spawned hundreds of incredible innovations. These inventions will likely affect broad sectors of the economy, from distributed systems science to finance, economics, currencies, central banking, and corporate governance. Many human activities that previously required centralized institutions or organizations to function as authoritative or trusted points of control can now be decentralized. The invention of the blockchain and consensus system will significantly reduce the cost of organization and coordination on large-scale systems, while removing opportunities for concentration of power, corruption, and regulatory capture. \ No newline at end of file +The future of cryptographic currencies overall is even brighter than the future of bitcoin. Bitcoin introduced a completely new form of decentralized organization and consensus that has spawned hundreds of incredible innovations. These inventions will likely affect broad sectors of the economy, from distributed systems science to finance, economics, currencies, central banking, and corporate governance. Many human activities that previously required centralized institutions or organizations to function as authoritative or trusted points of control can now be decentralized. The invention of the blockchain and consensus system will significantly reduce the cost of organization and coordination on large-scale systems, while removing opportunities for concentration of power, corruption, and regulatory capture. diff --git a/colo.asciidoc b/colo.asciidoc deleted file mode 100644 index 75b00e30..00000000 --- a/colo.asciidoc +++ /dev/null @@ -1,12 +0,0 @@ -[colophon] -= Colophon - -The animal on the cover of _Mastering Bitcoin_ is a leafcutter ant (__Atta colombica__). The leafcutter ant, a nongeneric name, are tropical, fungus-growing ants endemic to South and Central America, Mexico, and southern United States. Aside from humans, leafcutter ants form the largest and most complex animal societies on the planet. They are named for the way they chew leaves, which serve as nutrition for their fungal garden. - -Winged ants, both male and female, take part in a mass exit of their nest known as the _revoada_, or a nuptial flight. Females mate with multiple males to collect the 300 million sperm necessary to set up a colony. Females also store bits of the parental fungus garden mycelium in the infrabuccal pocket located in their oral cavity; they will use this to start their own fungal gardens. Once grounded, the female loses its wings and sets up an underground lair for her colony. The success rate for new queens is low: 2.5% establish a long-lived colony. - -Once a colony has matured, ants are divided into castes based on size, with each caste performing various functions. There are usually four castes: minims, the smallest workers that tend to the young and fungus gardens; minors, slightly larger than minima, are the first line of defense for the colony and patrol the surrounding terrain and attack enemies; mediae, the general foragers that cut leaves and bring back leaf fragments to the nest; and majors, the largest worker ants that act as soldiers, defending the nest from intruders. Recent research has shown that majors also clear main foraging trails and carry bulky items back to the nest. - -Many of the animals on O'Reilly covers are endangered; all of them are important to the world. To learn more about how you can help, go to http://animals.oreilly.com[animals.oreilly.com]. - -The cover image is from __Insects Abroad__. The cover fonts are URW Typewriter and Guardian Sans. The text font is Adobe Minion Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag's Ubuntu Mono. diff --git a/colo.html b/colo.html new file mode 100644 index 00000000..589a806a --- /dev/null +++ b/colo.html @@ -0,0 +1,13 @@ +
+

Colophon

+ +

The animal on the cover of Mastering Bitcoin is a leafcutter ant (Atta colombica). The leafcutter ant, a nongeneric name, are tropical, fungus-growing ants endemic to South and Central America, Mexico, and southern United States. Aside from humans, leafcutter ants form the largest and most complex animal societies on the planet. They are named for the way they chew leaves, which serve as nutrition for their fungal garden.

+ +

Winged ants, both male and female, take part in a mass exit of their nest known as the _revoada_, or a nuptial flight. Females mate with multiple males to collect the 300 million sperm necessary to set up a colony. Females also store bits of the parental fungus garden mycelium in the infrabuccal pocket located in their oral cavity; they will use this to start their own fungal gardens. Once grounded, the female loses its wings and sets up an underground lair for her colony. The success rate for new queens is low: 2.5% establish a long-lived colony.

+ +

Once a colony has matured, ants are divided into castes based on size, with each caste performing various functions. There are usually four castes: minims, the smallest workers that tend to the young and fungus gardens; minors, slightly larger than minima, are the first line of defense for the colony and patrol the surrounding terrain and attack enemies; mediae, the general foragers that cut leaves and bring back leaf fragments to the nest; and majors, the largest worker ants that act as soldiers, defending the nest from intruders. Recent research has shown that majors also clear main foraging trails and carry bulky items back to the nest.

+ +

Many of the animals on O'Reilly covers are endangered; all of them are important to the world. To learn more about how you can help, go to animals.oreilly.com.

+ +

The cover image is from Insects Abroad. The cover fonts are URW Typewriter and Guardian Sans. The text font is Adobe Minion Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag's Ubuntu Mono.

+
diff --git a/copyright.html b/copyright.html index 7de9e928..141b8bc7 100644 --- a/copyright.html +++ b/copyright.html @@ -5,7 +5,7 @@

Printed in the United States of America.

Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O'Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most - titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.

+ titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.

  • Editors: Mike Loukides and Allyson MacDonald
  • Production Editor: Melanie Yarbrough
  • @@ -22,8 +22,12 @@

    Revision History for the First Edition

      -
    • 2014-12-01: First release
    • -
    • 2015-03-06: Second release
    • +
    • 2014-12-01 + First release +
    • +
    • 2015-03-06 + Second release +

    See http://oreilly.com/catalog/errata.csp?isbn=9781449374044 for release details.

    @@ -32,7 +36,7 @@

    While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.

    diff --git a/preface.asciidoc b/preface.asciidoc index 7b03781a..7d61b8a2 100644 --- a/preface.asciidoc +++ b/preface.asciidoc @@ -62,39 +62,43 @@ We appreciate, but do not require, attribution. An attribution usually includes Some editions of this book are offered under an open source license, such as CC-BY-NC (creativecommons.org), in which case the terms of that license apply. -If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at pass:[permissions@oreilly.com]. +If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at pass:[permissions@oreilly.com]. === Safari® Books Online [role = "safarienabled"] [NOTE] ==== -pass:[Safari Books Online] is an on-demand digital library that delivers expert pass:[content] in both book and video form from the world’s leading authors in technology and business. +pass:[Safari Books Online] is an on-demand digital library that delivers expert pass:[content] in both book and video form from the world’s leading authors in technology and business. ==== Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. -Safari Books Online offers a range of pass:[product mixes] and pricing programs for pass:[organizations], pass:[government agencies], and pass:[individuals]. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens pass:[more]. For more information about Safari Books Online, please visit us pass:[online]. +++++ +

    Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

    + +

    Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

    +++++ === How to Contact Us Please address comments and questions concerning this book to the publisher: ++++ - -O’Reilly Media, Inc. -1005 Gravenstein Highway North -Sebastopol, CA 95472 -800-998-9938 (in the United States or Canada) -707-829-0515 (international or local) -707-829-0104 (fax) - +
      +
    • O’Reilly Media, Inc.
    • +
    • 1005 Gravenstein Highway North
    • +
    • Sebastopol, CA 95472
    • +
    • 800-998-9938 (in the United States or Canada)
    • +
    • 707-829-0515 (international or local)
    • +
    • 707-829-0104 (fax)
    • +
    ++++ We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at link:$$http://bit.ly/mastering_bitcoin$$[]. -To comment or ask technical questions about this book, send email to pass:[bookquestions@oreilly.com]. +To comment or ask technical questions about this book, send email to pass:[]. For more information about our books, courses, conferences, and news, see our website at link:$$http://www.oreilly.com$$[]. diff --git a/tools/oneoffs/oneoff.css b/tools/oneoffs/oneoff.css index aa41d5b6..7bc94437 100644 --- a/tools/oneoffs/oneoff.css +++ b/tools/oneoffs/oneoff.css @@ -1,7 +1,5 @@ @charset "UTF-8"; -@import "DYNAMIC CSS PLACEHOLDER"; - /*--------Put Your Custom CSS Rules Below--------*/ /*----Uncomment to turn on automatic code wrapping----*/ @@ -53,4 +51,4 @@ p.titlepageauthor { div.colophon { display: none; } -----*/ \ No newline at end of file +----*/