Update chapter numbers

This commit is contained in:
namcios 2021-08-24 09:29:00 -03:00
parent a87ec94f70
commit f59849d8a9
No known key found for this signature in database
GPG Key ID: 8E3A368317269AB4
6 changed files with 16 additions and 16 deletions

View File

@ -129,7 +129,7 @@ In both cases, the argument is for flags, but is currently set to `0`.
## Test a Test Libwally Program ## Test a Test Libwally Program
The src directory contains [testwally.c](src/16_1_testwally.c), which just shows how the initialize and cleanup functions work. The src directory contains [testwally.c](src/17_1_testwally.c), which just shows how the initialize and cleanup functions work.
You can compile it as follows: You can compile it as follows:
``` ```

View File

@ -115,7 +115,7 @@ There is also a `wally_bip32_key_to_address` function, which can be used to gene
## Test HD Code ## Test HD Code
The code for these HD example can, as usual, be found in the [src directory](src/16_3_genhd.c). The code for these HD example can, as usual, be found in the [src directory](src/17_3_genhd.c).
You can compile and test it: You can compile and test it:
``` ```

View File

@ -116,7 +116,7 @@ Obviously, there's a lot more you could look at in the PSBTs. In fact, looking i
### Test Your PSBT Reader ### Test Your PSBT Reader
Again, the code for this (extremely rudimentary and specific) PSBT reader is in the [src directory](src/16_4_examinepsbt.c). Again, the code for this (extremely rudimentary and specific) PSBT reader is in the [src directory](src/17_4_examinepsbt.c).
You can compile it as normal: You can compile it as normal:
``` ```
@ -289,7 +289,7 @@ But what you have is not yet a legal PSBT, because of the lack of inputs. You ca
``` ```
### Test Your PSBT Creation ### Test Your PSBT Creation
At this point, you should have an empty, but working PSBT, which you can see by compiling and running [the program](src/16_4_createemptypsbt.c). At this point, you should have an empty, but working PSBT, which you can see by compiling and running [the program](src/17_4_createemptypsbt.c).
``` ```
$ cc createemptypsbt.c -lwallycore -o createemptypsbt $ cc createemptypsbt.c -lwallycore -o createemptypsbt
$ ./createemptypsbt $ ./createemptypsbt

View File

@ -98,7 +98,7 @@ As you might expect, you then add that input to your transaction:
lw_response = wally_tx_add_input(tx,tx_input); lw_response = wally_tx_add_input(tx,tx_input);
``` ```
> **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). > **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).
### Print a Transaction ### Print a Transaction
@ -113,7 +113,7 @@ We'll show how to make use of that in §16.7.
## Test Your Replacement Script ## Test Your Replacement Script
You can grab the test code from the [src directory](src/16_5_replacewithscript.c) and compile it: You can grab the test code from the [src directory](src/17_5_replacewithscript.c) and compile it:
``` ```
$ cc replacewithscript.c -lwallycore -o replacewithscript $ cc replacewithscript.c -lwallycore -o replacewithscript
``` ```

View File

