You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 16_1_Accessing_Bitcoind_with_C.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ bitcoinrpc_global_cleanup();
147
147
148
148
### Test the Test Code
149
149
150
-
Test code can be found at [15_1_testbitcoin.c in the src directory](src/15_1_testbitcoin.c). Download it to your testnet machine, then insert the correct RPC password (and change the RPC user if you didn't create your server with StandUp).
150
+
Test code can be found at [16_1_testbitcoin.c in the src directory](src/16_1_testbitcoin.c). Download it to your testnet machine, then insert the correct RPC password (and change the RPC user if you didn't create your server with StandUp).
Copy file name to clipboardExpand all lines: 16_2_Programming_Bitcoind_with_C.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> :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.
4
4
5
-
[§15.1](15_1_Accessing_Bitcoind_with_C.md) laid out the methodology for creating C programs using RPC and JSON libraries. We're now going to show the potential of those C libraries by laying out a simplistic, first cut of an actual Bitcoin program.
5
+
[§16.1](16_1_Accessing_Bitcoind_with_C.md) laid out the methodology for creating C programs using RPC and JSON libraries. We're now going to show the potential of those C libraries by laying out a simplistic, first cut of an actual Bitcoin program.
6
6
7
7
## Plan for Your Code
8
8
@@ -324,7 +324,7 @@ The entire code, with a _little_ more error-checking appears in the Appendix.
324
324
325
325
## Test Your Code
326
326
327
-
The complete code can be found in the [src directory](src/15_2_sendtoaddress.c).
327
+
The complete code can be found in the [src directory](src/16_2_sendtoaddress.c).
Copy file name to clipboardExpand all lines: 17_2_Using_BIP39_in_Libwally.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ All Bitcoin keys start with entropy. This first use of Libwally, and its BIP39 m
14
14
15
15
> :book:***What is Entropy?*** Entropy is a fancy way of saying randomness, but it's a carefully measured randomness that's used as the foundation of a true-random-number generated (TRG). Its measured in "bits", with more bits of entropy resulting in more randomness (and thus more protection for what's being generated). For Bitcoin, entropy is the foundation of your seed, which in an HD wallet generates all of your addresses.
16
16
17
-
You'll always start work with Libwally by initializing the library and testing the results, as first demonstrated in [§16.1](16_1_Setting_Up_Libwally.md):
17
+
You'll always start work with Libwally by initializing the library and testing the results, as first demonstrated in [§17.1](17_1_Setting_Up_Libwally.md):
18
18
```
19
19
int lw_response;
20
20
@@ -82,7 +82,7 @@ If you've done everything right, you should get back a 64-byte seed. (That's the
82
82
83
83
## Test Mnemonic Code
84
84
85
-
The full code for generating entropy, generating a BIP39 mnemonic, validating the mnemonic, and generating a seed can be found in the [src directory](src/16_2_genmnemonic.c). Download it and compile:
85
+
The full code for generating entropy, generating a BIP39 mnemonic, validating the mnemonic, and generating a seed can be found in the [src directory](src/17_2_genmnemonic.c). Download it and compile:
86
86
```
87
87
$ cc genmnemonic.c -lwallycore -lsodium -o genmnemonic
88
88
```
@@ -99,7 +99,7 @@ BIP39 allows you generate a set of 12-24 Mnemonic words from a seed (and the Lib
99
99
100
100
> :fire:***What is the power of BIP39?*** Bitcoin seeds and private keys are prone to all sorts of lossage. You mistype a single digit, and your money is gone forever. Mnemonic Words are a much more user-friendly way of representing the same data, but because they're words in the language of the user's choice, they're less prone to mistakes. The power of BIP39 is thus to improve the accessibility, usability, and safety of Bitcoin.
101
101
102
-
> :fire:***What is the power of BIP39 in Libwally?*** Bitcoind doesn't currently support mnemonic words, so using Libwally can allow you to generate mnemonic words in conjunction with addresses held by `bitcoind` (though as we'll see in §16.7, it requires a bit of a work-around at present to import your keys into Bitcoin Core).
102
+
> :fire:***What is the power of BIP39 in Libwally?*** Bitcoind doesn't currently support mnemonic words, so using Libwally can allow you to generate mnemonic words in conjunction with addresses held by `bitcoind` (though as we'll see in §17.7, it requires a bit of a work-around at present to import your keys into Bitcoin Core).
Copy file name to clipboardExpand all lines: 17_5_Using_Scripts_in_Libwally.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ As you might expect, you then add that input to your transaction:
98
98
lw_response = wally_tx_add_input(tx,tx_input);
99
99
```
100
100
101
-
> **NOTE** Obviously, you'll want to be able to create your own inputs if you're using Libwally for real applications, but this is intended as a first step. And, it can actually be useful for integrating with `bitcoin-cli`, as we'll see in [§16.7](16_7_Integrating_Libwally_and_Bitcoin-CLI.md).
101
+
> **NOTE** Obviously, you'll want to be able to create your own inputs if you're using Libwally for real applications, but this is intended as a first step. And, it can actually be useful for integrating with `bitcoin-cli`, as we'll see in [§16.7](17_7_Integrating_Libwally_and_Bitcoin-CLI.md).
102
102
103
103
### Print a Transaction
104
104
@@ -113,7 +113,7 @@ We'll show how to make use of that in §16.7.
113
113
114
114
## Test Your Replacement Script
115
115
116
-
You can grab the test code from the [src directory](src/16_5_replacewithscript.c) and compile it:
116
+
You can grab the test code from the [src directory](src/17_5_replacewithscript.c) and compile it:
117
117
```
118
118
$ cc replacewithscript.c -lwallycore -o replacewithscript
Copy file name to clipboardExpand all lines: 17_7_Integrating_Libwally_and_Bitcoin-CLI.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This final section will offer some examples of using Libwally programs to comple
8
8
9
9
## Share a Transaction
10
10
11
-
[§16.5: Using Scripts in Libwally](16_5_Using_Scripts_in_Libwally.md) detailed how Libwally could be used to rewrite an existing transaction, to do something that `bitcoin-cli` can't: produce a transaction that contains a unique P2SH. Obviously, this is a building block; if you decide to dig further into Libwally you'll create entire transactions on your own. But, this abbreviated methodology also has its own usage: it shows how transactions can be passed back and forth between `bitcoin-cli` and Libwally, demonstrating a first example of using them in a complementary fashion.
11
+
[§17.5: Using Scripts in Libwally](17_5_Using_Scripts_in_Libwally.md) detailed how Libwally could be used to rewrite an existing transaction, to do something that `bitcoin-cli` can't: produce a transaction that contains a unique P2SH. Obviously, this is a building block; if you decide to dig further into Libwally you'll create entire transactions on your own. But, this abbreviated methodology also has its own usage: it shows how transactions can be passed back and forth between `bitcoin-cli` and Libwally, demonstrating a first example of using them in a complementary fashion.
12
12
13
13
To fully demonstrate this methodology, you'll create a transaction with `bitcoin-cli`, using this UTXO:
Though you placed a recipient and an amount in the output, it's irrelevent, because you'll be rewriting those. A fancier bit of code could read the existing `vout` info before rewriting, but we're keeping things very close to our [original code](src/16_5_replacewithscript.c).
36
+
Though you placed a recipient and an amount in the output, it's irrelevent, because you'll be rewriting those. A fancier bit of code could read the existing `vout` info before rewriting, but we're keeping things very close to our [original code](src/17_5_replacewithscript.c).
37
37
38
38
Here's the one change necessary, to allow you to specify the satoshi `vout`, without having to hardcode it, as in the original:
Voila! That's the power of Libwally with `bitcoin-cli`.
172
172
173
-
Obviously, you can also pass around a PSBT using the functions described in [§16.4](16_4_Using_PSBTs_in_Libwally.md) and that's a more up-to-date methodology for the modern-day usage of Bitcoin, but in either example, the concept of passing transactions from `bitcoin-cli` to Libwally code and back should be similar.
173
+
Obviously, you can also pass around a PSBT using the functions described in [§17.4](17_4_Using_PSBTs_in_Libwally.md) and that's a more up-to-date methodology for the modern-day usage of Bitcoin, but in either example, the concept of passing transactions from `bitcoin-cli` to Libwally code and back should be similar.
174
174
175
175
## Import & Export BIP39 Seeds
176
176
@@ -182,7 +182,7 @@ Unfortunately, not all interactions between Libwally and `bitcoin-cli` go as smo
182
182
183
183
## Import Private Keys
184
184
185
-
Fortunately, you can do much the same thing by importing a private key generated in Libwally. Take a look at [genhd-for-import.c](src/16_7_genhd_for_import.c), a simplified version of the `genhd` program from [§16.3](16_3_Using_BIP32_in_Libwally.md) that also uses the `jansson` library from [§15.1](15_1_Accessing_Bitcoind_with_C.md) for regularized output.
185
+
Fortunately, you can do much the same thing by importing a private key generated in Libwally. Take a look at [genhd-for-import.c](src/17_7_genhd_for_import.c), a simplified version of the `genhd` program from [§17.3](17_3_Using_BIP32_in_Libwally.md) that also uses the `jansson` library from [§16.1](15_1_Accessing_Bitcoind_with_C.md) for regularized output.
186
186
187
187
The updated code also contains one change of note: it requests a fingerprint from Libwally so that it can properly create a derivation path:
188
188
```
@@ -195,7 +195,7 @@ The updated code also contains one change of note: it requests a fingerprint fro
195
195
196
196
> :warning:**WARNING:** Remember that the fingerprint in derivation paths is arbitrary. Because Libwally provides one, we're using it, but if you didn't have one, you could add an arbitrary 4-byte hexcode as a fingerprint to your derivation path.
197
197
198
-
Be sure to compile the new code with the `jansson` library, after installing it (if necessary) per [§15.1](15_1_Accessing_Bitcoind_with_C.md).
198
+
Be sure to compile the new code with the `jansson` library, after installing it (if necessary) per [§16.1](15_1_Accessing_Bitcoind_with_C.md).
199
199
```
200
200
$ cc genhd-for-import.c -lwallycore -lsodium -ljansson -o genhd-for-import
0 commit comments