File tree Expand file tree Collapse file tree 3 files changed +14
-22
lines changed Expand file tree Collapse file tree 3 files changed +14
-22
lines changed Original file line number Diff line number Diff line change @@ -34,21 +34,16 @@ Mathematically, a Finite Field is defined as follows:
34
34
35
35
A finite set of numbers and two operations *+* (addition) and *⋅* (multiplication) that satisfy the following:
36
36
37
- 1.
38
- If *a* and *b* are in the set, *a+b* and *a⋅b* are in the set.
39
- We call this property _closed_
40
- 2.
41
- The additive identity, *0* exists.
37
+ 1. If *a* and *b* are in the set, *a+b* and *a⋅b* are in the set.
38
+ We call this property _closed_.
39
+ 2. The additive identity, *0* exists.
42
40
This means *a + 0 = a*
43
- 3.
44
- The multiplicative identity, *1* exists.
41
+ 3. The multiplicative identity, *1* exists.
45
42
This means *a ⋅ 1 = a*
46
- 4.
47
- If *a* is in the set, *-a* is in the set.
43
+ 4. If *a* is in the set, *-a* is in the set.
48
44
*-a* is defined as the value that makes *a + (-a) = 0*.
49
45
This is what we call the _additive inverse_.
50
- 5.
51
- If *a* is in the set and is not 0, *a^-1^* is in the set.
46
+ 5. If *a* is in the set and is not 0, *a^-1^* is in the set.
52
47
*a^-1^* is defined as the value that makes *a ⋅ a^-1^ = 1*.
53
48
This is what we call the _multiplicative inverse_.
54
49
Original file line number Diff line number Diff line change 3
3
== Transaction Creation and Validation
4
4
5
5
[.lead]
6
- One of the trickiest things to code in Bitcoin is the validating transactions.
7
- Another one is the act of creating the transaction itself .
8
- In this chapter, we'll cover the exact steps to validating transactions and creating transactions .
9
- In fact , we'll be creating a transaction for ourselves .
6
+ One of the trickiest things to code in Bitcoin is validating transactions.
7
+ Another one is creating transactions .
8
+ In this chapter, we'll cover the exact steps to doing both .
9
+ Towards the end of this chapter , we'll be creating a testnet transaction and broadcasting it .
10
10
11
11
=== Validating Transactions
12
12
13
13
Every node, when receiving transactions makes sure that each transaction adheres to the network rules.
14
14
This process is called _transaction validation_.
15
15
Here are the main things that a node needs to check for:
16
16
17
- 1.
18
- Inputs of the transaction are previously unspent
19
- 2.
20
- Sum of the inputs are greater than or equal to the sum of the outputs
21
- 3.
22
- ScriptSig actually unlocks the previous ScriptPubKey
17
+ 1. Inputs of the transaction are previously unspent
18
+ 2. Sum of the inputs are greater than or equal to the sum of the outputs
19
+ 3. ScriptSig actually unlocks the previous ScriptPubKey
23
20
24
21
(1) prevents double-spending.
25
22
Any input that's already been spent cannot be spent again.
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ We could also be clever and use `len(bin(total))-2`.
268
268
<2> The merkle tree will hold the root level at index 0, the level below at index 1 and so on.
269
269
In other words, the index is the "depth" from the top.
270
270
<3> We have to go up to `max_depth + 1` as `range` goes to 1 less than the second argument in Python.
271
- <4> The number of items at any particular level is the number of total leaves divided halved at evry level above the leaf level, rounded up.
271
+ <4> The number of items at any particular level is the number of total leaves halved at every level above the leaf level, rounded up.
272
272
<5> We don't know yet what any of the hashes are, so we set them to `None`
273
273
<6> Note again that `merkle_tree` is a list of lists of hashes, or a 2-dimensional array.
274
274
You can’t perform that action at this time.
0 commit comments