Skip to content

Commit 632787c

Browse files
committed
deploy: 1393055
1 parent 5ba2a10 commit 632787c

5 files changed

Lines changed: 16 additions & 18 deletions

File tree

book/print.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
489489
This is the message that we will sign.
490490
The <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E">Message::from</a> method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.</p>
491491
<p>We compute the signature <code>sig</code> by using the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_ecdsa"><code>sign_ecdsa</code></a> method.
492-
It takes a refence to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html"><code>SecretKey</code></a> as arguments,
492+
It takes a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html"><code>SecretKey</code></a> as arguments,
493493
and returns a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html"><code>Signature</code></a> type.</p>
494494
<p>In the next step, we update the witness stack for the input we just signed by first converting the <code>sighash_cache</code> into a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html"><code>Transaction</code></a>
495495
by using the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/struct.SighashCache.html#method.into_transaction"><code>into_transaction</code></a> method.
@@ -519,7 +519,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
519519
This is due to the fact that we need to pay a fee for the transaction.</p>
520520
</div>
521521
<div class="footnote-definition" id="expect"><sup class="footnote-definition-label">3</sup>
522-
<p>We will be unwraping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
522+
<p>We will be unwrapping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
523523
with the <code>expect</code> method.</p>
524524
</div>
525525
<div class="footnote-definition" id="secp"><sup class="footnote-definition-label">4</sup>
@@ -529,8 +529,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
529529
<a href="https://en.bitcoin.it/wiki/Secp256k1">secp256k1</a>.</p>
530530
</div>
531531
<div class="footnote-definition" id="spend"><sup class="footnote-definition-label">5</sup>
532-
<p>And also we are locking the output to an address that we control:
533-
the <code>wpkh</code> public key hash that we generated earlier.</p>
532+
<p>And also we are locking the output to an address that we control:</p>
534533
</div>
535534
<div style="break-before: page; page-break-before: always;"></div><h1 id="constructing-and-signing-transactions---taproot"><a class="header" href="#constructing-and-signing-transactions---taproot">Constructing and Signing Transactions - Taproot</a></h1>
536535
<p>In this section, we will construct a <a href="https://bitcoinops.org/en/topics/taproot/">Taproot transaction</a>.</p>
@@ -580,7 +579,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
580579
This will be useful to mock a sender.
581580
In a real application these would be actual secrets<sup class="footnote-reference"><a href="#secp">3</a></sup>.
582581
We use the <code>SecretKey::new</code> method to generate a random private key <code>sk</code>.
583-
We then use the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key"><code>Keypair::from_secret_key</code></a> method to instatiate a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html"><code>Keypair</code></a> type,
582+
We then use the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key"><code>Keypair::from_secret_key</code></a> method to instantiate a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html"><code>Keypair</code></a> type,
584583
which is a data structure that holds a keypair consisting of a secret and a public key.
585584
Note that <code>senders_keys</code> is generic over the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/trait.Signing.html"><code>Signing</code></a> trait.
586585
This is used to indicate that is an instance of <code>Secp256k1</code> and can be used for signing.</p>
@@ -819,7 +818,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
819818
<ul>
820819
<li><code>input_index</code> is the index of the input we are signing; it is a <a href="https://doc.rust-lang.org/std/primitive.usize.html"><code>usize</code></a> type.
821820
We are using <code>0</code> since we only have one input.</li>
822-
<li><code>&amp;prevouts</code> is a refence to the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html"><code>Prevouts</code></a> enum that we defined earlier.
821+
<li><code>&amp;prevouts</code> is a reference to the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html"><code>Prevouts</code></a> enum that we defined earlier.
823822
This is used to reference the outputs of previous transactions and also used to calculate our transaction value.</li>
824823
<li><code>annex</code> is an optional argument that is used to pass the annex data.
825824
We are not using it, so we are passing <code>None</code>.</li>
@@ -835,7 +834,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
835834
This is a the message that we will sign.
836835
The <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E">Message::from</a> method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.</p>
837836
<p>We compute the signature <code>sig</code> by using the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_schnorr"><code>sign_schnorr</code></a> method.
838-
It takes a refence to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html"><code>Keypair</code></a> as arguments,
837+
It takes a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html"><code>Keypair</code></a> as arguments,
839838
and returns a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html"><code>Signature</code></a> type.</p>
840839
<p>In the next step, we update the witness stack for the input we just signed by first converting the <code>sighash_cache</code> into a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html"><code>Transaction</code></a>
841840
by using the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/struct.SighashCache.html#method.into_transaction"><code>into_transaction</code></a> method.
@@ -852,7 +851,7 @@ <h2 id="license"><a class="header" href="#license">License</a></h2>
852851
This is due to the fact that we need to pay a fee for the transaction.</p>
853852
</div>
854853
<div class="footnote-definition" id="expect"><sup class="footnote-definition-label">2</sup>
855-
<p>We will be unwraping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
854+
<p>We will be unwrapping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
856855
with the <code>expect</code> method.</p>
857856
</div>
858857
<div class="footnote-definition" id="secp"><sup class="footnote-definition-label">3</sup>

book/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

book/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

