File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,21 +34,16 @@ Mathematically, a Finite Field is defined as follows:
3434
3535A finite set of numbers and two operations *+* (addition) and *⋅* (multiplication) that satisfy the following:
3636
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.
4240This means *a + 0 = a*
43- 3.
44- The multiplicative identity, *1* exists.
41+ 3. The multiplicative identity, *1* exists.
4542This 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.
4844*-a* is defined as the value that makes *a + (-a) = 0*.
4945This 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.
5247*a^-1^* is defined as the value that makes *a ⋅ a^-1^ = 1*.
5348This is what we call the _multiplicative inverse_.
5449
Original file line number Diff line number Diff line change 33== Transaction Creation and Validation
44
55[.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 .
1010
1111=== Validating Transactions
1212
1313Every node, when receiving transactions makes sure that each transaction adheres to the network rules.
1414This process is called _transaction validation_.
1515Here are the main things that a node needs to check for:
1616
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
2320
2421(1) prevents double-spending.
2522Any 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`.
268268<2> The merkle tree will hold the root level at index 0, the level below at index 1 and so on.
269269In other words, the index is the "depth" from the top.
270270<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.
272272<5> We don't know yet what any of the hashes are, so we set them to `None`
273273<6> Note again that `merkle_tree` is a list of lists of hashes, or a 2-dimensional array.
274274
You can’t perform that action at this time.
0 commit comments