From af86e95491a2cabe2f5300c795df90ced47ad61e Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 14 Jun 2021 03:01:50 +1000 Subject: [PATCH 01/10] Fix spelling typo and spacing On a single line fix - Spacing between 'the' and 'src' - Spelling of 'ineteger2lehex.sh' --- 10_2_Building_the_Structure_of_P2SH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_2_Building_the_Structure_of_P2SH.md b/10_2_Building_the_Structure_of_P2SH.md index c66b0d9..7d74afe 100644 --- a/10_2_Building_the_Structure_of_P2SH.md +++ b/10_2_Building_the_Structure_of_P2SH.md @@ -67,7 +67,7 @@ To complete your serialization, you translate the hexcode into binary. On the co ## Run The Integer Conversion Script -A complete script for changing an integer between -2147483647 and 2147483647 to a little-endian signed-magnitude representation in hex can be found in the [src code directory](src/10_2_integer2lehex.sh). You can download it as `integeer2lehex.sh`. +A complete script for changing an integer between -2147483647 and 2147483647 to a little-endian signed-magnitude representation in hex can be found in the [src code directory](src/10_2_integer2lehex.sh). You can download it as `integer2lehex.sh`. > :warning: **WARNING:** This script has not been robustly checked. If you are going to use it to create real locking scripts you should make sure to double-check and test your results. From 3a31191cf493d348b0e9cc80e4ec2575a67c3a5e Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 2 Aug 2021 07:44:55 +1000 Subject: [PATCH 02/10] Add missing pluralisation As for the subsequent usage 'number' should be pluralised. --- 12_2_Using_Other_Script_Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/12_2_Using_Other_Script_Commands.md b/12_2_Using_Other_Script_Commands.md index 1daa3f3..af30e4e 100644 --- a/12_2_Using_Other_Script_Commands.md +++ b/12_2_Using_Other_Script_Commands.md @@ -18,7 +18,7 @@ Manipulate one number: Also see: `OP_0NOTEQUAL` (0x92) -Manipulate two number mathematically: +Manipulate two numbers mathematically: * OP_ADD (0x93) — Add two numbers * OP_SUB (0x94) — Subtract two numbers From ee938c600df0667df1184c4c3884d4e6149da47c Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 2 Aug 2021 07:50:10 +1000 Subject: [PATCH 03/10] Use singular 'number' Should be 'two copies of each number' instead of 'two copies of each numbers'. --- 13_1_Writing_Puzzle_Scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_1_Writing_Puzzle_Scripts.md b/13_1_Writing_Puzzle_Scripts.md index 9002eb6..aa7316f 100644 --- a/13_1_Writing_Puzzle_Scripts.md +++ b/13_1_Writing_Puzzle_Scripts.md @@ -177,7 +177,7 @@ script | stack What if you wanted to instead write an equation system, such as `x + y = 3`, `y + z = 5`, and `x + z = 4`? A bit of algebra tells you that the answers come out to `x = 1`, `y = 2`, and `z = 3`. But, how do you script it? -Most obviously, after the redeemer inputs the three numbers, you're going to need two copies of each numbers, since each number goes into two different equations. `OP_3DUP` takes care of that and results in `x y z x y z` being on the stack. Popping off two items at a time will give you `y z`, `z x`, and `x y`. Voila! That's the three equations, so you just need to add them up and test them in the right order! Here's the full script: `OP_3DUP OP_ADD 5 OP_EQUALVERIFY OP_ADD 4 OP_EQUALVERIFY OP_ADD 3 OP_EQUAL`. +Most obviously, after the redeemer inputs the three numbers, you're going to need two copies of each number, since each number goes into two different equations. `OP_3DUP` takes care of that and results in `x y z x y z` being on the stack. Popping off two items at a time will give you `y z`, `z x`, and `x y`. Voila! That's the three equations, so you just need to add them up and test them in the right order! Here's the full script: `OP_3DUP OP_ADD 5 OP_EQUALVERIFY OP_ADD 4 OP_EQUALVERIFY OP_ADD 3 OP_EQUAL`. Here's how it runs with the correct unlocking script of `1 2 3`: ``` From a359b90e2524cd8fc5d5ccf4b977becbdaf6da95 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 2 Aug 2021 07:59:16 +1000 Subject: [PATCH 04/10] Add missing period --- 13_2_Writing_Complex_Multisig_Scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_2_Writing_Complex_Multisig_Scripts.md b/13_2_Writing_Complex_Multisig_Scripts.md index d917b50..1973f28 100644 --- a/13_2_Writing_Complex_Multisig_Scripts.md +++ b/13_2_Writing_Complex_Multisig_Scripts.md @@ -106,7 +106,7 @@ The result of the final `OP_CHECKMULTISIG` that was run will be left on the top We've talked a lot about escrows. Complex multisigs combined with timelocks offer an automated way to create them in a robust manner. -Imagine home buyer Alice and home seller Bob who are working with an escrow agent The easy way to script this would be as a multisig where any two of the three parties could release the money: either the seller and buyer agree or the escrow agent takes over and agrees with one of the parties: `2 3 OP_CHECKMULTISG`. +Imagine home buyer Alice and home seller Bob who are working with an escrow agent. The easy way to script this would be as a multisig where any two of the three parties could release the money: either the seller and buyer agree or the escrow agent takes over and agrees with one of the parties: `2 3 OP_CHECKMULTISG`. However, this weakens the power of the escrow agent and allows the seller and buyer to accidentally make a bad decision between themselves — which is one of the things an escrow system is designed to avoid. So it could be that what we really want is the system that we just laid out, where the escrow agent is a required party in the 2-of-3 multisig: `OP_3DUP 2 2 OP_CHECKMULTISIG NOTIF 2 2 OP_CHECKMULTISIG ENDIF`. From 1f635a92c832739ffea8268c18501fe2d00e7af3 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 2 Aug 2021 08:24:34 +1000 Subject: [PATCH 05/10] Replace period with comma --- 13_3_Empowering_Bitcoin_with_Scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_3_Empowering_Bitcoin_with_Scripts.md b/13_3_Empowering_Bitcoin_with_Scripts.md index c7e84cd..1aff787 100644 --- a/13_3_Empowering_Bitcoin_with_Scripts.md +++ b/13_3_Empowering_Bitcoin_with_Scripts.md @@ -270,7 +270,7 @@ Running through the script reveals that the initial checks, above the `IF`/`ELSE #### Understand HTLCs -HTLCs are quite complex, and this overview doesn't try to explain all of their intricacies. Rusty Russell's [overview](https://rusty.ozlabs.org/?p=462) explains more. and there's even more detail in his [Deployable Lightning](https://github.com/ElementsProject/lightning/blob/master/doc/deployable-lightning.pdf) paper. But don't worry if some of the intricacies still escape you, particularly the interrelations of the two scripts. +HTLCs are quite complex, and this overview doesn't try to explain all of their intricacies. Rusty Russell's [overview](https://rusty.ozlabs.org/?p=462) explains more, and there's even more detail in his [Deployable Lightning](https://github.com/ElementsProject/lightning/blob/master/doc/deployable-lightning.pdf) paper. But don't worry if some of the intricacies still escape you, particularly the interrelations of the two scripts. For the purposes of this tutorial, there are two important lessons for HTLCs: From 723ef35429d1e1205227f475714ec5bc98e5353d Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 3 Aug 2021 08:51:33 +1000 Subject: [PATCH 06/10] Insert words to fix sentence This sentence is broken - fix it. Change 'Tor allows improve ...' -> 'Tor allows you to improve ...' --- 14_1_Verifying_Your_Tor_Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14_1_Verifying_Your_Tor_Setup.md b/14_1_Verifying_Your_Tor_Setup.md index 92570e4..b1b211b 100644 --- a/14_1_Verifying_Your_Tor_Setup.md +++ b/14_1_Verifying_Your_Tor_Setup.md @@ -6,7 +6,7 @@ If you did a standard installation with [Bitcoin Standup](https://github.com/Blo > :book: ***What is Tor?*** Tor is a low-latency anonymity and overlay network based on onion routing and path-building design for enabling anonymous communication. It's free and open-source software with the name derived from the acronym for the original software project name: "The Onion Router". -> :book: ***Why Use Tor for Bitcoin?*** The Bitcoin network is a peer-to-peer network that listens for transactions and propagates them using a public IP address. When connecting to the network not using Tor, you would share your IP address, which could expose your location, your uptime, and others details to third parties — which is an undesirable privacy practice. To protect yourself online you should use tools like Tor to hide your connection details. Tor allows improve your privacy online as your data is cryptographically encoded and goes through different nodes, each one decoding a single layer (hence the onion metaphor). +> :book: ***Why Use Tor for Bitcoin?*** The Bitcoin network is a peer-to-peer network that listens for transactions and propagates them using a public IP address. When connecting to the network not using Tor, you would share your IP address, which could expose your location, your uptime, and others details to third parties — which is an undesirable privacy practice. To protect yourself online you should use tools like Tor to hide your connection details. Tor allows you to improve your privacy online as your data is cryptographically encoded and goes through different nodes, each one decoding a single layer (hence the onion metaphor). ## Understand Tor From cc3939470f4459d67fb75652ec07b17a0f1bdaeb Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 3 Aug 2021 08:53:47 +1000 Subject: [PATCH 07/10] Re-order words Re-order words 'least three Tor nodes relays' -> 'least three Tor relay nodes'. --- 14_1_Verifying_Your_Tor_Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14_1_Verifying_Your_Tor_Setup.md b/14_1_Verifying_Your_Tor_Setup.md index b1b211b..d4ce2a7 100644 --- a/14_1_Verifying_Your_Tor_Setup.md +++ b/14_1_Verifying_Your_Tor_Setup.md @@ -12,7 +12,7 @@ If you did a standard installation with [Bitcoin Standup](https://github.com/Blo So how does Tor work? -When a user wants to connect to an Internet server, Tor tries to build a path formed by at least three Tor nodes relays, called Guard, Middle, and Exit. While building this path, symmetric encryption keys are negotiated; when a message moves along the path, each relay then strips off its layer of encryption. In this way, the message arrives at the final destination in its original form, and each party only knows the previous and the next hop and cannot determine origin or destination. +When a user wants to connect to an Internet server, Tor tries to build a path formed by at least three Tor relay nodes, called Guard, Middle, and Exit. While building this path, symmetric encryption keys are negotiated; when a message moves along the path, each relay then strips off its layer of encryption. In this way, the message arrives at the final destination in its original form, and each party only knows the previous and the next hop and cannot determine origin or destination. Here's what a connection looks like without Tor: ``` From 84759982df85b61d3d07cd017a1c22f67ffafb22 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 9 Aug 2021 09:13:18 +1000 Subject: [PATCH 08/10] Use 'an Rpc' instead of 'a RPC --- 16_1_Accessing_Bitcoind_with_C.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16_1_Accessing_Bitcoind_with_C.md b/16_1_Accessing_Bitcoind_with_C.md index 1a55c7e..7b977e9 100644 --- a/16_1_Accessing_Bitcoind_with_C.md +++ b/16_1_Accessing_Bitcoind_with_C.md @@ -2,7 +2,7 @@ > :information_source: **NOTE:** This section has been recently added to the course and is an early draft that may still be awaiting review. Caveat reader. -You've already seen one alternative way to access the Bitcoind's RPC ports: `curl`, which was covered in a [Chapter 4 Interlude](04_4__Interlude_Using_Curl.md). Interacting with `bitcoind` through a RPC library in C is no different than that, you just need some good libraries to help you out. This section introduces a package called `libbitcoinrpc`, which allows you to access JSON-RPC `bitcoind` port. It uses a `curl` library for accessing the data and it uses the `jansson` library for encoding and decoding the JSON. +You've already seen one alternative way to access the Bitcoind's RPC ports: `curl`, which was covered in a [Chapter 4 Interlude](04_4__Interlude_Using_Curl.md). Interacting with `bitcoind` through an RPC library in C is no different than that, you just need some good libraries to help you out. This section introduces a package called `libbitcoinrpc`, which allows you to access JSON-RPC `bitcoind` port. It uses a `curl` library for accessing the data and it uses the `jansson` library for encoding and decoding the JSON. ## Set Up libbitcoinrpc From 72d97eaed02260ec39cdabdd0188e109405df825 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 9 Aug 2021 09:15:50 +1000 Subject: [PATCH 09/10] Use 'these' with plural documents The choice was 'with these documents' or 'with this document', elect to keep 'documents' plural. --- 16_1_Accessing_Bitcoind_with_C.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16_1_Accessing_Bitcoind_with_C.md b/16_1_Accessing_Bitcoind_with_C.md index 7b977e9..aa4f0ab 100644 --- a/16_1_Accessing_Bitcoind_with_C.md +++ b/16_1_Accessing_Bitcoind_with_C.md @@ -106,7 +106,7 @@ First, initialize the library: ``` bitcoinrpc_global_init(); ``` -Then connect to your `bitcoind` with `bitcoinrpc_cl_init_params`. The four arguments for `bitcoinrpc_cl_init_params` are username, password, IP address, and port. You should already know all of this information from your work with [Curl](04_4__Interlude_Using_Curl.md). As you'll recall, the IP address 127.0.0.1 and port 18332 should be correct for the standard testnet setup described in this documents, while you can extract the user and password from `~/.bitcoin/bitcoin.conf`. +Then connect to your `bitcoind` with `bitcoinrpc_cl_init_params`. The four arguments for `bitcoinrpc_cl_init_params` are username, password, IP address, and port. You should already know all of this information from your work with [Curl](04_4__Interlude_Using_Curl.md). As you'll recall, the IP address 127.0.0.1 and port 18332 should be correct for the standard testnet setup described in these documents, while you can extract the user and password from `~/.bitcoin/bitcoin.conf`. ``` $ cat bitcoin.conf server=1 From dc457b790b35ae9d8de74628c11d47465768753a Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Tue, 24 Aug 2021 10:10:19 +1000 Subject: [PATCH 10/10] Replace well-understand with well-understood --- 17_7_Integrating_Libwally_and_Bitcoin-CLI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/17_7_Integrating_Libwally_and_Bitcoin-CLI.md b/17_7_Integrating_Libwally_and_Bitcoin-CLI.md index d6802ff..aa60c31 100644 --- a/17_7_Integrating_Libwally_and_Bitcoin-CLI.md +++ b/17_7_Integrating_Libwally_and_Bitcoin-CLI.md @@ -178,7 +178,7 @@ Unfortunately, not all interactions between Libwally and `bitcoin-cli` go as smo > :book: ***What's the Difference Between Entropy & a Seed?*** Libwally says that it creates its mnemonic phrases from entropy. That's essentially the same thing as a seed: they're both large, randomized numbers. So, if `bitcoin-cli` was compatible with 512-bit mnemonic-phrase seeds, you could use one to generate the mneomnic phrases, and get the results that you'd expect. -> :book: ***What's the difference between Entropy & Raw Entropy?*** Not all entropy is the same. When you input entropy into a command that creates a mnemonic seed, it has to a specific, well-understand length. Changing raw entropy into entropy requires massaging the raw entropy until it's the right length and format, and at that point you could reuse that (non-raw) entropy to always recreate the same mnemonics (which is why entropy is effectively the same thing as a seed at that point, but raw entropy isn't). +> :book: ***What's the difference between Entropy & Raw Entropy?*** Not all entropy is the same. When you input entropy into a command that creates a mnemonic seed, it has to a specific, well-understood length. Changing raw entropy into entropy requires massaging the raw entropy until it's the right length and format, and at that point you could reuse that (non-raw) entropy to always recreate the same mnemonics (which is why entropy is effectively the same thing as a seed at that point, but raw entropy isn't). ## Import Private Keys