pyrxd 0.2.0__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 (83) hide show
  1. pyrxd-0.2.0/LICENSE +202 -0
  2. pyrxd-0.2.0/NOTICE +11 -0
  3. pyrxd-0.2.0/PKG-INFO +201 -0
  4. pyrxd-0.2.0/README.md +165 -0
  5. pyrxd-0.2.0/pyproject.toml +352 -0
  6. pyrxd-0.2.0/src/pyrxd/__init__.py +82 -0
  7. pyrxd-0.2.0/src/pyrxd/aes_cbc.py +30 -0
  8. pyrxd-0.2.0/src/pyrxd/base58.py +78 -0
  9. pyrxd-0.2.0/src/pyrxd/btc_wallet/__init__.py +28 -0
  10. pyrxd-0.2.0/src/pyrxd/btc_wallet/keys.py +334 -0
  11. pyrxd-0.2.0/src/pyrxd/btc_wallet/payment.py +267 -0
  12. pyrxd-0.2.0/src/pyrxd/btc_wallet/validate.py +57 -0
  13. pyrxd-0.2.0/src/pyrxd/constants.py +341 -0
  14. pyrxd-0.2.0/src/pyrxd/crypto/__init__.py +0 -0
  15. pyrxd-0.2.0/src/pyrxd/curve.py +100 -0
  16. pyrxd-0.2.0/src/pyrxd/fee_model.py +16 -0
  17. pyrxd-0.2.0/src/pyrxd/fee_models/__init__.py +4 -0
  18. pyrxd-0.2.0/src/pyrxd/fee_models/satoshis_per_kilobyte.py +67 -0
  19. pyrxd-0.2.0/src/pyrxd/glyph/__init__.py +82 -0
  20. pyrxd-0.2.0/src/pyrxd/glyph/builder.py +908 -0
  21. pyrxd-0.2.0/src/pyrxd/glyph/creator.py +133 -0
  22. pyrxd-0.2.0/src/pyrxd/glyph/dmint.py +1093 -0
  23. pyrxd-0.2.0/src/pyrxd/glyph/ft.py +325 -0
  24. pyrxd-0.2.0/src/pyrxd/glyph/inspector.py +116 -0
  25. pyrxd-0.2.0/src/pyrxd/glyph/payload.py +282 -0
  26. pyrxd-0.2.0/src/pyrxd/glyph/scanner.py +179 -0
  27. pyrxd-0.2.0/src/pyrxd/glyph/script.py +215 -0
  28. pyrxd-0.2.0/src/pyrxd/glyph/types.py +437 -0
  29. pyrxd-0.2.0/src/pyrxd/gravity/__init__.py +58 -0
  30. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/__init__.py +0 -0
  31. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_6x12_p2wpkh.artifact.json +100 -0
  32. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_flat_12x10_11_12_13_14_p2wpkh.artifact.json +119 -0
  33. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_flat_12x20_sentinel_all.artifact.json +123 -0
  34. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_flat_6x10_11_12_13_14_p2wpkh.artifact.json +95 -0
  35. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_flat_6x12_p2wpkh.artifact.json +91 -0
  36. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_flat_6x13_p2wpkh.artifact.json +95 -0
  37. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_trade.artifact.json +95 -0
  38. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_covenant_unified_p2wpkh.artifact.json +119 -0
  39. pyrxd-0.2.0/src/pyrxd/gravity/artifacts/maker_offer.artifact.json +52 -0
  40. pyrxd-0.2.0/src/pyrxd/gravity/codehash.py +67 -0
  41. pyrxd-0.2.0/src/pyrxd/gravity/covenant.py +476 -0
  42. pyrxd-0.2.0/src/pyrxd/gravity/maker.py +449 -0
  43. pyrxd-0.2.0/src/pyrxd/gravity/trade.py +521 -0
  44. pyrxd-0.2.0/src/pyrxd/gravity/transactions.py +820 -0
  45. pyrxd-0.2.0/src/pyrxd/gravity/types.py +151 -0
  46. pyrxd-0.2.0/src/pyrxd/hash.py +37 -0
  47. pyrxd-0.2.0/src/pyrxd/hd/__init__.py +47 -0
  48. pyrxd-0.2.0/src/pyrxd/hd/bip32.py +336 -0
  49. pyrxd-0.2.0/src/pyrxd/hd/bip39.py +110 -0
  50. pyrxd-0.2.0/src/pyrxd/hd/bip44.py +107 -0
  51. pyrxd-0.2.0/src/pyrxd/hd/wallet.py +475 -0
  52. pyrxd-0.2.0/src/pyrxd/hd/wordlist/chinese_simplified.txt +2048 -0
  53. pyrxd-0.2.0/src/pyrxd/hd/wordlist/english.txt +2048 -0
  54. pyrxd-0.2.0/src/pyrxd/keys.py +421 -0
  55. pyrxd-0.2.0/src/pyrxd/merkle_path.py +341 -0
  56. pyrxd-0.2.0/src/pyrxd/network/__init__.py +27 -0
  57. pyrxd-0.2.0/src/pyrxd/network/bitcoin.py +868 -0
  58. pyrxd-0.2.0/src/pyrxd/network/chaintracker.py +89 -0
  59. pyrxd-0.2.0/src/pyrxd/network/electrumx.py +662 -0
  60. pyrxd-0.2.0/src/pyrxd/py.typed +0 -0
  61. pyrxd-0.2.0/src/pyrxd/script/__init__.py +23 -0
  62. pyrxd-0.2.0/src/pyrxd/script/script.py +180 -0
  63. pyrxd-0.2.0/src/pyrxd/script/type.py +272 -0
  64. pyrxd-0.2.0/src/pyrxd/script/unlocking_template.py +15 -0
  65. pyrxd-0.2.0/src/pyrxd/security/__init__.py +56 -0
  66. pyrxd-0.2.0/src/pyrxd/security/errors.py +122 -0
  67. pyrxd-0.2.0/src/pyrxd/security/rng.py +64 -0
  68. pyrxd-0.2.0/src/pyrxd/security/secrets.py +266 -0
  69. pyrxd-0.2.0/src/pyrxd/security/types.py +297 -0
  70. pyrxd-0.2.0/src/pyrxd/spv/__init__.py +40 -0
  71. pyrxd-0.2.0/src/pyrxd/spv/chain.py +70 -0
  72. pyrxd-0.2.0/src/pyrxd/spv/merkle.py +153 -0
  73. pyrxd-0.2.0/src/pyrxd/spv/payment.py +131 -0
  74. pyrxd-0.2.0/src/pyrxd/spv/pow.py +83 -0
  75. pyrxd-0.2.0/src/pyrxd/spv/proof.py +214 -0
  76. pyrxd-0.2.0/src/pyrxd/spv/witness.py +127 -0
  77. pyrxd-0.2.0/src/pyrxd/transaction/__init__.py +13 -0
  78. pyrxd-0.2.0/src/pyrxd/transaction/transaction.py +432 -0
  79. pyrxd-0.2.0/src/pyrxd/transaction/transaction_input.py +87 -0
  80. pyrxd-0.2.0/src/pyrxd/transaction/transaction_output.py +50 -0
  81. pyrxd-0.2.0/src/pyrxd/transaction/transaction_preimage.py +238 -0
  82. pyrxd-0.2.0/src/pyrxd/utils.py +612 -0
  83. pyrxd-0.2.0/src/pyrxd/wallet.py +330 -0
