mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-11-29 03:18:33 +00:00
math tweak check
This commit is contained in:
parent
b4576263bb
commit
78ec958c82
@ -117,7 +117,7 @@ use to pick that number does not matter as long as it is not predictable
|
|||||||
or repeatable. Bitcoin software uses cryptographically secure random
|
or repeatable. Bitcoin software uses cryptographically secure random
|
||||||
number generators to produce 256 bits of entropy.
|
number generators to produce 256 bits of entropy.
|
||||||
|
|
||||||
More precisely, the private key can be any number between 0 and n -
|
More precisely, the private key can be any number between 0 and _n_ -
|
||||||
1 inclusive, where _n_ is a constant (_n_ = 1.1578 × 10^77^, slightly less
|
1 inclusive, where _n_ is a constant (_n_ = 1.1578 × 10^77^, slightly less
|
||||||
than 2^256^) defined as the order of the elliptic curve used in Bitcoin
|
than 2^256^) defined as the order of the elliptic curve used in Bitcoin
|
||||||
(see <<elliptic_curve>>). To create such a key, we randomly pick a
|
(see <<elliptic_curve>>). To create such a key, we randomly pick a
|
||||||
@ -343,10 +343,10 @@ find the public key _K_:
|
|||||||
|
|
||||||
[source, python]
|
[source, python]
|
||||||
----
|
----
|
||||||
K = 1E99423A4ED27608A15A2616A2B0E9E52CED330AC530EDCC32C8FFC6A526AEDD * G
|
K = 1E99423A4ED27608A15A2616A2B0E9E52CED330AC530EDCC32C8FFC6A526AEDD × G
|
||||||
----
|
----
|
||||||
|
|
||||||
Public key _K_ is defined as a point K = (x, y):
|
Public key _K_ is defined as a point _K_ = (_x_, _y_):
|
||||||
|
|
||||||
[latexmath]
|
[latexmath]
|
||||||
++++
|
++++
|
||||||
@ -1085,9 +1085,9 @@ The "32" stands for the number of characters in the bech32 alphabet
|
|||||||
.Bech32 typo detection
|
.Bech32 typo detection
|
||||||
====
|
====
|
||||||
Address:
|
Address:
|
||||||
bc1p9nh05ha8wrljf7ru236awpass:[<u>n</u>]4t2x0d5ctkkywm**v**9sclnm4t0av2vgs4k3au7
|
bc1p9nh05ha8wrljf7ru236awpass:[<u><em>n</em></u>]4t2x0d5ctkkywmpass:[<u><em>v</em></u>]9sclnm4t0av2vgs4k3au7
|
||||||
|
|
||||||
Detected errors shown in bold. Generated using the
|
Detected errors shown in bold and underlined. Generated using the
|
||||||
https://oreil.ly/paWIx[bech32 address decoder demo].
|
https://oreil.ly/paWIx[bech32 address decoder demo].
|
||||||
====
|
====
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ simply adding the same value to both sides of the equation:
|
|||||||
[latexmath]
|
[latexmath]
|
||||||
++++
|
++++
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
K + (123 \times G) =\!= (k + 123) \times G
|
K + (123 \times G) =\!\!\!= (k + 123) \times G
|
||||||
\end{equation}
|
\end{equation}
|
||||||
++++
|
++++
|
||||||
|
|
||||||
|
@ -845,8 +845,10 @@ Nonlinear::
|
|||||||
significantly slows down operations and which, in some cases, has
|
significantly slows down operations and which, in some cases, has
|
||||||
resulted in software accidentally leaking private keys.
|
resulted in software accidentally leaking private keys.
|
||||||
|
|
||||||
Looking at the math of ECDSA,
|
==== ECDSA Algorithm
|
||||||
signatures are created by a mathematical function _F_~_sig_~
|
|
||||||
|
Let's look at the math of ECDSA.
|
||||||
|
Signatures are created by a mathematical function _F_~_sig_~
|
||||||
that produces a signature composed of two values. In ECDSA, those two
|
that produces a signature composed of two values. In ECDSA, those two
|
||||||
values are _R_ and _s_.
|
values are _R_ and _s_.
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ is:
|
|||||||
|
|
||||||
++++
|
++++
|
||||||
<ul class="simplelist">
|
<ul class="simplelist">
|
||||||
<li>target = coefficient * 2<sup>(8*(exponent – 3))</sup></li>
|
<li>target = coefficient × 2<sup>(8 × (exponent – 3))</sup></li>
|
||||||
</ul>
|
</ul>
|
||||||
++++
|
++++
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ Using that formula, and the difficulty bits value 0x1903a30c, we get:
|
|||||||
</ul>
|
</ul>
|
||||||
++++
|
++++
|
||||||
|
|
||||||
which in decimal is:
|
which is:
|
||||||
|
|
||||||
++++
|
++++
|
||||||
<ul class="simplelist">
|
<ul class="simplelist">
|
||||||
@ -941,7 +941,7 @@ resulting in a retargeting bias toward higher difficulty by 0.05%.
|
|||||||
<<retarget_code>> shows the code used in the Bitcoin Core client.
|
<<retarget_code>> shows the code used in the Bitcoin Core client.
|
||||||
|
|
||||||
[[retarget_code]]
|
[[retarget_code]]
|
||||||
.Retargeting the proof of work—[.plain]#++CalculateNextWorkRequired()++# in pow.cpp
|
.Retargeting the proof of work[.plain]#—++CalculateNextWorkRequired()++# in pow.cpp
|
||||||
====
|
====
|
||||||
[source,cpp]
|
[source,cpp]
|
||||||
----
|
----
|
||||||
|
@ -125,9 +125,11 @@ Watch us on YouTube: link:$$https://youtube.com/oreillymedia$$[].
|
|||||||
|
|
||||||
=== Contacting the Authors
|
=== Contacting the Authors
|
||||||
|
|
||||||
[role="align"]
|
++++
|
||||||
|
<p class="align">
|
||||||
You can contact Andreas M. Antonopoulos on his personal site:
|
You can contact Andreas M. Antonopoulos on his personal site:
|
||||||
[.keep-together]#link:$$https://antonopoulos.com$$[].#
|
<span class="keep-together"><a href="https://antonopoulos.com">https://antonopoulos.com</a>.</span></p>
|
||||||
|
++++
|
||||||
|
|
||||||
Follow Andreas on Facebook:
|
Follow Andreas on Facebook:
|
||||||
link:$$https://facebook.com/AndreasMAntonopoulos$$[].
|
link:$$https://facebook.com/AndreasMAntonopoulos$$[].
|
||||||
|
Loading…
Reference in New Issue
Block a user