diff --git a/appdx-pycoin.asciidoc b/appdx-pycoin.asciidoc index f70ef0e2..cf94efc4 100644 --- a/appdx-pycoin.asciidoc +++ b/appdx-pycoin.asciidoc @@ -20,9 +20,9 @@ $ ku create input : create network : Bitcoin -wallet key : xprv9s21ZrQH143K3LU5ctPZTBnb9kTjA5Su9DcWHvXJemiJBsY7VqXUG7hipgdWaU\ +wallet key : xprv9s21ZrQH143K3LU5ctPZTBnb9kTjA5Su9DcWHvXJemiJBsY7VqXUG7hipgdWaU m2nhnzdvxJf5KJo9vjP2nABX65c5sFsWsV8oXcbpehtJi -public version : xpub661MyMwAqRbcFpYYiuvZpKjKhnJDZYAkWSY76JvvD7FH4fsG3Nqiov2CfxzxY8\ +public version : xpub661MyMwAqRbcFpYYiuvZpKjKhnJDZYAkWSY76JvvD7FH4fsG3Nqiov2CfxzxY8 DGcpfT56AMFeo8M8KPkFMfLUtvwjwb6WPv8rY65L2q8Hz tree depth : 0 fingerprint : 9d9c6092 @@ -40,7 +40,7 @@ public pair y : 59807879657469774102040120298272207730921291736633247737077406 y as hex : 843a0f6ed9c0eb1962c74533795406914fe3f1957c5238951f4fe245a4fcd625 y parity : odd key pair as sec : 03a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322 - uncompressed : 04a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322\ + uncompressed : 04a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322 843a0f6ed9c0eb1962c74533795406914fe3f1957c5238951f4fe245a4fcd625 hash160 : 9d9c609247174ae323acfc96c852753fe3c8819d uncompressed : 8870d869800c9b91ce1eb460f4c60540f87c15d7 @@ -60,9 +60,9 @@ $ ku P:foo input : P:foo network : Bitcoin -wallet key : xprv9s21ZrQH143K31AgNK5pyVvW23gHnkBq2wh5aEk6g1s496M8ZMjxncCKZKgb5j\ +wallet key : xprv9s21ZrQH143K31AgNK5pyVvW23gHnkBq2wh5aEk6g1s496M8ZMjxncCKZKgb5j ZoY5eSJMJ2Vbyvi2hbmQnCuHBujZ2WXGTux1X2k9Krdtq -public version : xpub661MyMwAqRbcFVF9ULcqLdsEa5WnCCugQAcgNd9iEMQ31tgH6u4DLQWoQayvtS\ +public version : xpub661MyMwAqRbcFVF9ULcqLdsEa5WnCCugQAcgNd9iEMQ31tgH6u4DLQWoQayvtS VYFvXz2vPPpbXE1qpjoUFidhjFj82pVShWu9curWmb2zy tree depth : 0 fingerprint : 5d353a2e @@ -80,7 +80,7 @@ public pair y : 58994218069605424278320703250689780154785099509277691723126325 y as hex : 826d8b4d3010aea16ff4c1c1d3ae68541d9a04df54a2c48cc241c2983544de52 y parity : even key pair as sec : 02b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f - uncompressed : 04b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f\ + uncompressed : 04b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f 826d8b4d3010aea16ff4c1c1d3ae68541d9a04df54a2c48cc241c2983544de52 hash160 : 5d353a2ecdb262477172852d57a3f11de0c19286 uncompressed : e5bd3a7e6cb62b4c820e51200fb1c148d79e67da @@ -244,7 +244,7 @@ public pair y : 32670510020758816978083085130507043184471273380659243275938904 y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 @@ -271,7 +271,7 @@ public pair y : 3267051002075881697808308513050704318447127338065924327593890 y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 @@ -295,7 +295,7 @@ From public pair (on Testnet): ---- $ ku -nT 55066263022277343669578718895168534326250603453777594175500187360389116729240,even -input : 550662630222773436695787188951685343262506034537775941755001873603\ +input : 550662630222773436695787188951685343262506034537775941755001873603 89116729240,even network : Bitcoin testnet public pair x : 55066263022277343669578718895168534326250603453777594175500187360389116729240 @@ -304,7 +304,7 @@ public pair y : 326705100207588169780830851305070431844712733806592432 y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 diff --git a/ch02.asciidoc b/ch02.asciidoc index a4ededf7..bb24152d 100644 --- a/ch02.asciidoc +++ b/ch02.asciidoc @@ -43,9 +43,9 @@ image::images/msbt_0202.png["payment-request"] [[payment-request-URL]] .The payment request QR code encodes the following URL, defined in BIP0021: ---- -bitcoin:1GdK9UzpHBzqzX2A9JFP3Di4weBwqgmoQA?\ -amount=0.015&\ -label=Bob%27s%20Cafe&\ +bitcoin:1GdK9UzpHBzqzX2A9JFP3Di4weBwqgmoQA? +amount=0.015& +label=Bob%27s%20Cafe& message=Purchase%20at%20Bob%27s%20Cafe Components of the URL diff --git a/ch03.asciidoc b/ch03.asciidoc index df9ac5da..c1b207a9 100644 --- a/ch03.asciidoc +++ b/ch03.asciidoc @@ -645,13 +645,13 @@ $ bitcoin-cli decoderawtransaction 0100000001d717...388ac00000000 "txid" : "d3c7e022ea80c4808e64dd0a1dba009f3eaee2318a4ece562f8ef815952717d7", "vout" : 0, "scriptSig" : { - "asm" : "3045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0\ - 758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1b\ - d193dfba201 04793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4\ + "asm" : "3045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0dd0 + 758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac1b + d193dfba201 04793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede65e4 c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea", - "hex" : "483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0d\ - d0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac\ - 1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede6\ + "hex" : "483045022100a4ebbeec83225dedead659bbde7da3d026c8b8e12e61a2df0d + d0758e227383b302203301768ef878007e9ef7c304f70ffaf1f2c975b192d34c5b9b2ac + 1bd193dfba2014104793ac8a58ea751f9710e39aad2e296cc14daa44fa59248be58ede6 5e4c4b884ac5b5b6dede05ba84727e34c8fd3ee1d6929d7a44b6e111d41cc79e05dbfe5cea" }, "sequence" : 4294967295 @@ -662,7 +662,7 @@ $ bitcoin-cli decoderawtransaction 0100000001d717...388ac00000000 "value" : 0.05000000, "n" : 0, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2\ + "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2 OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac", "reqSigs" : 1, @@ -676,7 +676,7 @@ $ bitcoin-cli decoderawtransaction 0100000001d717...388ac00000000 "value" : 1.03362847, "n" : 1, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 107b7086b31518935c8d28703d66d09b36231343\ + "asm" : "OP_DUP OP_HASH160 107b7086b31518935c8d28703d66d09b36231343 OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a914107b7086b31518935c8d28703d66d09b3623134388ac", "reqSigs" : 1, @@ -867,7 +867,7 @@ $ bitcoin-cli gettxout 9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae "confirmations" : 7, "value" : 0.05000000, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2\ + "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2 OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac", "reqSigs" : 1, @@ -894,24 +894,24 @@ 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, \ +$ bitcoin-cli createrawtransaction +'[{"txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3", "vout" : 0}]' +'{"1LnfTndy3qzXGN19Jwscj1T8LR3MVe3JDb": 0.025, "1hvzSofGwT8cjb8JU7nBsCSfEVQX5u9CL": 0.0245}' -0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c\ -0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd6810756\ -4a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d\ +0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c +0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd6810756 +4a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d 1fd288ac00000000 ---- 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 \ -0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c\ -0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd6810756\ -4a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d\ +$ bitcoin-cli decoderawtransaction +0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c +0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd6810756 +4a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d 1fd288ac00000000 ---- [source,json] @@ -936,7 +936,7 @@ $ bitcoin-cli decoderawtransaction \ "value" : 0.02500000, "n" : 0, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a156a9bcf\ + "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a156a9bcf OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac", "reqSigs" : 1, @@ -950,7 +950,7 @@ $ bitcoin-cli decoderawtransaction \ "value" : 0.02450000, "n" : 1, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2\ + "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2 OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac", "reqSigs" : 1, @@ -975,18 +975,18 @@ An encrypted wallet must be unlocked before a transaction is signed because sign ---- $ bitcoin-cli walletpassphrase foo 360 -$ bitcoin-cli signrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862a\ -ecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564\ +$ bitcoin-cli signrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862a +ecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564 a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000 ---- [source,json] ---- { - "hex" : "0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000\ -00006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f0\ -0149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88\ -ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9b\ -bd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac\ + "hex" : "0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000 +00006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f0 +0149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88 +ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9b +bd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac 00000000", "complete" : true } @@ -996,13 +996,13 @@ The +signrawtransaction+ command returns another hex-encoded raw transaction. We [source,bash] ---- -$ bitcoin-cli decoderawtransaction\ -0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c\ -000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76\ -d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051\ -a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ff\ -ffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88a\ -c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000\ +$ bitcoin-cli decoderawtransaction +0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c +000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76 +d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051 +a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ff +ffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88a +c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000 00 ---- [source,json] @@ -1016,13 +1016,13 @@ c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000\ "txid" : "9ca8f969bd3ef5ec2a8685660fdbf7a8bd365524c2e1fc66c309acbae2c14ae3", "vout" : 0, "scriptSig" : { - "asm" : "304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76\ - d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af5\ - 2051a0601 03c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71d\ + "asm" : "304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76 + d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af5 + 2051a0601 03c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71d c5127", - "hex" : "47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b\ - 76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4a\ - f52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c\ + "hex" : "47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b + 76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4a + f52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c 71dc5127" }, "sequence" : 4294967295 @@ -1033,7 +1033,7 @@ c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000\ "value" : 0.02500000, "n" : 0, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a156a9bcf\ + "asm" : "OP_DUP OP_HASH160 d90d36e98f62968d2bc9bbd68107564a156a9bcf OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac", "reqSigs" : 1, @@ -1047,7 +1047,7 @@ c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000\ "value" : 0.02450000, "n" : 1, "scriptPubKey" : { - "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2\ + "asm" : "OP_DUP OP_HASH160 07bdb518fa2e6089fd810235cf1100c9c13d1fd2 OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac", "reqSigs" : 1, @@ -1066,13 +1066,13 @@ 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\ -0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c\ -000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76\ -d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051\ -a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ff\ -ffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88a\ -c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000\ +$ bitcoin-cli sendrawtransaction +0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c +000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76 +d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051 +a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ff +ffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88a +c50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac000000 00 ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346 @@ -1081,7 +1081,7 @@ ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346 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 \ +$ bitcoin-cli gettransaction ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346 ---- [source,json] diff --git a/ch04.asciidoc b/ch04.asciidoc index 1e9cefca..82c43464 100644 --- a/ch04.asciidoc +++ b/ch04.asciidoc @@ -134,7 +134,7 @@ image::images/msbt_0403.png["ecc-over-F17-math"] So, for example, the following is a point P with coordinates (x,y) that is a point on the +secp256k1+ curve. You can check this yourself using Python: ---- -P = (55066263022277343669578718895168534326250603453777594175500187360389116729240,\ +P = (55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424) ---- @@ -534,7 +534,7 @@ $ sudo pip install ecdsa $ # Run the script $ python ec-math.py Secret: 38090835015954358862481132628887443905906204995912378278060168703580660294000 -EC point: (70048853531867179489857750497606966272382583471322935454624595540007269312627,\ +EC point: (70048853531867179489857750497606966272382583471322935454624595540007269312627, 105262206478686743191060800263479589329920209527285803935736021686045542353380) BTC public key: 029ade3effb0a67d5c8609850d797366af428f4a0d5194cb221d807770a1522873 ---- @@ -601,7 +601,7 @@ Tables pass:[] and pa |======= | *Entropy input (128 bits)*| 0c1e24e5917779d297e14d45f14e1a1a | *Mnemonic (12 words)* | army van defense carry jealous true garbage claim echo media make crunch -| *Seed (512 bits)* | 3338a6d2ee71c7f28eb5b882159634cd46a898463e9d2d0980f8e80dfbba5b0fa0291e5fb88\ +| *Seed (512 bits)* | 3338a6d2ee71c7f28eb5b882159634cd46a898463e9d2d0980f8e80dfbba5b0fa0291e5fb88 8a599b44b93187be6ee3ab5fd3ead7dd646341b2cdb8d08d13bf7 |======= @@ -611,7 +611,7 @@ Tables pass:[] and pa | *Entropy input (256 bits)* | 2041546864449caff939d32d574753fe684d3c947c3346713dd8423e74abcf8c | *Mnemonic (24 words)* | cake apple borrow silk endorse fitness top denial coil riot stay wolf luggage oxygen faint major edit measure invite love trap field dilemma oblige -| *Seed (512 bits)* | 3972e432e99040f75ebe13a660110c3e29d131a2c808c7ee5f1631d0a977fcf473bee22\ +| *Seed (512 bits)* | 3972e432e99040f75ebe13a660110c3e29d131a2c808c7ee5f1631d0a977fcf473bee22 fce540af281bf7cdeade0dd2c1c795bd02f1e4049e205a0158906c343 |======= @@ -800,20 +800,20 @@ Using the command-line tool +sx+, introduced in <>, you can ---- $ sx hd-seed > m # create a new master private key from a seed and store in file "m" $ cat m # show the master extended private key -xprv9s21ZrQH143K38iQ9Y5p6qoB8C75TE71NfpyQPdfGvzghDt39DHPFpovvtWZaRgY5uPwV7RpEgHs7cvd\ +xprv9s21ZrQH143K38iQ9Y5p6qoB8C75TE71NfpyQPdfGvzghDt39DHPFpovvtWZaRgY5uPwV7RpEgHs7cvd gfiSjLjjbuGKGcjRyU7RGGSS8Xa $ cat m | sx hd-pub 0 # generate the M/0 extended public key -xpub67xpozcx8pe95XVuZLHXZeG6XWXHpGq6Qv5cmNfi7cS5mtjJ2tgypeQbBs2UAR6KECeeMVKZBPLrtJun\ +xpub67xpozcx8pe95XVuZLHXZeG6XWXHpGq6Qv5cmNfi7cS5mtjJ2tgypeQbBs2UAR6KECeeMVKZBPLrtJun SDMstweyLXhRgPxdp14sk9tJPW9 $ cat m | sx hd-priv 0 # generate the m/0 extended private key -xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6\ +xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6 GoNMKUga5biW6Hx4tws2six3b9c $ cat m | sx hd-priv 0 | sx hd-to-wif # show the private key of m/0 as a WIF L1pbvV86crAGoDzqmgY85xURkz3c435Z9nirMt52UbnGjYMzKBUN $ cat m | sx hd-pub 0 | sx hd-to-address # show the bitcoin address of M/0 1CHCnCjgMNb6digimckNQ6TBVcTWBAmPHK $ cat m | sx hd-priv 0 | sx hd-priv 12 --hard | sx hd-priv 4 # generate m/0/12'/4 -xprv9yL8ndfdPVeDWJenF18oiHguRUj8jHmVrqqD97YQHeTcR3LCeh53q5PXPkLsy2kRaqgwoS6YZBLatRZR\ +xprv9yL8ndfdPVeDWJenF18oiHguRUj8jHmVrqqD97YQHeTcR3LCeh53q5PXPkLsy2kRaqgwoS6YZBLatRZR yUeAkRPe1kLR1P6Mn7jUrXFquUt ---- ==== diff --git a/ch05.asciidoc b/ch05.asciidoc index 7b83cdad..a0e8f3c8 100644 --- a/ch05.asciidoc +++ b/ch05.asciidoc @@ -175,9 +175,9 @@ If we run the _select-utxo.py_ script without a parameter, it will attempt to co ---- $ python select-utxo.py 50000000 For transaction amount 50000000 Satoshis (0.500000 bitcoin) use: -([<7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 with 25000000 Satoshis>, \ - <7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 with 16100000 Satoshis>, \ - <6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 with 16050000 Satoshis>],\ +([<7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 with 25000000 Satoshis>, + <7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 with 16100000 Satoshis>, + <6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 with 16050000 Satoshis>], 'Change: 7150000 Satoshis') ---- ==== @@ -373,7 +373,7 @@ The preceding locking script can be satisfied with an unlocking script of the fo The two scripts together would form the following combined validation script: ---- - OP_DUP OP_HASH160 \ + OP_DUP OP_HASH160 OP_EQUAL OP_CHECKSIG ---- @@ -441,7 +441,7 @@ The prefix +OP_0+ is required because of a bug in the original implementation of The two scripts together would form the combined validation script: ---- -OP_0 \ +OP_0 2 3 OP_CHECKMULTISIG ---- @@ -478,7 +478,7 @@ In <> we introduced Mohammed, an electronics importe The resulting script is quite long and looks like this: ---- -2 \ +2 5 OP_CHECKMULTISIG ---- @@ -509,24 +509,24 @@ Let's look at Mohammed's company, the complex multi-signature script, and the re First, the multi-signature script that Mohammed's company uses for all incoming payments from customers: ---- -2 \ +2 5 OP_CHECKMULTISIG ---- If the placeholders are replaced by actual public keys (shown here as 520-bit numbers starting with 04) you can see that this script becomes very long: ---- 2 -04C16B8698A9ABF84250A7C3EA7EEDEF9897D1C8C6ADF47F06CF73370\ -D74DCCA01CDCA79DCC5C395D7EEC6984D83F1F50C900A24DD47F569FD\ -4193AF5DE762C58704A2192968D8655D6A935BEAF2CA23E3FB87A3495\ -E7AF308EDF08DAC3C1FCBFC2C75B4B0F4D0B1B70CD2423657738C0C2B\ -1D5CE65C97D78D0E34224858008E8B49047E63248B75DB7379BE9CDA8\ -CE5751D16485F431E46117B9D0C1837C9D5737812F393DA7D4420D7E1\ -A9162F0279CFC10F1E8E8F3020DECDBC3C0DD389D99779650421D65CB\ -D7149B255382ED7F78E946580657EE6FDA162A187543A9D85BAAA93A4\ -AB3A8F044DADA618D087227440645ABE8A35DA8C5B73997AD343BE5C2\ -AFD94A5043752580AFA1ECED3C68D446BCAB69AC0BA7DF50D56231BE0\ -AABF1FDEEC78A6A45E394BA29A1EDF518C022DD618DA774D207D137AA\ +04C16B8698A9ABF84250A7C3EA7EEDEF9897D1C8C6ADF47F06CF73370 +D74DCCA01CDCA79DCC5C395D7EEC6984D83F1F50C900A24DD47F569FD +4193AF5DE762C58704A2192968D8655D6A935BEAF2CA23E3FB87A3495 +E7AF308EDF08DAC3C1FCBFC2C75B4B0F4D0B1B70CD2423657738C0C2B +1D5CE65C97D78D0E34224858008E8B49047E63248B75DB7379BE9CDA8 +CE5751D16485F431E46117B9D0C1837C9D5737812F393DA7D4420D7E1 +A9162F0279CFC10F1E8E8F3020DECDBC3C0DD389D99779650421D65CB +D7149B255382ED7F78E946580657EE6FDA162A187543A9D85BAAA93A4 +AB3A8F044DADA618D087227440645ABE8A35DA8C5B73997AD343BE5C2 +AFD94A5043752580AFA1ECED3C68D446BCAB69AC0BA7DF50D56231BE0 +AABF1FDEEC78A6A45E394BA29A1EDF518C022DD618DA774D207D137AA B59E0B000EB7ED238F4D800 5 OP_CHECKMULTISIG ---- diff --git a/ch08.asciidoc b/ch08.asciidoc index 59bd1307..d0f0fb58 100644 --- a/ch08.asciidoc +++ b/ch08.asciidoc @@ -208,7 +208,7 @@ The first transaction added to the block is a special transaction, called a _gen ==== [source, bash] ---- -$ bitcoin-cli getrawtransaction\ +$ bitcoin-cli getrawtransaction d5ada064c6417ca25c4308bd158c34b77e1c0eca2a73cda16c737e7424afba2f 1 ---- ==== @@ -219,8 +219,8 @@ $ bitcoin-cli getrawtransaction\ [source,json] ---- { - "hex" : "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff\ - 0f03443b0403858402062f503253482fffffffff0110c08d9500000000232102aa970c592640d19de03ff6f329d\ + "hex" : "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff + 0f03443b0403858402062f503253482fffffffff0110c08d9500000000232102aa970c592640d19de03ff6f329d 6fd2eecb023263b9ba5d1b81c29b523da8b21ac00000000", "txid" : "d5ada064c6417ca25c4308bd158c34b77e1c0eca2a73cda16c737e7424afba2f", "version" : 1, @@ -236,7 +236,7 @@ $ bitcoin-cli getrawtransaction\ "value" : 25.09094928, "n" : 0, "scriptPubKey" : { - "asm" : "02aa970c592640d19de03ff6f329d6fd2eecb023263b9ba5d1b81c29b523da8b21\ + "asm" : "02aa970c592640d19de03ff6f329d6fd2eecb023263b9ba5d1b81c29b523da8b21 OP_CHECKSIG", "hex" : "2102aa970c592640d19de03ff6f329d6fd2eecb023263b9ba5d1b81c29b523da8b21ac", "reqSigs" : 1, diff --git a/pycoin.asciidoc b/pycoin.asciidoc index 7f8bf3c6..24db91dd 100644 --- a/pycoin.asciidoc +++ b/pycoin.asciidoc @@ -42,9 +42,9 @@ Create a BIP32 Key using the default entropy sources of GPG and /dev/random: input : create network : Bitcoin - wallet key : xprv9s21ZrQH143K3LU5ctPZTBnb9kTjA5Su9DcWHvXJemiJBsY7VqXUG7hipgdWaU\ + wallet key : xprv9s21ZrQH143K3LU5ctPZTBnb9kTjA5Su9DcWHvXJemiJBsY7VqXUG7hipgdWaU m2nhnzdvxJf5KJo9vjP2nABX65c5sFsWsV8oXcbpehtJi - public version : xpub661MyMwAqRbcFpYYiuvZpKjKhnJDZYAkWSY76JvvD7FH4fsG3Nqiov2CfxzxY8\ + public version : xpub661MyMwAqRbcFpYYiuvZpKjKhnJDZYAkWSY76JvvD7FH4fsG3Nqiov2CfxzxY8 DGcpfT56AMFeo8M8KPkFMfLUtvwjwb6WPv8rY65L2q8Hz tree depth : 0 fingerprint : 9d9c6092 @@ -62,7 +62,7 @@ Create a BIP32 Key using the default entropy sources of GPG and /dev/random: y as hex : 843a0f6ed9c0eb1962c74533795406914fe3f1957c5238951f4fe245a4fcd625 y parity : odd key pair as sec : 03a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322 - uncompressed : 04a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322\ + uncompressed : 04a90b3008792432060fa04365941e09a8e4adf928bdbdb9dad41131274e379322 843a0f6ed9c0eb1962c74533795406914fe3f1957c5238951f4fe245a4fcd625 hash160 : 9d9c609247174ae323acfc96c852753fe3c8819d uncompressed : 8870d869800c9b91ce1eb460f4c60540f87c15d7 @@ -78,9 +78,9 @@ Create a BIP32 key from a passphrase: input : P:foo network : Bitcoin - wallet key : xprv9s21ZrQH143K31AgNK5pyVvW23gHnkBq2wh5aEk6g1s496M8ZMjxncCKZKgb5j\ + wallet key : xprv9s21ZrQH143K31AgNK5pyVvW23gHnkBq2wh5aEk6g1s496M8ZMjxncCKZKgb5j ZoY5eSJMJ2Vbyvi2hbmQnCuHBujZ2WXGTux1X2k9Krdtq - public version : xpub661MyMwAqRbcFVF9ULcqLdsEa5WnCCugQAcgNd9iEMQ31tgH6u4DLQWoQayvtS\ + public version : xpub661MyMwAqRbcFVF9ULcqLdsEa5WnCCugQAcgNd9iEMQ31tgH6u4DLQWoQayvtS VYFvXz2vPPpbXE1qpjoUFidhjFj82pVShWu9curWmb2zy tree depth : 0 fingerprint : 5d353a2e @@ -98,7 +98,7 @@ Create a BIP32 key from a passphrase: y as hex : 826d8b4d3010aea16ff4c1c1d3ae68541d9a04df54a2c48cc241c2983544de52 y parity : even key pair as sec : 02b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f - uncompressed : 04b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f\ + uncompressed : 04b4e599dfa44555a4ed38bcfff0071d5af676a86abf123c5b4b4e8e67a0b0b13f 826d8b4d3010aea16ff4c1c1d3ae68541d9a04df54a2c48cc241c2983544de52 hash160 : 5d353a2ecdb262477172852d57a3f11de0c19286 uncompressed : e5bd3a7e6cb62b4c820e51200fb1c148d79e67da @@ -211,7 +211,7 @@ From secret exponent: y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 @@ -234,7 +234,7 @@ Litecoin version: y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 @@ -250,7 +250,7 @@ From public pair (on Testnet): $ ku -nT 55066263022277343669578718895168534326250603453777594175500187360389116729240,even - input : 550662630222773436695787188951685343262506034537775941755001873603\ + input : 550662630222773436695787188951685343262506034537775941755001873603 89116729240,even network : Bitcoin testnet public pair x : 55066263022277343669578718895168534326250603453777594175500187360389116729240 @@ -259,7 +259,7 @@ From public pair (on Testnet): y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5 @@ -581,7 +581,7 @@ Compare to using ku: y as hex : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 y parity : even key pair as sec : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 - uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\ + uncompressed : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 hash160 : 751e76e8199196d454941c45d1b3a323f1433bd6 uncompressed : 91b24bf9f5288532960ac687abb035127b1d28a5