Skip to content

Commit 6860d7b

Browse files
committed
edits to ch07, ch08, ch09
1 parent 48eaeca commit 6860d7b

27 files changed

Lines changed: 323 additions & 350 deletions

File tree

ch07.asciidoc

Lines changed: 99 additions & 96 deletions
Large diffs are not rendered by default.

ch08.asciidoc

Lines changed: 93 additions & 96 deletions
Large diffs are not rendered by default.

ch09.asciidoc

Lines changed: 96 additions & 95 deletions
Large diffs are not rendered by default.

code-ch01/Chapter1.ipynb

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"source": [
121121
"### Exercise 3\n",
122122
"\n",
123-
"Write the corresponding `__sub__` method which defines the subtraction of two field elements.\n",
123+
"Write the corresponding `__sub__` method which defines the subtraction of two `FieldElement`s.\n",
124124
"\n",
125125
"#### Make [this test](/edit/code-ch01/ecc.py) pass: `ecc.py:FieldElementTest:test_sub`"
126126
]
@@ -213,7 +213,7 @@
213213
"source": [
214214
"### Exercise 6\n",
215215
"\n",
216-
"Write the corresponding `__mul__` method which defines the multiplication of two field elements.\n",
216+
"Write the corresponding `__mul__` method which defines the multiplication of two Finite Field elements.\n",
217217
"\n",
218218
"#### Make [this test](/edit/code-ch01/ecc.py) pass: `ecc.py:FieldElementTest:test_mul`"
219219
]
@@ -248,7 +248,7 @@
248248
"source": [
249249
"### Exercise 7\n",
250250
"\n",
251-
"For p = 7, 11, 17, 31, 43, what is this set in \\\\(F_{p}\\\\)?\n",
251+
"For p = 7, 11, 17, 31, what is this set in \\\\(F_{p}\\\\)?\n",
252252
"\n",
253253
"{\\\\(1^{(p-1)}\\\\), \\\\(2^{(p-1)}\\\\), \\\\(3^{(p-1)}\\\\), \\\\(4^{(p-1)}\\\\), ... \\\\((p-1)^{(p-1)}\\\\)}"
254254
]
@@ -328,25 +328,7 @@
328328
]
329329
}
330330
],
331-
"metadata": {
332-
"kernelspec": {
333-
"display_name": "Python 3",
334-
"language": "python",
335-
"name": "python3"
336-
},
337-
"language_info": {
338-
"codemirror_mode": {
339-
"name": "ipython",
340-
"version": 3
341-
},
342-
"file_extension": ".py",
343-
"mimetype": "text/x-python",
344-
"name": "python",
345-
"nbconvert_exporter": "python",
346-
"pygments_lexer": "ipython3",
347-
"version": "3.5.2"
348-
}
349-
},
331+
"metadata": {},
350332
"nbformat": 4,
351333
"nbformat_minor": 2
352334
}

code-ch02/Chapter2.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"source": [
9696
"### Exercise 3\n",
9797
"\n",
98-
"Handle the case where the two points are additive inverses. That is, they have the same x, but a different y, causing a vertical line. This should return the point at infinity.\n",
98+
"Handle the case where the two points are additive inverses. That is, they have the same `x`, but a different `y`, causing a vertical line. This should return the point at infinity.\n",
9999
"\n",
100100
"#### Make [this test](/edit/code-ch02/ecc.py) pass: `ecc.py:PointTest:test_add0`"
101101
]

code-ch05/tx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __repr__(self):
8585
tx_outs = ''
8686
for tx_out in self.tx_outs:
8787
tx_outs += tx_out.__repr__() + '\n'
88-
return 'tx: {}\nversion: {}\ntx_ins:\n{}\ntx_outs:\n{}\nlocktime: {}\n'.format(
88+
return 'tx: {}\nversion: {}\ntx_ins:\n{}tx_outs:\n{}locktime: {}'.format(
8989
self.id(),
9090
self.version,
9191
tx_ins,

code-ch06/tx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __repr__(self):
8383
tx_outs = ''
8484
for tx_out in self.tx_outs:
8585
tx_outs += tx_out.__repr__() + '\n'
86-
return 'tx: {}\nversion: {}\ntx_ins:\n{}\ntx_outs:\n{}\nlocktime: {}\n'.format(
86+
return 'tx: {}\nversion: {}\ntx_ins:\n{}tx_outs:\n{}locktime: {}'.format(
8787
self.id(),
8888
self.version,
8989
tx_ins,

code-ch07/Chapter7.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"source": [
117117
"### Exercise 2\n",
118118
"\n",
119-
"Write the `verify_input` method for the `Tx` class. You will want to use the `TxIn.script_pubkey()`, `Script.evaluate()` methods and the `SIGHASH_ALL` constant.\n",
119+
"Write the `verify_input` method for the `Tx` class. You will want to use the `TxIn.script_pubkey()`, `Tx.sig_hash()` and `Script.evaluate()` methods.\n",
120120
"\n",
121121
"#### Make [this test](/edit/code-ch07/tx.py) pass: `tx.py:TxTest:test_verify_p2pkh`"
122122
]

code-ch07/answers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def sig_hash(self, input_index):
5151
# tag::exercise2[]
5252
==== Exercise 2
5353
54-
Write the `verify_input` method for the `Tx` class. You will want to use the `TxIn.script_pubkey()`, `Script.evaluate()` methods and the `SIGHASH_ALL` constant.
54+
Write the `verify_input` method for the `Tx` class. You will want to use the `TxIn.script_pubkey()`, `Tx.sig_hash()` and `Script.evaluate()` methods.
5555
# end::exercise2[]
5656
"""
5757

code-ch07/examples.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@
7575
version: 1
7676
tx_ins:
7777
0d6fe5213c0b3291f208cba8bfb59b7476dffacc4e5cb66f6eb20a080843a299:13
78-
<BLANKLINE>
7978
tx_outs:
8079
33000000:OP_DUP OP_HASH160 d52ad7ca9b3d096a38e752c2018e6fbc40cdf26f OP_EQUALVERIFY OP_CHECKSIG
8180
10000000:OP_DUP OP_HASH160 507b27411ccf7f16f10297de6cef3f291623eddf OP_EQUALVERIFY OP_CHECKSIG
82-
<BLANKLINE>
8381
locktime: 0
84-
<BLANKLINE>
8582
8683
# end::example5[]
8784
# tag::example6[]

0 commit comments

Comments
 (0)