Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
fix(cookbook): deadlinks
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
realeinherjar committed Oct 9, 2023
1 parent 593f36e commit 2ebb9a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions cookbook/src/tx_segwit-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ Inside the [`TxIn`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction
It should be empty. That's why the `ScriptBuf::new()`.
- `sequence` is the sequence number; it is a [`Sequence`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Sequence.html) type.
We are using the [`ENABLE_RBF_NO_LOCKTIME`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Sequence.html#associatedconstant.ENABLE_RBF_NO_LOCKTIME) constant.
- `witness` is the witness stack; it is a [`Witness`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Witness.html) type.
We are using the [`default`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Witness.html#impl-Default) method to create an empty witness that will be filled in later after signing.
- `witness` is the witness stack; it is a [`Witness`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/witness/struct.Witness.html) type.
We are using the [`default`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/witness/struct.Witness.html#impl-Default) method to create an empty witness that will be filled in later after signing.
This is possible because `Witness` implements the [`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait.

In `let spend = TxOut {...}` we are instantiating the spend output.
Expand All @@ -265,7 +265,7 @@ Inside the [`TxOut`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transactio
- `value` is the amount we are spending; it is a [`u64`](https://doc.rust-lang.org/std/primitive.u64.html) type.
We are using the `const SPEND_AMOUNT` that we defined earlier.
- `script_pubkey` is the script code required to spend a P2WPKH output; it is a [`ScriptBuf`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/script/struct.ScriptBuf.html) type.
We are using the [`script_pubkey`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/address/struct.Address.html#method.script_pubkey) method to generate the script pubkey from the receivers address.
We are using the [`script_pubkey`](https://docs.rs/bitcoin/latest/bitcoin/address/struct.Address.html#method.script_pubkey) method to generate the script pubkey from the receivers address.
This will lock the output to the receiver's address.

In `let change = TxOut {...}` we are instantiating the change output.
Expand Down Expand Up @@ -336,7 +336,9 @@ It expects a single argument of type `AsRef<[u8]>` which is a reference to a byt
As the last step we print this to terminal using the [`println!`](https://doc.rust-lang.org/std/macro.println.html) macro.
This transaction is now ready to be broadcast to the Bitcoin network.

<!-- markdown-link-check-disable -->
[^today]: mid-2023.
<!-- markdown-link-check-enable -->

[^change]: Please note that the `CHANGE_AMOUNT` is not the same as the `DUMMY_UTXO_AMOUNT` minus the `SPEND_AMOUNT`.
This is due to the fact that we need to pay a fee for the transaction.
Expand Down
6 changes: 3 additions & 3 deletions cookbook/src/tx_taproot.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ Inside the [`TxIn`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction
We are instantiating a new empty script with [`ScriptBuf::new()`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/script/struct.ScriptBuf.html#method.new).
- `sequence` is the sequence number; it is a [`Sequence`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Sequence.html) type.
We are using the [`ENABLE_RBF_NO_LOCKTIME`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Sequence.html#associatedconstant.ENABLE_RBF_NO_LOCKTIME) constant.
- `witness` is the witness stack; it is a [`Witness`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Witness.html) type.
We are using the [`default`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transaction/struct.Witness.html#impl-Default) method to create an empty witness that will be filled in later after signing.
- `witness` is the witness stack; it is a [`Witness`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/witness/struct.Witness.html) type.
We are using the [`default`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/witness/struct.Witness.html#impl-Default) method to create an empty witness that will be filled in later after signing.
This is possible because `Witness` implements the [`Default`](https://doc.rust-lang.org/std/default/trait.Default.html) trait.

In `let spend = TxOut {...}` we are instantiating the spend output.
Expand All @@ -273,7 +273,7 @@ Inside the [`TxOut`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/transactio
- `value` is the amount we are spending; it is a [`u64`](https://doc.rust-lang.org/std/primitive.u64.html) type.
We are using the `const SPEND_AMOUNT` that we defined earlier.
- `script_pubkey` is the script code required to spend a P2TR output; it is a [`ScriptBuf`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/script/struct.ScriptBuf.html) type.
We are using the [`script_pubkey`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/address/struct.Address.html#method.script_pubkey) method to generate the script pubkey from the receivers address.
We are using the [`script_pubkey`](https://docs.rs/bitcoin/latest/bitcoin/address/struct.Address.html#method.script_pubkey) method to generate the script pubkey from the receivers address.
This will lock the output to the receiver's address.

In `let change = TxOut {...}` we are instantiating the change output.
Expand Down

0 comments on commit 2ebb9a9

Please sign in to comment.