Skip to content

Latest commit

 

History

History
714 lines (529 loc) · 14.1 KB

appa.asciidoc

File metadata and controls

714 lines (529 loc) · 14.1 KB

Appendix A: Solutions

class FieldElement:
...
link:code-ch01/answers.py[role=include]
link:code-ch01/answers.py[role=include]
class FieldElement:
...
link:code-ch01/answers.py[role=include]
link:code-ch01/answers.py[role=include]
link:code-ch01/answers.py[role=include]

When sorted, the results are always the same set.

class FieldElement:
...
link:code-ch01/answers.py[role=include]
link:code-ch01/answers.py[role=include]
link:code-ch01/answers.py[role=include]
class FieldElement:
...
link:code-ch01/answers.py[role=include]

[chapter_elliptic_curves]: Elliptic Curves

link:code-ch02/answers.py[role=include]
class Point:
...
link:code-ch02/answers.py[role=include]
class Point:
...
link:code-ch02/answers.py[role=include]
link:code-ch02/answers.py[role=include]
class Point:
...
    def __add__(self, other):
    ...
link:code-ch02/answers.py[role=include]
link:code-ch02/answers.py[role=include]
class Point:
...
    def __add__(self, other):
    ...
link:code-ch02/answers.py[role=include]

[chapter_elliptic_curve_cryptography]: Elliptic Curve Cryptography

link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch03/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]
link:code-ch04/answers.py[role=include]

[chapter_tx_parsing]: Transactions

class Tx:
...
link:code-ch05/answers.py[role=include]
class Tx:
...
link:code-ch05/answers.py[role=include]
...

class TxIn:
...
link:code-ch05/answers.py[role=include]
class Tx:
...
link:code-ch05/answers.py[role=include]
...

class TxOut:
...
link:code-ch05/answers.py[role=include]
class Tx:
...
link:code-ch05/answers.py[role=include]
link:code-ch05/answers.py[role=include]
class Tx:
...
link:code-ch05/answers.py[role=include]
link:code-ch06/answers.py[role=include]
link:code-ch06/answers.py[role=include]
link:code-ch06/answers.py[role=include]

OP_2 or 52 will satisfy the equation x2 + x – 6 = 0.

link:code-ch06/answers.py[role=include]
  1. collision1 and collision2 are from the SHA-1 preimages that Google found to collide.

This is looking for a SHA-1 collision. The only way to satisfy this script is to give x and y such that x≠y but sha1(x)=sha1(y).

[chapter_tx]: Transaction Creation and Validation

class Tx:
...
link:code-ch07/answers.py[role=include]
class Tx:
...
link:code-ch07/answers.py[role=include]
class Tx:
...
link:code-ch07/answers.py[role=include]
link:code-ch07/answers.py[role=include]
link:code-ch07/answers.py[role=include]

[chapter_p2sh]: Pay to Script Hash

link:code-ch08/answers.py[role=include]
link:code-ch08/answers.py[role=include]
link:code-ch08/answers.py[role=include]
link:code-ch08/answers.py[role=include]
class Tx:
...
link:code-ch08/answers.py[role=include]
class Tx:
...
link:code-ch09/answers.py[role=include]
class Tx:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
class Block:
...
link:code-ch09/answers.py[role=include]
link:code-ch09/answers.py[role=include]
link:code-ch09/answers.py[role=include]
link:code-ch10/answers.py[role=include]
class NetworkEnvelope:
...
link:code-ch10/answers.py[role=include]
class NetworkEnvelope:
...
link:code-ch10/answers.py[role=include]
class VersionMessage:
...
link:code-ch10/answers.py[role=include]
class SimpleNode:
...
link:code-ch10/answers.py[role=include]
class GetHeadersMessage:
...
link:code-ch10/answers.py[role=include]

[chapter_spv]: Simplified Payment Verification

link:code-ch11/answers.py[role=include]
link:code-ch11/answers.py[role=include]
link:code-ch11/answers.py[role=include]
class Block:
...
link:code-ch11/answers.py[role=include]
link:code-ch11/answers.py[role=include]
class MerkleBlock:
...
link:code-ch11/answers.py[role=include]
class MerkleBlock:
...
link:code-ch11/answers.py[role=include]
link:code-ch12/answers.py[role=include]
link:code-ch12/answers.py[role=include]
class BloomFilter:
...
link:code-ch12/answers.py[role=include]
class BloomFilter:
...
link:code-ch12/answers.py[role=include]
class GetDataMessage:
...
link:code-ch12/answers.py[role=include]
link:code-ch12/answers.py[role=include]