@ -45,7 +45,7 @@ Some relate to the wallet import format (WIF):
## Use BIP32 Functions ## Use BIP32 Functions
There are additional BIP32 HD-wallet functions, beyond what was covered in [§16.3: Using BIP32 in Libwally](16_3_Using_BIP32_in_Libwally.md). There are additional BIP32 HD-wallet functions, beyond what was covered in [§17.3: Using BIP32 in Libwally](17_3_Using_BIP32_in_Libwally.md).
* `bip32_key_get_fingerprint` — Generate a BIP32 fingerprint for an extended key * `bip32_key_get_fingerprint` — Generate a BIP32 fingerprint for an extended key
* `bip32_key_serialize` — Transform an extended key into serialized bytes * `bip32_key_serialize` — Transform an extended key into serialized bytes
@ -65,7 +65,7 @@ The main functions are:
## Use BIP39 Functions ## Use BIP39 Functions
A few BIP39 mnemonic-word functions were just overviewed in [§16.2: Using BIP39 in Libwally](16_2_Using_BIP39_in_Libwally.md): A few BIP39 mnemonic-word functions were just overviewed in [§17.2: Using BIP39 in Libwally](17_2_Using_BIP39_in_Libwally.md):
* `bip39_get_languages` — See a list of supported languages * `bip39_get_languages` — See a list of supported languages
* `bit39_get_word` — Retrieve a specific word from a language's word list * `bit39_get_word` — Retrieve a specific word from a language's word list
@ -73,11 +73,11 @@ A few BIP39 mnemonic-word functions were just overviewed in [§16.2: Using BIP39
## Use PSBT Functions ## Use PSBT Functions
Listings of most PSBT functions can be found in [16.4: Using PSBTs in Libwally](16_4_Using_PSBTs_in_Libwally.md). Listings of most PSBT functions can be found in [17.4: Using PSBTs in Libwally](17_4_Using_PSBTs_in_Libwally.md).
## Use Script Functions ## Use Script Functions
[§16.5: Using Scripts in Libwally](16_5_Using_Scripts_in_Libwally.md) just barely touched upon Libwally's Scripts functions. [§17.5: Using Scripts in Libwally](17_5_Using_Scripts_in_Libwally.md) just barely touched upon Libwally's Scripts functions.
There's another function that lets you determine the sort of script found in a transaction: There's another function that lets you determine the sort of script found in a transaction:
@ -102,7 +102,7 @@ Then there are a slew of functions that create `scriptPubKey` from bytes, `scrip
## Use Transaction Functions ## Use Transaction Functions
We also just barely touched upon the functions that can be used to create and convert functions in [§16.5](16_5_Using_Scripts_in_Libwally.md). We also just barely touched upon the functions that can be used to create and convert functions in [§17.5](17_5_Using_Scripts_in_Libwally.md).
There are numerous informational functions, some of the more interesting of which are: There are numerous informational functions, some of the more interesting of which are:

View File

@ -8,7 +8,7 @@ This final section will offer some examples of using Libwally programs to comple
## Share a Transaction ## Share a Transaction
[§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. [§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.
To fully demonstrate this methodology, you'll create a transaction with `bitcoin-cli`, using this UTXO: To fully demonstrate this methodology, you'll create a transaction with `bitcoin-cli`, using this UTXO:
``` ```
@ -33,7 +33,7 @@ $ utxo_vout=$(bitcoin-cli listunspent | jq -r '.[0] | .vout')
$ recipient=tb1qycsmq3jas5wkhf8xrfn8k7438cm5pc8h9ae2k0 $ recipient=tb1qycsmq3jas5wkhf8xrfn8k7438cm5pc8h9ae2k0
$ rawtxhex=$(bitcoin-cli -named createrawtransaction inputs='''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' outputs='''{ "'$recipient'": 0.0009 }''') $ rawtxhex=$(bitcoin-cli -named createrawtransaction inputs='''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' outputs='''{ "'$recipient'": 0.0009 }''')
``` ```
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). 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).
Here's the one change necessary, to allow you to specify the satoshi `vout`, without having to hardcode it, as in the original: Here's the one change necessary, to allow you to specify the satoshi `vout`, without having to hardcode it, as in the original:
``` ```
@ -170,7 +170,7 @@ $ bitcoin-cli decoderawtransaction $signedtx
``` ```
Voila! That's the power of Libwally with `bitcoin-cli`. Voila! That's the power of Libwally with `bitcoin-cli`.
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. 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.
## Import & Export BIP39 Seeds ## Import & Export BIP39 Seeds
@ -182,7 +182,7 @@ Unfortunately, not all interactions between Libwally and `bitcoin-cli` go as smo
## Import Private Keys ## Import Private Keys
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. 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.
The updated code also contains one change of note: it requests a fingerprint from Libwally so that it can properly create a derivation path: The updated code also contains one change of note: it requests a fingerprint from Libwally so that it can properly create a derivation path:
``` ```
@ -195,7 +195,7 @@ The updated code also contains one change of note: it requests a fingerprint fro
> :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. > :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.
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). 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).
``` ```
$ cc genhd-for-import.c -lwallycore -lsodium -ljansson -o genhd-for-import $ cc genhd-for-import.c -lwallycore -lsodium -ljansson -o genhd-for-import
``` ```