book/tx_segwit-v0.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ <h1 id="constructing-and-signing-transactions---segwit-v0"><a class="header" hre
446446
This is the message that we will sign.
447447
The <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E">Message::from</a> method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.</p>
448448
<p>We compute the signature <code>sig</code> by using the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_ecdsa"><code>sign_ecdsa</code></a> method.
449-
It takes a refence to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html"><code>SecretKey</code></a> as arguments,
449+
It takes a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html"><code>SecretKey</code></a> as arguments,
450450
and returns a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html"><code>Signature</code></a> type.</p>
451451
<p>In the next step, we update the witness stack for the input we just signed by first converting the <code>sighash_cache</code> into a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html"><code>Transaction</code></a>
452452
by using the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/struct.SighashCache.html#method.into_transaction"><code>into_transaction</code></a> method.
@@ -476,7 +476,7 @@ <h1 id="constructing-and-signing-transactions---segwit-v0"><a class="header" hre
476476
This is due to the fact that we need to pay a fee for the transaction.</p>
477477
</div>
478478
<div class="footnote-definition" id="expect"><sup class="footnote-definition-label">3</sup>
479-
<p>We will be unwraping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
479+
<p>We will be unwrapping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
480480
with the <code>expect</code> method.</p>
481481
</div>
482482
<div class="footnote-definition" id="secp"><sup class="footnote-definition-label">4</sup>
@@ -486,8 +486,7 @@ <h1 id="constructing-and-signing-transactions---segwit-v0"><a class="header" hre
486486
<a href="https://en.bitcoin.it/wiki/Secp256k1">secp256k1</a>.</p>
487487
</div>
488488
<div class="footnote-definition" id="spend"><sup class="footnote-definition-label">5</sup>
489-
<p>And also we are locking the output to an address that we control:
490-
the <code>wpkh</code> public key hash that we generated earlier.</p>
489+
<p>And also we are locking the output to an address that we control:</p>
491490
</div>
492491

493492
</main>

book/tx_taproot.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ <h1 id="constructing-and-signing-transactions---taproot"><a class="header" href=
221221
This will be useful to mock a sender.
222222
In a real application these would be actual secrets<sup class="footnote-reference"><a href="#secp">3</a></sup>.
223223
We use the <code>SecretKey::new</code> method to generate a random private key <code>sk</code>.
224-
We then use the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key"><code>Keypair::from_secret_key</code></a> method to instatiate a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html"><code>Keypair</code></a> type,
224+
We then use the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key"><code>Keypair::from_secret_key</code></a> method to instantiate a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html"><code>Keypair</code></a> type,
225225
which is a data structure that holds a keypair consisting of a secret and a public key.
226226
Note that <code>senders_keys</code> is generic over the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/trait.Signing.html"><code>Signing</code></a> trait.
227227
This is used to indicate that is an instance of <code>Secp256k1</code> and can be used for signing.</p>
@@ -460,7 +460,7 @@ <h1 id="constructing-and-signing-transactions---taproot"><a class="header" href=
460460
<ul>
461461
<li><code>input_index</code> is the index of the input we are signing; it is a <a href="https://doc.rust-lang.org/std/primitive.usize.html"><code>usize</code></a> type.
462462
We are using <code>0</code> since we only have one input.</li>
463-
<li><code>&amp;prevouts</code> is a refence to the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html"><code>Prevouts</code></a> enum that we defined earlier.
463+
<li><code>&amp;prevouts</code> is a reference to the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html"><code>Prevouts</code></a> enum that we defined earlier.
464464
This is used to reference the outputs of previous transactions and also used to calculate our transaction value.</li>
465465
<li><code>annex</code> is an optional argument that is used to pass the annex data.
466466
We are not using it, so we are passing <code>None</code>.</li>
@@ -476,7 +476,7 @@ <h1 id="constructing-and-signing-transactions---taproot"><a class="header" href=
476476
This is a the message that we will sign.
477477
The <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E">Message::from</a> method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.</p>
478478
<p>We compute the signature <code>sig</code> by using the <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_schnorr"><code>sign_schnorr</code></a> method.
479-
It takes a refence to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html"><code>Keypair</code></a> as arguments,
479+
It takes a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html"><code>Message</code></a> and a reference to a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html"><code>Keypair</code></a> as arguments,
480480
and returns a <a href="https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html"><code>Signature</code></a> type.</p>
481481
<p>In the next step, we update the witness stack for the input we just signed by first converting the <code>sighash_cache</code> into a <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html"><code>Transaction</code></a>
482482
by using the <a href="https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/struct.SighashCache.html#method.into_transaction"><code>into_transaction</code></a> method.
@@ -493,7 +493,7 @@ <h1 id="constructing-and-signing-transactions---taproot"><a class="header" href=
493493
This is due to the fact that we need to pay a fee for the transaction.</p>
494494
</div>
495495
<div class="footnote-definition" id="expect"><sup class="footnote-definition-label">2</sup>
496-
<p>We will be unwraping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
496+
<p>We will be unwrapping any <a href="https://doc.rust-lang.org/std/option"><code>Option&lt;T&gt;</code></a>/<a href="https://doc.rust-lang.org/std/result"><code>Result&lt;T, E&gt;</code></a>
497497
with the <code>expect</code> method.</p>
498498
</div>
499499
<div class="footnote-definition" id="secp"><sup class="footnote-definition-label">3</sup>

0 commit comments

Comments
 (0)