pyrxd-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
pyrxd-0.2.0/NOTICE ADDED
@@ -0,0 +1,11 @@
1
+ pyrxd — Python SDK for the Radiant (RXD) blockchain
2
+ Copyright 2026 Mudwood Labs
3
+
4
+ This product includes software developed by Mudwood Labs
5
+ (https://mudwoodlabs.com).
6
+
7
+ The reverse-engineered Photonic dMint protocol research notes
8
+ incorporated in docs/ reference the Photonic Wallet TypeScript
9
+ implementation by the Radiant Blockchain Community
10
+ (https://github.com/RadiantBlockchain-Community/photonic-wallet)
11
+ and the Glyph Protocol REP-3010 / REP-3011 specifications.
pyrxd-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyrxd
3
+ Version: 0.2.0
4
+ Summary: Python SDK for the Radiant (RXD) blockchain — transactions, HD wallets, Glyph tokens (NFT/FT/dMint), Gravity cross-chain atomic swaps, SPV, and ElectrumX.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: radiant,rxd,blockchain,glyph,nft,ft,dmint,gravity,atomic-swap,bip32,bip39,bip44,electrumx
9
+ Author: Mudwood Labs
10
+ Author-email: opensource@mudwoodlabs.com
11
+ Requires-Python: >=3.10,<4.0
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Dist: aiohttp (>=3.9.0)
23
+ Requires-Dist: base58 (>=2.1.1,<3.0.0)
24
+ Requires-Dist: cbor2 (>=6.0,<7.0)
25
+ Requires-Dist: coincurve (>=21.0.0,<22.0.0)
26
+ Requires-Dist: pycryptodomex (>=3.22.0,<4.0.0)
27
+ Requires-Dist: websocket-client (>=1.8.0,<2.0.0)
28
+ Requires-Dist: websockets (>=15.0.1,<16.0.0)
29
+ Project-URL: Changelog, https://github.com/MudwoodLabs/pyrxd/blob/main/CHANGELOG.md
30
+ Project-URL: Documentation, https://pyrxd.readthedocs.io/
31
+ Project-URL: Homepage, https://github.com/MudwoodLabs/pyrxd
32
+ Project-URL: Source, https://github.com/MudwoodLabs/pyrxd
33
+ Project-URL: Tracker, https://github.com/MudwoodLabs/pyrxd/issues
34
+ Description-Content-Type: text/markdown
35
+
36
+ # pyrxd
37
+
38
+ Python SDK for the [Radiant (RXD) blockchain](https://radiantblockchain.org/).
39
+
40
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
41
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
42
+ [![Documentation Status](https://readthedocs.org/projects/pyrxd/badge/?version=latest)](https://pyrxd.readthedocs.io/en/latest/?badge=latest)
43
+
44
+ A typed, async-first SDK for building applications on Radiant. Includes
45
+ transaction construction, HD wallets, the Glyph token protocol (NFT, FT,
46
+ dMint), Gravity cross-chain atomic swaps, SPV verification, and an
47
+ ElectrumX network client.
48
+
49
+ ## Status
50
+
51
+ **Pre-1.0 software.** APIs may change between minor versions before 1.0.
52
+ Cryptographic primitives have not been independently audited. See
53
+ [SECURITY.md](SECURITY.md) for security policy and disclosure.
54
+
55
+ **Working on mainnet today:**
56
+
57
+ - RXD send / send-max, balance and UTXO queries
58
+ - Glyph NFT mint (two-phase commit + reveal) and transfer — see `examples/glyph_mint_demo.py`
59
+ - Glyph FT premine deploy via `prepare_ft_deploy_reveal` — entire supply at vout[0]
60
+ - Glyph FT transfer via `FtUtxoSet.build_transfer_tx` (conservation-enforcing)
61
+ - BIP32/BIP39/BIP44 HD wallets with optional encrypted persistence (`HdWallet`)
62
+ - ElectrumX async client with reconnect, balance, UTXOs, history, broadcast
63
+
64
+ **Experimental:**
65
+
66
+ - Gravity cross-chain BTC↔RXD atomic swaps (`pyrxd.gravity`) — mainnet-proven
67
+ for sentinel artifact paths; covenant variants still being hardened.
68
+ - dMint PoW-based distributed FT mint — premine-only deploys ship today; the
69
+ full PoW mint covenant is documented in `docs/dmint-followup.md` as future
70
+ work.
71
+
72
+ ## Installation
73
+
74
+ ```bash
75
+ pip install pyrxd
76
+ ```
77
+
78
+ Requires Python 3.10 or newer.
79
+
80
+ ## Quick start
81
+
82
+ ### Generate a key and check a balance
83
+
84
+ ```python
85
+ import asyncio
86
+ from pyrxd.keys import PrivateKey
87
+ from pyrxd.network.electrumx import ElectrumXClient, script_hash_for_address
88
+
89
+ async def main():
90
+ priv = PrivateKey() # no-arg constructor generates a fresh key
91
+ addr = priv.public_key().address()
92
+ print(f"address: {addr}")
93
+
94
+ sh = script_hash_for_address(addr)
95
+ async with ElectrumXClient(["wss://electrumx.radiant4people.com:50022/"]) as client:
96
+ confirmed, unconfirmed = await client.get_balance(sh)
97
+ print(f"balance: {confirmed:,} photons confirmed, {unconfirmed:,} unconfirmed")
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ### Send RXD
103
+
104
+ ```python
105
+ from pyrxd.keys import PrivateKey
106
+ from pyrxd.transaction.transaction import Transaction, TransactionInput, TransactionOutput
107
+ from pyrxd.script.type import P2PKH
108
+
109
+ priv = PrivateKey("L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ")
110
+ # ... build transaction with inputs and outputs ...
111
+ # See examples/ for full flows.
112
+ ```
113
+
114
+ ### Mint a Glyph NFT
115
+
116
+ ```python
117
+ from pyrxd.glyph import GlyphBuilder, GlyphMetadata, GlyphProtocol
118
+ from pyrxd.glyph.builder import CommitParams
119
+
120
+ metadata = GlyphMetadata(
121
+ protocol=[GlyphProtocol.NFT],
122
+ name="My NFT",
123
+ description="A demo non-fungible token.",
124
+ )
125
+ builder = GlyphBuilder()
126
+ commit = builder.prepare_commit(CommitParams(metadata=metadata, owner_pkh=pkh, change_pkh=pkh, funding_satoshis=funding_amount))
127
+ # ... broadcast commit, then reveal ...
128
+ ```
129
+
130
+ See [`examples/glyph_mint_demo.py`](examples/glyph_mint_demo.py) for a
131
+ complete end-to-end NFT mint, and [`examples/ft_deploy_premine.py`](examples/ft_deploy_premine.py)
132
+ for an FT premine deployment.
133
+
134
+ ### Deploy a fungible token (premine)
135
+
136
+ ```python
137
+ from pyrxd.glyph import GlyphBuilder, GlyphMetadata, GlyphProtocol
138
+
139
+ metadata = GlyphMetadata(
140
+ protocol=[GlyphProtocol.FT],
141
+ name="My Token",
142
+ ticker="MTK",
143
+ description="A premine fungible token.",
144
+ )
145
+ # Single commit + reveal mints the entire supply to one address.
146
+ # See examples/ft_deploy_premine.py for the full flow.
147
+ ```
148
+
149
+ ## Production architecture
150
+
151
+ If you're building a web app that interacts with Radiant in production,
152
+ **do not put private keys in your web tier**. A web RCE in your app then
153
+ becomes a wallet compromise.
154
+
155
+ The recommended pattern:
156
+
157
+ 1. Keep `pyrxd` as the cryptographic and protocol library — it's safe to
158
+ import in any process that needs to *read* chain state.
159
+ 2. Run a separate signing service (a small HTTP service that wraps
160
+ `pyrxd`) on a different process, ideally a different host, with the
161
+ private key loaded only there.
162
+ 3. Have your web app talk to the signing service over an authenticated
163
+ API (HMAC-signed requests, mutual TLS, or similar) for any operation
164
+ that needs a signature.
165
+
166
+ This is the pattern used by major payment-rail SDKs (Stripe, Square,
167
+ AWS) and is the correct shape for any application handling real funds.
168
+
169
+ ## Documentation
170
+
171
+ Hosted at **[pyrxd.readthedocs.io](https://pyrxd.readthedocs.io/)** (API
172
+ reference + tutorials + how-to guides + concepts).
173
+
174
+ Other resources in this repo:
175
+
176
+ - [`examples/`](examples/) — runnable end-to-end demos
177
+ - [`docs/dmint-followup.md`](docs/dmint-followup.md) — premine vs PoW dMint scope
178
+ - [`docs/dmint-research-photonic.md`](docs/dmint-research-photonic.md) — Photonic Wallet TS reference
179
+ - [`docs/dmint-research-mainnet.md`](docs/dmint-research-mainnet.md) — decoded live dMint contracts
180
+ - [`SECURITY.md`](SECURITY.md) — security policy and disclosure
181
+
182
+ ## Contributing
183
+
184
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, code style,
185
+ and how to send a PR. We use the [Developer Certificate of Origin](https://developercertificate.org/)
186
+ for contributor sign-off — no CLA paperwork.
187
+
188
+ By contributing, you agree your contributions are licensed under
189
+ Apache 2.0.
190
+
191
+ ## Security
192
+
193
+ Report vulnerabilities privately to **security@mudwoodlabs.com**. See
194
+ [SECURITY.md](SECURITY.md) for the full policy and disclosure timeline.
195
+
196
+ ## License
197
+
198
+ Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
199
+
200
+ Copyright 2026 [Mudwood Labs](https://mudwoodlabs.com).
201
+
pyrxd-0.2.0/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # pyrxd
2
+
3
+ Python SDK for the [Radiant (RXD) blockchain](https://radiantblockchain.org/).
4
+
5
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
6
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
7
+ [![Documentation Status](https://readthedocs.org/projects/pyrxd/badge/?version=latest)](https://pyrxd.readthedocs.io/en/latest/?badge=latest)
8
+
9
+ A typed, async-first SDK for building applications on Radiant. Includes
10
+ transaction construction, HD wallets, the Glyph token protocol (NFT, FT,
11
+ dMint), Gravity cross-chain atomic swaps, SPV verification, and an
12
+ ElectrumX network client.
13
+
14
+ ## Status
15
+
16
+ **Pre-1.0 software.** APIs may change between minor versions before 1.0.
17
+ Cryptographic primitives have not been independently audited. See
18
+ [SECURITY.md](SECURITY.md) for security policy and disclosure.
19
+
20
+ **Working on mainnet today:**
21
+
22
+ - RXD send / send-max, balance and UTXO queries
23
+ - Glyph NFT mint (two-phase commit + reveal) and transfer — see `examples/glyph_mint_demo.py`
24
+ - Glyph FT premine deploy via `prepare_ft_deploy_reveal` — entire supply at vout[0]
25
+ - Glyph FT transfer via `FtUtxoSet.build_transfer_tx` (conservation-enforcing)
26
+ - BIP32/BIP39/BIP44 HD wallets with optional encrypted persistence (`HdWallet`)
27
+ - ElectrumX async client with reconnect, balance, UTXOs, history, broadcast
28
+
29
+ **Experimental:**
30
+
31
+ - Gravity cross-chain BTC↔RXD atomic swaps (`pyrxd.gravity`) — mainnet-proven
32
+ for sentinel artifact paths; covenant variants still being hardened.
33
+ - dMint PoW-based distributed FT mint — premine-only deploys ship today; the
34
+ full PoW mint covenant is documented in `docs/dmint-followup.md` as future
35
+ work.
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ pip install pyrxd
41
+ ```
42
+
43
+ Requires Python 3.10 or newer.
44
+
45
+ ## Quick start
46
+
47
+ ### Generate a key and check a balance
48
+
49
+ ```python
50
+ import asyncio
51
+ from pyrxd.keys import PrivateKey
52
+ from pyrxd.network.electrumx import ElectrumXClient, script_hash_for_address
53
+
54
+ async def main():
55
+ priv = PrivateKey() # no-arg constructor generates a fresh key
56
+ addr = priv.public_key().address()
57
+ print(f"address: {addr}")
58
+
59
+ sh = script_hash_for_address(addr)
60
+ async with ElectrumXClient(["wss://electrumx.radiant4people.com:50022/"]) as client:
61
+ confirmed, unconfirmed = await client.get_balance(sh)
62
+ print(f"balance: {confirmed:,} photons confirmed, {unconfirmed:,} unconfirmed")
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ ### Send RXD
68
+
69
+ ```python
70
+ from pyrxd.keys import PrivateKey
71
+ from pyrxd.transaction.transaction import Transaction, TransactionInput, TransactionOutput
72
+ from pyrxd.script.type import P2PKH
73
+
74
+ priv = PrivateKey("L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ")
75
+ # ... build transaction with inputs and outputs ...
76
+ # See examples/ for full flows.
77
+ ```
78
+
79
+ ### Mint a Glyph NFT
80
+
81
+ ```python
82
+ from pyrxd.glyph import GlyphBuilder, GlyphMetadata, GlyphProtocol
83
+ from pyrxd.glyph.builder import CommitParams
84
+
85
+ metadata = GlyphMetadata(
86
+ protocol=[GlyphProtocol.NFT],
87
+ name="My NFT",
88
+ description="A demo non-fungible token.",
89
+ )
90
+ builder = GlyphBuilder()
91
+ commit = builder.prepare_commit(CommitParams(metadata=metadata, owner_pkh=pkh, change_pkh=pkh, funding_satoshis=funding_amount))
92
+ # ... broadcast commit, then reveal ...
93
+ ```
94
+
95
+ See [`examples/glyph_mint_demo.py`](examples/glyph_mint_demo.py) for a
96
+ complete end-to-end NFT mint, and [`examples/ft_deploy_premine.py`](examples/ft_deploy_premine.py)
97
+ for an FT premine deployment.
98
+
99
+ ### Deploy a fungible token (premine)
100
+
101
+ ```python
102
+ from pyrxd.glyph import GlyphBuilder, GlyphMetadata, GlyphProtocol
103
+
104
+ metadata = GlyphMetadata(
105
+ protocol=[GlyphProtocol.FT],
106
+ name="My Token",
107
+ ticker="MTK",
108
+ description="A premine fungible token.",
109
+ )
110
+ # Single commit + reveal mints the entire supply to one address.
111
+ # See examples/ft_deploy_premine.py for the full flow.
112
+ ```
113
+
114
+ ## Production architecture
115
+
116
+ If you're building a web app that interacts with Radiant in production,
117
+ **do not put private keys in your web tier**. A web RCE in your app then
118
+ becomes a wallet compromise.
119
+
120
+ The recommended pattern:
121
+
122
+ 1. Keep `pyrxd` as the cryptographic and protocol library — it's safe to
123
+ import in any process that needs to *read* chain state.
124
+ 2. Run a separate signing service (a small HTTP service that wraps
125
+ `pyrxd`) on a different process, ideally a different host, with the
126
+ private key loaded only there.
127
+ 3. Have your web app talk to the signing service over an authenticated
128
+ API (HMAC-signed requests, mutual TLS, or similar) for any operation
129
+ that needs a signature.
130
+
131
+ This is the pattern used by major payment-rail SDKs (Stripe, Square,
132
+ AWS) and is the correct shape for any application handling real funds.
133
+
134
+ ## Documentation
135
+
136
+ Hosted at **[pyrxd.readthedocs.io](https://pyrxd.readthedocs.io/)** (API
137
+ reference + tutorials + how-to guides + concepts).
138
+
139
+ Other resources in this repo:
140
+
141
+ - [`examples/`](examples/) — runnable end-to-end demos
142
+ - [`docs/dmint-followup.md`](docs/dmint-followup.md) — premine vs PoW dMint scope
143
+ - [`docs/dmint-research-photonic.md`](docs/dmint-research-photonic.md) — Photonic Wallet TS reference
144
+ - [`docs/dmint-research-mainnet.md`](docs/dmint-research-mainnet.md) — decoded live dMint contracts
145
+ - [`SECURITY.md`](SECURITY.md) — security policy and disclosure
146
+
147
+ ## Contributing
148
+
149
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, code style,
150
+ and how to send a PR. We use the [Developer Certificate of Origin](https://developercertificate.org/)
151
+ for contributor sign-off — no CLA paperwork.
152
+
153
+ By contributing, you agree your contributions are licensed under
154
+ Apache 2.0.
155
+
156
+ ## Security
157
+
158
+ Report vulnerabilities privately to **security@mudwoodlabs.com**. See
159
+ [SECURITY.md](SECURITY.md) for the full policy and disclosure timeline.
160
+
161
+ ## License
162
+
163
+ Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
164
+
165
+ Copyright 2026 [Mudwood Labs](https://mudwoodlabs.com).