tx-engine 0.6.6__tar.gz → 0.6.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. tx_engine-0.6.7/.github/workflows/on_push.yml +65 -0
  2. {tx_engine-0.6.6 → tx_engine-0.6.7}/Cargo.lock +35 -23
  3. {tx_engine-0.6.6 → tx_engine-0.6.7}/Cargo.toml +3 -2
  4. tx_engine-0.6.7/PKG-INFO +287 -0
  5. tx_engine-0.6.6/docs/PythonClasses.md → tx_engine-0.6.7/README.md +52 -5
  6. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/Releases.md +2 -1
  7. tx_engine-0.6.7/docs/diagrams/python_classes.png +0 -0
  8. tx_engine-0.6.7/docs/diagrams/python_classes.puml +135 -0
  9. {tx_engine-0.6.6 → tx_engine-0.6.7}/pyproject.toml +1 -1
  10. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/breakpoints.py +18 -10
  11. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/debug_context.py +18 -6
  12. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/debug_interface.py +27 -6
  13. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/script_state.py +29 -7
  14. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/stack_frame.py +11 -2
  15. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/requirements.txt +1 -0
  16. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_bit_twiddling.py +5 -4
  17. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_bsv.py +2 -1
  18. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_debug.py +5 -2
  19. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_debugger.py +4 -1
  20. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_ec.py +2 -3
  21. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_if.py +2 -1
  22. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_interface.py +5 -0
  23. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_op.py +2 -1
  24. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_parse.py +5 -1
  25. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_script.py +5 -0
  26. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_sign.py +12 -6
  27. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_tx.py +6 -2
  28. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_wallet.py +51 -2
  29. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/__init__.py +2 -1
  30. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/engine/context.py +12 -2
  31. tx_engine-0.6.7/python/src/tx_engine/engine/cryptography_utils.py +28 -0
  32. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/engine/engine_types.py +2 -0
  33. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/engine/op_code_names.py +2 -0
  34. tx_engine-0.6.7/python/src/tx_engine/engine/op_codes.py +126 -0
  35. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/engine/util.py +16 -16
  36. tx_engine-0.6.7/python/src/tx_engine/interface/blockchain_interface.py +84 -0
  37. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/interface_factory.py +4 -0
  38. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/mock_interface.py +3 -2
  39. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/rpc_interface.py +43 -28
  40. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/verify_script.py +22 -20
  41. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/woc.py +6 -5
  42. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/woc_interface.py +13 -7
  43. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/tx/sighash.py +2 -0
  44. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/mod.rs +43 -5
  45. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/py_tx.rs +1 -1
  46. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/py_wallet.rs +197 -6
  47. {tx_engine-0.6.6 → tx_engine-0.6.7}/tools/dbg.py +15 -4
  48. {tx_engine-0.6.6 → tx_engine-0.6.7}/tools/generate_key.py +2 -3
  49. tx_engine-0.6.6/PKG-INFO +0 -164
  50. tx_engine-0.6.6/README.md +0 -145
  51. tx_engine-0.6.6/python/src/debugger/decode_op.py +0 -60
  52. tx_engine-0.6.6/python/src/tx_engine/engine/decode_op.py +0 -38
  53. tx_engine-0.6.6/python/src/tx_engine/engine/op_codes.py +0 -122
  54. tx_engine-0.6.6/python/src/tx_engine/interface/blockchain_interface.py +0 -79
  55. {tx_engine-0.6.6 → tx_engine-0.6.7}/.github/workflows/CI.yml +0 -0
  56. {tx_engine-0.6.6 → tx_engine-0.6.7}/.gitignore +0 -0
  57. {tx_engine-0.6.6 → tx_engine-0.6.7}/LICENSE +0 -0
  58. {tx_engine-0.6.6 → tx_engine-0.6.7}/LICENSE-rust-sv +0 -0
  59. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/Development.md +0 -0
  60. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/README-chain-gang.md +0 -0
  61. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/Requirements +0 -0
  62. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/debugger.png +0 -0
  63. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/debugger.puml +0 -0
  64. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/keys.png +0 -0
  65. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/keys.puml +0 -0
  66. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/overview.png +0 -0
  67. {tx_engine-0.6.6 → tx_engine-0.6.7}/docs/diagrams/overview.puml +0 -0
  68. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/examples/README.md +0 -0
  69. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/examples/add.bs +0 -0
  70. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/examples/swap.bs +0 -0
  71. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/lint.sh +0 -0
  72. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/__init__.py +0 -0
  73. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/debugger/util.py +0 -0
  74. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/README.md +0 -0
  75. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tests/test_fed.py +0 -0
  76. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/engine/__init__.py +0 -0
  77. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/interface/__init__.py +0 -0
  78. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/src/tx_engine/tx/__init__.py +0 -0
  79. {tx_engine-0.6.6 → tx_engine-0.6.7}/python/tests.sh +0 -0
  80. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/address/mod.rs +0 -0
  81. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/interface/blockchain_interface.rs +0 -0
  82. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/interface/mod.rs +0 -0
  83. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/interface/test_interface.rs +0 -0
  84. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/interface/woc_interface.rs +0 -0
  85. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/lib.rs +0 -0
  86. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/addr.rs +0 -0
  87. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/authch.rs +0 -0
  88. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/block.rs +0 -0
  89. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/block_header.rs +0 -0
  90. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/block_locator.rs +0 -0
  91. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/blocktxn.rs +0 -0
  92. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/cmpctblock.rs +0 -0
  93. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/createstrm.rs +0 -0
  94. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/fee_filter.rs +0 -0
  95. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/filter_add.rs +0 -0
  96. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/filter_load.rs +0 -0
  97. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/getblocktxn.rs +0 -0
  98. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/headers.rs +0 -0
  99. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/inv.rs +0 -0
  100. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/inv_vect.rs +0 -0
  101. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/merkle_block.rs +0 -0
  102. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/message.rs +0 -0
  103. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/message_header.rs +0 -0
  104. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/mod.rs +0 -0
  105. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/node_addr.rs +0 -0
  106. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/node_addr_ex.rs +0 -0
  107. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/out_point.rs +0 -0
  108. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/ping.rs +0 -0
  109. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/protoconf.rs +0 -0
  110. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/reject.rs +0 -0
  111. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/send_cmpct.rs +0 -0
  112. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/streamack.rs +0 -0
  113. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/tx.rs +0 -0
  114. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/tx_in.rs +0 -0
  115. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/tx_out.rs +0 -0
  116. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/messages/version.rs +0 -0
  117. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/network/mod.rs +0 -0
  118. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/network/network.rs +0 -0
  119. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/network/seed_iter.rs +0 -0
  120. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/peer/atomic_reader.rs +0 -0
  121. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/peer/mod.rs +0 -0
  122. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/peer/peer.rs +0 -0
  123. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/base58_checksum.rs +0 -0
  124. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/hashes.rs +0 -0
  125. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/op_code_names.rs +0 -0
  126. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/python/py_script.rs +0 -0
  127. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/script/checker.rs +0 -0
  128. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/script/interpreter.rs +0 -0
  129. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/script/mod.rs +0 -0
  130. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/script/op_codes.rs +0 -0
  131. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/script/stack.rs +0 -0
  132. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/transaction/mod.rs +0 -0
  133. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/transaction/p2pkh.rs +0 -0
  134. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/transaction/sighash.rs +0 -0
  135. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/bits.rs +0 -0
  136. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/bloom_filter.rs +0 -0
  137. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/future.rs +0 -0
  138. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/hash160.rs +0 -0
  139. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/hash256.rs +0 -0
  140. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/latch.rs +0 -0
  141. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/mod.rs +0 -0
  142. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/result.rs +0 -0
  143. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/rx.rs +0 -0
  144. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/serdes.rs +0 -0
  145. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/sha1.rs +0 -0
  146. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/sha256.rs +0 -0
  147. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/util/var_int.rs +0 -0
  148. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/extended_key.rs +0 -0
  149. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/mnemonic.rs +0 -0
  150. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/mod.rs +0 -0
  151. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/chinese_simplified.txt +0 -0
  152. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/chinese_traditional.txt +0 -0
  153. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/english.txt +0 -0
  154. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/french.txt +0 -0
  155. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/italian.txt +0 -0
  156. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/japanese.txt +0 -0
  157. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/korean.txt +0 -0
  158. {tx_engine-0.6.6 → tx_engine-0.6.7}/src/wallet/wordlists/spanish.txt +0 -0
  159. {tx_engine-0.6.6 → tx_engine-0.6.7}/tools/README.md +0 -0
@@ -0,0 +1,65 @@
1
+ name: On Push
2
+ on: [push]
3
+ permissions:
4
+ contents: read
5
+
6
+ jobs:
7
+ python-lint:
8
+ name: Lint Python
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout branch code
12
+ uses: actions/checkout@v4
13
+ - name: Install Python
14
+ uses: actions/setup-python@v5
15
+ with:
16
+ python-version: '3.12'
17
+ cache: 'pip'
18
+ - name: Lint Python
19
+ working-directory: python
20
+ run: |
21
+ pip install mypy flake8 types-requests --root-user-action=ignore
22
+ flake8 --ignore=E501,E131,E402,E722 src ../tools
23
+ mypy --check-untyped-defs --ignore-missing-imports src ../tools
24
+
25
+ rust-test:
26
+ name: Rust Tests
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - name: Checkout branch code
30
+ uses: actions/checkout@v4
31
+ - name: Install Rust
32
+ uses: actions-rust-lang/setup-rust-toolchain@v1
33
+ with:
34
+ toolchain: stable
35
+ cache: true
36
+ - name: Rust Tests
37
+ run: cargo test --all-features
38
+
39
+ python-test:
40
+ name: Python Tests
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - name: Checkout branch code
44
+ uses: actions/checkout@v4
45
+ - name: Install Python
46
+ uses: actions/setup-python@v5
47
+ with:
48
+ python-version: '3.12'
49
+ cache: 'pip'
50
+ - name: Install Rust
51
+ uses: actions-rust-lang/setup-rust-toolchain@v1
52
+ with:
53
+ toolchain: stable
54
+ cache: true
55
+ - name: Clear wheel dir
56
+ run: rm target/wheels/* | true
57
+ - name: Maturin build
58
+ uses: PyO3/maturin-action@v1
59
+ with:
60
+ command: build --target-dir=target
61
+ - name: Install wheel
62
+ run: pip install --root-user-action=ignore --find-links=target/wheels tx-engine
63
+ - name: Python tests
64
+ working-directory: python
65
+ run: ./tests.sh
@@ -28,9 +28,9 @@ dependencies = [
28
28
 
29
29
  [[package]]
30
30
  name = "anyhow"
31
- version = "1.0.87"
31
+ version = "1.0.89"
32
32
  source = "registry+https://github.com/rust-lang/crates.io-index"
33
- checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8"
33
+ checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
34
34
 
35
35
  [[package]]
36
36
  name = "async-mutex"
@@ -132,15 +132,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
132
132
 
133
133
  [[package]]
134
134
  name = "bytes"
135
- version = "1.7.1"
135
+ version = "1.7.2"
136
136
  source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
137
+ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
138
138
 
139
139
  [[package]]
140
140
  name = "cc"
141
- version = "1.1.18"
141
+ version = "1.1.21"
142
142
  source = "registry+https://github.com/rust-lang/crates.io-index"
143
- checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476"
143
+ checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0"
144
144
  dependencies = [
145
145
  "shlex",
146
146
  ]
@@ -153,7 +153,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
153
153
 
154
154
  [[package]]
155
155
  name = "chain-gang"
156
- version = "0.6.6"
156
+ version = "0.6.7"
157
157
  dependencies = [
158
158
  "anyhow",
159
159
  "async-mutex",
@@ -171,6 +171,7 @@ dependencies = [
171
171
  "murmur3",
172
172
  "num-bigint",
173
173
  "num-traits",
174
+ "pbkdf2",
174
175
  "pyo3",
175
176
  "rand",
176
177
  "rand_core",
@@ -182,6 +183,7 @@ dependencies = [
182
183
  "sha1",
183
184
  "sha2",
184
185
  "snowflake",
186
+ "typenum",
185
187
  ]
186
188
 
187
189
  [[package]]
@@ -637,9 +639,9 @@ dependencies = [
637
639
 
638
640
  [[package]]
639
641
  name = "k256"
640
- version = "0.13.3"
642
+ version = "0.13.4"
641
643
  source = "registry+https://github.com/rust-lang/crates.io-index"
642
- checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
644
+ checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b"
643
645
  dependencies = [
644
646
  "cfg-if",
645
647
  "ecdsa",
@@ -864,6 +866,16 @@ dependencies = [
864
866
  "windows-targets 0.52.6",
865
867
  ]
866
868
 
869
+ [[package]]
870
+ name = "pbkdf2"
871
+ version = "0.12.2"
872
+ source = "registry+https://github.com/rust-lang/crates.io-index"
873
+ checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
874
+ dependencies = [
875
+ "digest",
876
+ "hmac",
877
+ ]
878
+
867
879
  [[package]]
868
880
  name = "percent-encoding"
869
881
  version = "2.3.1"
@@ -894,15 +906,15 @@ dependencies = [
894
906
 
895
907
  [[package]]
896
908
  name = "pkg-config"
897
- version = "0.3.30"
909
+ version = "0.3.31"
898
910
  source = "registry+https://github.com/rust-lang/crates.io-index"
899
- checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
911
+ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
900
912
 
901
913
  [[package]]
902
914
  name = "portable-atomic"
903
- version = "1.7.0"
915
+ version = "1.8.0"
904
916
  source = "registry+https://github.com/rust-lang/crates.io-index"
905
- checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265"
917
+ checksum = "d30538d42559de6b034bc76fd6dd4c38961b1ee5c6c56e3808c50128fdbc22ce"
906
918
 
907
919
  [[package]]
908
920
  name = "ppv-lite86"
@@ -1026,9 +1038,9 @@ dependencies = [
1026
1038
 
1027
1039
  [[package]]
1028
1040
  name = "redox_syscall"
1029
- version = "0.5.3"
1041
+ version = "0.5.4"
1030
1042
  source = "registry+https://github.com/rust-lang/crates.io-index"
1031
- checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
1043
+ checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853"
1032
1044
  dependencies = [
1033
1045
  "bitflags 2.6.0",
1034
1046
  ]
@@ -1129,9 +1141,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
1129
1141
 
1130
1142
  [[package]]
1131
1143
  name = "rustix"
1132
- version = "0.38.36"
1144
+ version = "0.38.37"
1133
1145
  source = "registry+https://github.com/rust-lang/crates.io-index"
1134
- checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36"
1146
+ checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811"
1135
1147
  dependencies = [
1136
1148
  "bitflags 2.6.0",
1137
1149
  "errno",
@@ -1199,9 +1211,9 @@ dependencies = [
1199
1211
 
1200
1212
  [[package]]
1201
1213
  name = "security-framework-sys"
1202
- version = "2.11.1"
1214
+ version = "2.12.0"
1203
1215
  source = "registry+https://github.com/rust-lang/crates.io-index"
1204
- checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf"
1216
+ checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6"
1205
1217
  dependencies = [
1206
1218
  "core-foundation-sys",
1207
1219
  "libc",
@@ -1491,15 +1503,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
1491
1503
 
1492
1504
  [[package]]
1493
1505
  name = "unicode-ident"
1494
- version = "1.0.12"
1506
+ version = "1.0.13"
1495
1507
  source = "registry+https://github.com/rust-lang/crates.io-index"
1496
- checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
1508
+ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
1497
1509
 
1498
1510
  [[package]]
1499
1511
  name = "unicode-normalization"
1500
- version = "0.1.23"
1512
+ version = "0.1.24"
1501
1513
  source = "registry+https://github.com/rust-lang/crates.io-index"
1502
- checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
1514
+ checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
1503
1515
  dependencies = [
1504
1516
  "tinyvec",
1505
1517
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "chain-gang"
3
- version = "0.6.6"
3
+ version = "0.6.7"
4
4
  description = "This is a library that enables monitoring of multiple blockchains (BTC, BCH, BSV)."
5
5
  # repository = "https://github.com/brentongunning/rust-sv"
6
6
  authors = ["Arthur Gordon <a.gordon@nchain.com>"]
@@ -27,9 +27,9 @@ sha2 = "0.10.8"
27
27
  k256 = { version = "0.13.3", features = ["alloc", "arithmetic", "digest", "ecdsa", "once_cell", "pkcs8", "precomputed-tables", "schnorr",
28
28
  "sha2", "sha256", "signature", "std"]}
29
29
  snowflake = "1.3"
30
-
31
30
  hmac = "0.12.1"
32
31
  base58 = "0.2.0"
32
+ pbkdf2 = "0.12.2"
33
33
 
34
34
  # Used by the interface feature
35
35
  serde = { version = "1.0.86", features = ["derive"], optional = true }
@@ -44,6 +44,7 @@ pyo3 = { version = "0.21.2", optional = true }
44
44
  regex = "1.10.5"
45
45
  lazy_static = "1.5.0"
46
46
  rand_core = "0.6.4"
47
+ typenum = "1.17"
47
48
 
48
49
 
49
50
  [lib]
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.3
2
+ Name: tx_engine
3
+ Version: 0.6.7
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ Requires-Dist: requests ==2.32.3
8
+ Requires-Dist: python-bitcoinrpc ==1.0
9
+ Requires-Dist: cryptography ==43.0.1
10
+ License-File: LICENSE
11
+ License-File: LICENSE-rust-sv
12
+ Summary: This library provides a Python interface for building BitcoinSV scripts and transactions.
13
+ Keywords: bitcoin,sv,cash,crypto
14
+ Author: Arthur Gordon <a.gordon@nchain.com>
15
+ Author-email: Arthur Gordon <a.gordon@nchain.com>
16
+ License: MIT
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
19
+
20
+ # TX Engine
21
+
22
+ This library provides a Python interface for building BitcoinSV scripts and transactions.
23
+
24
+ For documentation of the Python Classes see below.
25
+
26
+ # Python Installation
27
+ As this library is hosted on PyPi (https://pypi.org/project/tx-engine/) and is installed using:
28
+
29
+ ```bash
30
+ pip install tx-engine
31
+ ```
32
+
33
+ ## Example Tx class usage
34
+ So to parse a hex string to Tx:
35
+
36
+ ```python
37
+ from tx_engine import Tx
38
+
39
+ src_tx = "0100000001c7151ebaf14dbfe922bd90700a7580f6db7d5a1b898ce79cb9ce459e17f12909000000006b4830450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41210395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4cffffffff0103000000000000001976a91496795fb99fd6c0f214f7a0e96019f642225f52d288ac00000000"
40
+
41
+ tx = tx.parse_hexstr(src_tx)
42
+ print(tx)
43
+
44
+ > PyTx { version: 1, tx_ins: [PyTxIn { prev_tx: "0929f1179e45ceb99ce78c891b5a7ddbf680750a7090bd22e9bf4df1ba1e15c7", prev_index: 0, sequence: 4294967295, script_sig: [0x48 0x30450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41 0x21 0x0395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4c] }], tx_outs: [PyTxOut { amount: 3, script_pubkey: [OP_DUP OP_HASH160 0x14 0x96795fb99fd6c0f214f7a0e96019f642225f52d2 OP_EQUALVERIFY OP_CHECKSIG] }], locktime: 0 }
45
+ ```
46
+
47
+
48
+ # Overview of the tx-engine Classes
49
+ The tx-engine provides the following classes:
50
+
51
+ ![tx-engine classes](docs/diagrams/python_classes.png)
52
+
53
+ # Python Classes
54
+
55
+ This provides an overview of the Python Classes their properties and methods,
56
+ including:
57
+
58
+ * [Script](#script)
59
+ * [Context](#context)
60
+ * [Tx](#tx)
61
+ * [TxIn](#txin)
62
+ * [TxOut](#txout)
63
+ * [Wallet](#wallet)
64
+ * [Interface Factory](#interface-factory)
65
+ * [Blockchain Interface](#blockchain-interface)
66
+ * [Other Functions](#other-functions)
67
+
68
+ ## Script
69
+
70
+ The Script class represents bitcoin script.
71
+ For more details about bitcoin script see https://wiki.bitcoinsv.io/index.php/Script.
72
+
73
+ Script has the following property:
74
+ * `cmds` - byte arrary of bitcoin operations
75
+
76
+ Script has the following methods:
77
+
78
+ * `__init__(self, cmds: bytes=[]) -> Script` - Constructor that takes an array of bytes
79
+ * `append_byte(self, byte: byte)` - Appends a single opcode or data byte
80
+ * `append_data(self, data: bytes)` - Appends data (without OP_PUSHDATA)
81
+ * `append_pushdata(self, data: bytes)` - Appends the opcodes and provided data that push it onto the stack
82
+ * `raw_serialize(self) -> bytes` - Return the serialised script without the length prepended
83
+ * `serialize(self) -> bytes` - Return the serialised script with the length prepended
84
+ * `get_commands(self) -> bytes` - Return a copy of the commands in this script
85
+ * `__add__(self, other: Script) -> Script` - Enable script addition e.g. `c_script = a_script + b_script`
86
+ * `to_string(self) -> String` - return the script as a string, that can be parsed by `parse_string()`. Note also that you can just print the script (`print(script)`)
87
+ * `is_p2pkh(self) -> bool` - returns True if script is a Pay to Public Key Hash script
88
+
89
+
90
+ Script has the following class methods:
91
+ * `Script.parse_string(in_string: str) -> Script` - Converts a string of OP_CODES into a Script
92
+ * `Script.parse(in_bytes: bytes) -> Script` - Converts an array of bytes into a Script
93
+
94
+
95
+ ## Context
96
+
97
+ The `context` is the environment in which bitcoin scripts are executed.
98
+
99
+ Context has the following properties:
100
+ * `cmds` - the commands to execute
101
+ * `ip_limit` - the number of commands to execute before stopping (optional)
102
+ * z -
103
+ * `stack` - main data stack
104
+ * `alt_stack` - seconary stack
105
+ * `raw_stack` - which contains the `stack` prior to converting to numbers
106
+ * `raw_alt_stack` - as above for the `alt_stack`
107
+
108
+ Context has the following methods:
109
+
110
+ * `__init__(self, script: Script, cmds: Commands = None, ip_limit: int , z: bytes)` - constructor
111
+ * `evaluate_core(self, quiet: bool = False) -> bool` - evaluates the script/cmds using the the interpreter and returns the stacks (`raw_stack`, `raw_alt_stack`). if quiet is true, dont print exceptions
112
+ * `evaluate(self, quiet: bool = False) -> bool` - executes the script and decode stack elements to numbers (`stack`, `alt_stack`). Checks `stack` is true on return. if quiet is true, dont print exceptions.
113
+ * `get_stack(self) -> Stack` - Return the `stack` as human readable
114
+ * `get_altstack(self) -> Stack`- Return the `alt_stack` as human readable
115
+
116
+ Example from unit tests of using `evaluate_core` and `raw_stack`:
117
+ ```python
118
+ script = Script([OP_PUSHDATA1, 0x02, b"\x01\x02"])
119
+ context = Context(script=script)
120
+ self.assertTrue(context.evaluate_core())
121
+ self.assertEqual(context.raw_stack, [[1, 2]])
122
+ ```
123
+
124
+ ### Quiet Evalutation
125
+ Both `evaluate` and `evaluate_core` have a parameter `quiet`.
126
+ If the `quiet` parameter is set to `True` the `evaluate` function does not print out exceptions when executing code. This `quiet` parameter is currently only used in unit tests.
127
+
128
+
129
+ ## Tx
130
+
131
+ Tx represents a bitcoin transaction.
132
+
133
+ Tx has the following properties:
134
+ * `version` - unsigned integer
135
+ * `tx_ins` - array of `TxIn` classes,
136
+ * `tx_outs` - array of `TxOut` classes
137
+ * `locktime` - unsigned integer
138
+
139
+ Tx has the following methods:
140
+
141
+ * `__init__(version: int, tx_ins: [TxIn], tx_outs: [TxOut], locktime: int=0) -> Tx` - Constructor that takes the fields
142
+ * `id(self) -> str` - Return human-readable hexadecimal of the transaction hash
143
+ * `hash(self) -> bytes` - Return transaction hash as bytes
144
+ * `is_coinbase(self) -> bool` - Returns true if it is a coinbase transaction
145
+ * `serialize(self) -> bytes` - Returns Tx as bytes
146
+ * `copy(self) -> Tx` - Returns a copy of the Tx
147
+ * `to_string(self) -> String` - return the Tx as a string. Note also that you can just print the tx (`print(tx)`).
148
+ * `validate(self, [Tx]) -> Result` - provide the input txs, returns None on success and throws a RuntimeError exception on failure. Note can not validate coinbase or pre-genesis transactions.
149
+
150
+
151
+ Tx has the following class methods:
152
+
153
+ * `Tx.parse(in_bytes: bytes) -> Tx` - Parse bytes to produce Tx
154
+ * `Tx.parse_hexstr(in_hexstr: String) -> Tx` - Parse hex string to produce Tx
155
+
156
+ So to parse a hex string to Tx:
157
+ ```Python
158
+ from tx_engine import Tx
159
+
160
+ src_tx = "0100000001c7151ebaf14dbfe922bd90700a7580f6db7d5a1b898ce79cb9ce459e17f12909000000006b4830450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41210395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4cffffffff0103000000000000001976a91496795fb99fd6c0f214f7a0e96019f642225f52d288ac00000000"
161
+
162
+ tx = tx.parse_hexstr(src_tx)
163
+ print(tx)
164
+
165
+ PyTx { version: 1, tx_ins: [PyTxIn { prev_tx: "0929f1179e45ceb99ce78c891b5a7ddbf680750a7090bd22e9bf4df1ba1e15c7", prev_index: 0, sequence: 4294967295, script_sig: [0x48 0x30450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41 0x21 0x0395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4c] }], tx_outs: [PyTxOut { amount: 3, script_pubkey: [OP_DUP OP_HASH160 0x14 0x96795fb99fd6c0f214f7a0e96019f642225f52d2 OP_EQUALVERIFY OP_CHECKSIG] }], locktime: 0 }
166
+ ```
167
+
168
+
169
+ ## TxIn
170
+ TxIn represents is a bitcoin transaction input.
171
+
172
+ TxIn has the following properties:
173
+
174
+ * `prev_tx` - Transaction Id as hex string
175
+ * `prev_index` - unsigned int
176
+ * `script_sig` - Script
177
+ * `sequence` - int
178
+
179
+ TxIn has the following constructor method:
180
+ * `__init__(prev_tx: String, prev_index: int, script_sig: Script=[], sequence: int=0xFFFFFFFF) -> TxIn` - Constructor that takes the fields
181
+
182
+ Note txin can be printed using the standard print, for example:
183
+ ```Python
184
+ print(txin)
185
+ PyTxIn { prev_tx: "5c866b70189008586a4951d144df93dcca4d3a1b701e3786566f819450eca9ba", prev_index: 0, sequence: 4294967295, script_sig: [] }
186
+ ```
187
+
188
+
189
+ ## TxOut
190
+ TxOut represents a bitcoin transaction output.
191
+
192
+ TxOut has the following properties:
193
+
194
+ * `amount` - int
195
+ * `script_pubkey` - Script
196
+
197
+
198
+ TxOut has the following constructor method:
199
+
200
+ * `__init__(amount: int, script_pubkey: Script) -> TxOut` - Constructor that takes the fields
201
+
202
+ Note txin can be printed using the standard print, for example:
203
+ ```Python
204
+ print(txout)
205
+ PyTxOut { amount: 100, script_pubkey: [OP_DUP OP_HASH160 0x14 0x10375cfe32b917cd24ca1038f824cd00f7391859 OP_EQUALVERIFY OP_CHECKSIG] }
206
+ ```
207
+
208
+ ## Wallet
209
+ This class represents the Wallet functionality, including handling of private and public keys and signing transactions.
210
+
211
+ Wallet class has the following methods:
212
+
213
+ * `__init__(wif_key: str) -> Wallet` - Constructor that takes a private key in WIF format
214
+ * `sign_tx(self, index: int, input_tx: Tx, tx: Tx) -> Tx` - Sign a transaction input with the provided previous tx and sighash flags, Returns new signed tx
215
+ * `sign_tx_sighash(self, index: int, input_tx: Tx, tx: Tx, sighash_type: int) -> Tx` - Sign a transaction input with the provided previous tx and sighash flags, Returns new signed tx
216
+ * `get_locking_script(self) -> Script` - Returns a locking script based on the public key
217
+ * `get_public_key_as_hexstr(self) -> String` - Return the public key as a hex string
218
+ * `get_address(self) -> String` - Return the address based on the public key
219
+ * `to_wif(self) -> String` - Return the private key in WIF format
220
+ * `get_network(self) -> String` - Returns the current network associated with this keypair
221
+ * `to_int(self) -> Integer` - Returns the scaler value of the private key as a python integer
222
+ * `to_hex(self) -> String` - Returns the scaler value of the private key as a string in hex format
223
+
224
+ * `Wallet.generate_keypair(network) -> Wallet` - Given network (BSV_Testnet) return a keypair in Wallet format
225
+ * `Wallet.from_hexstr(network, hexstr) -> Wallet` - Given a network identifier and scalar value as a hex string, return a keypair in Wallet format
226
+ * `Wallet.from_bytes(network, bytes) -> Wallet` - Given a network identifier and a scalar value as a byte array, return a keypair in Wallet format
227
+ * `Wallet.from_int(network, integer) -> Wallet` - Given a network identifier and a scaler value as an integer, return a keypair in Wallet format
228
+
229
+ The library provides some additional helper functions to handle keys in different formats.
230
+ * `wif_to_bytes(wif: string) -> bytes` - Given a key in WIF format, it returns a byte array of the scalar value of the private key
231
+ * `bytes_to_wif(key_bytes, network) -> String` - Given a byte array and a network identifier, returns the WIF format for the private key
232
+ * `wif_from_pw_nonce(password, nonce, optional<network>) -> WIF` - Given a password, nonce (strings) return a WIF format for the private key. The default for the network is BSV_Mainnet. For a testnet format, please use BSv_Testnet
233
+
234
+
235
+ ![Bitcoin Keys](docs/diagrams/keys.png)
236
+
237
+
238
+ ## Interface Factory
239
+ The InterfaceFactory is class for creating interfaces to the BSV blockchain (`BlockchainInterface`).
240
+
241
+ The InterfaceFactory class one method:
242
+
243
+ * `set_config(self, config: ConfigType) -> BlockchainInterface` - This reads the configuration `interface_type` field and returns the configured `BlockchainInterface`
244
+
245
+ ## Blockchain Interface
246
+
247
+ The BlockchainInterface class provides an interface to the BSV network.
248
+
249
+ BlockchainInterface class has the following methods:
250
+
251
+ * `__init__(self)` - Constructor that takes no parameters
252
+ * `set_config(self, config)` - configures the interface based on the provide config
253
+ * `get_addr_history(self, address)` - Return the transaction history with this address
254
+ * `is_testnet(self) -> bool` - Return true if this interface is connected to BSV Testnet
255
+ * `get_utxo(self, address)` - Return the utxo associated with this address
256
+ * `get_balance(self, address)` - Return the balance associated with this address
257
+ * `get_block_count(self)` - Return the height of the chain
258
+ * `get_best_block_hash(self)` - Return the hash of the latest block
259
+ * `get_merkle_proof(self, block_hash: str, tx_id: str) -> str` - Given the block hash and tx_id return the merkle proof
260
+ * `get_transaction(self, txid: str)` - Return the transaction (as Dictionary) associated with this txid
261
+ * `get_raw_transaction(self, txid: str) -> Optional[str]` - Return the transaction (as kexstring) associated with this txid, use cached copy if available.
262
+ * `broadcast_tx(self, transaction: str)` - broadcast this tx to the network
263
+ * `get_block(self, blockhash: str) -> Dict` - Return the block given the block hash
264
+ * `get_block_header(self, blockhash: str) -> Dict` - Returns te block_header for a given block hash
265
+
266
+ ### WoC Interface
267
+ The `WoCInterface` is a `BlockchainInterface` that communicates with the WhatsOnChain API.
268
+ Note that if you are using this you will need to install the python library `requests`.
269
+
270
+ ### Mock Interface
271
+ The `Mock Interface` is a `BlockchainInterface` that is used for unit testing.
272
+
273
+ ### RPC Interface
274
+ The `RPC Interface` is a `BlockchainInterface` that is used for connecting to the RPC interface of mining nodes.
275
+
276
+
277
+ # Other Functions
278
+ These are public key and address functions that are likely to be used if you don't have the private key and
279
+ are not using the Wallet class.
280
+
281
+ * `address_to_public_key_hash(address: str) -> bytes` - Given the address return the hash160 of the public key
282
+ * `hash160(data: bytes) -> bytes` - Returns the hash160 of the provided data (usually the public key)
283
+ * `p2pkh_script(h160: bytes) -> Script` - Takes the hash160 of the public key and returns the locking script
284
+ * `public_key_to_address(public_key: bytes, network: str) -> String` - Given the public key and the network (either `BSV_Mainnet` or `BSV_Testnet`) return the address
285
+
286
+
287
+
@@ -1,3 +1,36 @@
1
+ # TX Engine
2
+
3
+ This library provides a Python interface for building BitcoinSV scripts and transactions.
4
+
5
+ For documentation of the Python Classes see below.
6
+
7
+ # Python Installation
8
+ As this library is hosted on PyPi (https://pypi.org/project/tx-engine/) and is installed using:
9
+
10
+ ```bash
11
+ pip install tx-engine
12
+ ```
13
+
14
+ ## Example Tx class usage
15
+ So to parse a hex string to Tx:
16
+
17
+ ```python
18
+ from tx_engine import Tx
19
+
20
+ src_tx = "0100000001c7151ebaf14dbfe922bd90700a7580f6db7d5a1b898ce79cb9ce459e17f12909000000006b4830450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41210395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4cffffffff0103000000000000001976a91496795fb99fd6c0f214f7a0e96019f642225f52d288ac00000000"
21
+
22
+ tx = tx.parse_hexstr(src_tx)
23
+ print(tx)
24
+
25
+ > PyTx { version: 1, tx_ins: [PyTxIn { prev_tx: "0929f1179e45ceb99ce78c891b5a7ddbf680750a7090bd22e9bf4df1ba1e15c7", prev_index: 0, sequence: 4294967295, script_sig: [0x48 0x30450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f5302206eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41 0x21 0x0395deb00349c0ae73412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4c] }], tx_outs: [PyTxOut { amount: 3, script_pubkey: [OP_DUP OP_HASH160 0x14 0x96795fb99fd6c0f214f7a0e96019f642225f52d2 OP_EQUALVERIFY OP_CHECKSIG] }], locktime: 0 }
26
+ ```
27
+
28
+
29
+ # Overview of the tx-engine Classes
30
+ The tx-engine provides the following classes:
31
+
32
+ ![tx-engine classes](docs/diagrams/python_classes.png)
33
+
1
34
  # Python Classes
2
35
 
3
36
  This provides an overview of the Python Classes their properties and methods,
@@ -165,7 +198,23 @@ Wallet class has the following methods:
165
198
  * `get_public_key_as_hexstr(self) -> String` - Return the public key as a hex string
166
199
  * `get_address(self) -> String` - Return the address based on the public key
167
200
  * `to_wif(self) -> String` - Return the private key in WIF format
201
+ * `get_network(self) -> String` - Returns the current network associated with this keypair
202
+ * `to_int(self) -> Integer` - Returns the scaler value of the private key as a python integer
203
+ * `to_hex(self) -> String` - Returns the scaler value of the private key as a string in hex format
204
+
168
205
  * `Wallet.generate_keypair(network) -> Wallet` - Given network (BSV_Testnet) return a keypair in Wallet format
206
+ * `Wallet.from_hexstr(network, hexstr) -> Wallet` - Given a network identifier and scalar value as a hex string, return a keypair in Wallet format
207
+ * `Wallet.from_bytes(network, bytes) -> Wallet` - Given a network identifier and a scalar value as a byte array, return a keypair in Wallet format
208
+ * `Wallet.from_int(network, integer) -> Wallet` - Given a network identifier and a scaler value as an integer, return a keypair in Wallet format
209
+
210
+ The library provides some additional helper functions to handle keys in different formats.
211
+ * `wif_to_bytes(wif: string) -> bytes` - Given a key in WIF format, it returns a byte array of the scalar value of the private key
212
+ * `bytes_to_wif(key_bytes, network) -> String` - Given a byte array and a network identifier, returns the WIF format for the private key
213
+ * `wif_from_pw_nonce(password, nonce, optional<network>) -> WIF` - Given a password, nonce (strings) return a WIF format for the private key. The default for the network is BSV_Mainnet. For a testnet format, please use BSv_Testnet
214
+
215
+
216
+ ![Bitcoin Keys](docs/diagrams/keys.png)
217
+
169
218
 
170
219
  ## Interface Factory
171
220
  The InterfaceFactory is class for creating interfaces to the BSV blockchain (`BlockchainInterface`).
@@ -199,13 +248,12 @@ BlockchainInterface class has the following methods:
199
248
  The `WoCInterface` is a `BlockchainInterface` that communicates with the WhatsOnChain API.
200
249
  Note that if you are using this you will need to install the python library `requests`.
201
250
 
202
- ```bash
203
- pip3 install requests
204
- ```
205
-
206
251
  ### Mock Interface
207
252
  The `Mock Interface` is a `BlockchainInterface` that is used for unit testing.
208
253
 
254
+ ### RPC Interface
255
+ The `RPC Interface` is a `BlockchainInterface` that is used for connecting to the RPC interface of mining nodes.
256
+
209
257
 
210
258
  # Other Functions
211
259
  These are public key and address functions that are likely to be used if you don't have the private key and
@@ -217,4 +265,3 @@ are not using the Wallet class.
217
265
  * `public_key_to_address(public_key: bytes, network: str) -> String` - Given the public key and the network (either `BSV_Mainnet` or `BSV_Testnet`) return the address
218
266
 
219
267
 
220
- ![Bitcoin Keys](diagrams/keys.png)
@@ -34,4 +34,5 @@
34
34
  * v0.6.3 - Added Tx.parse_hexstr - broken!
35
35
  * v0.6.4 - Added Tx.parse_hexstr
36
36
  * v0.6.5 - wif_to_bytes wallet function added TxIn to Output function added, minor version bump
37
- * v0.6.6 - wif_to_bytes wallet function added TxIn to Output function added, minor version bump (forgot to bump the version in cargo.toml)
37
+ * v0.6.6 - wif_to_bytes wallet function added TxIn to Output function added, minor version bump (forgot to bump the version in cargo.toml)
38
+ * v0.6.7 - additional wallet functions added to support WildBits