playweb-node 1.0.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 (48) hide show
  1. playweb_node-1.0.0/LICENSE +201 -0
  2. playweb_node-1.0.0/PKG-INFO +416 -0
  3. playweb_node-1.0.0/README.md +375 -0
  4. playweb_node-1.0.0/playweb/__init__.py +18 -0
  5. playweb_node-1.0.0/playweb/api/__init__.py +4 -0
  6. playweb_node-1.0.0/playweb/api/erc20.py +66 -0
  7. playweb_node-1.0.0/playweb/api/erc721.py +88 -0
  8. playweb_node-1.0.0/playweb/api/metadata.py +86 -0
  9. playweb_node-1.0.0/playweb/api/node_api.py +224 -0
  10. playweb_node-1.0.0/playweb/api/public_api.py +496 -0
  11. playweb_node-1.0.0/playweb/api/rpc.py +247 -0
  12. playweb_node-1.0.0/playweb/client.py +341 -0
  13. playweb_node-1.0.0/playweb/config.py +168 -0
  14. playweb_node-1.0.0/playweb/consensus/__init__.py +5 -0
  15. playweb_node-1.0.0/playweb/consensus/leader.py +50 -0
  16. playweb_node-1.0.0/playweb/consensus/nvf_bft.py +540 -0
  17. playweb_node-1.0.0/playweb/consensus/vote.py +108 -0
  18. playweb_node-1.0.0/playweb/core/__init__.py +6 -0
  19. playweb_node-1.0.0/playweb/core/block.py +156 -0
  20. playweb_node-1.0.0/playweb/core/blockchain.py +358 -0
  21. playweb_node-1.0.0/playweb/core/fee_engine.py +312 -0
  22. playweb_node-1.0.0/playweb/core/mempool.py +112 -0
  23. playweb_node-1.0.0/playweb/core/royalty_engine.py +207 -0
  24. playweb_node-1.0.0/playweb/core/transaction.py +270 -0
  25. playweb_node-1.0.0/playweb/network/__init__.py +6 -0
  26. playweb_node-1.0.0/playweb/network/bootstrap.py +217 -0
  27. playweb_node-1.0.0/playweb/network/gossip.py +222 -0
  28. playweb_node-1.0.0/playweb/network/peer_manager.py +164 -0
  29. playweb_node-1.0.0/playweb/network/sync.py +244 -0
  30. playweb_node-1.0.0/playweb/node.py +303 -0
  31. playweb_node-1.0.0/playweb/plugin/__init__.py +4 -0
  32. playweb_node-1.0.0/playweb/plugin/base_plugin.py +225 -0
  33. playweb_node-1.0.0/playweb/plugin/plugin_manager.py +131 -0
  34. playweb_node-1.0.0/playweb/registry/__init__.py +4 -0
  35. playweb_node-1.0.0/playweb/registry/content_registry.py +259 -0
  36. playweb_node-1.0.0/playweb/registry/edition_registry.py +220 -0
  37. playweb_node-1.0.0/playweb/storage/__init__.py +11 -0
  38. playweb_node-1.0.0/playweb/storage/base.py +154 -0
  39. playweb_node-1.0.0/playweb/storage/ram_storage.py +123 -0
  40. playweb_node-1.0.0/playweb/storage/sqlite_storage.py +369 -0
  41. playweb_node-1.0.0/playweb/storage/supabase_storage.py +389 -0
  42. playweb_node-1.0.0/playweb_node.egg-info/PKG-INFO +416 -0
  43. playweb_node-1.0.0/playweb_node.egg-info/SOURCES.txt +46 -0
  44. playweb_node-1.0.0/playweb_node.egg-info/dependency_links.txt +1 -0
  45. playweb_node-1.0.0/playweb_node.egg-info/requires.txt +18 -0
  46. playweb_node-1.0.0/playweb_node.egg-info/top_level.txt +1 -0
  47. playweb_node-1.0.0/setup.cfg +4 -0
  48. playweb_node-1.0.0/setup.py +45 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,416 @@
1
+ Metadata-Version: 2.4
2
+ Name: playweb-node
3
+ Version: 1.0.0
4
+ Summary: PlayWebit Network — L1 blockchain SDK
5
+ Home-page: https://github.com/playwebit/playwebit-net
6
+ Author: PlayWebIT
7
+ Author-email: playwebit@gmail.com
8
+ License: Apache-2.0
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: flask
16
+ Requires-Dist: requests
17
+ Requires-Dist: python-dotenv
18
+ Requires-Dist: apscheduler
19
+ Provides-Extra: eth
20
+ Requires-Dist: eth-account; extra == "eth"
21
+ Provides-Extra: leveldb
22
+ Requires-Dist: plyvel; extra == "leveldb"
23
+ Provides-Extra: supabase
24
+ Requires-Dist: supabase; extra == "supabase"
25
+ Provides-Extra: all
26
+ Requires-Dist: eth-account; extra == "all"
27
+ Requires-Dist: plyvel; extra == "all"
28
+ Requires-Dist: supabase; extra == "all"
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: license
36
+ Dynamic: license-file
37
+ Dynamic: provides-extra
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
41
+
42
+ # PlayWebit Network — `playwebit-net`
43
+
44
+ > Public blockchain infrastructure for cross-platform digital ownership, royalty enforcement, and content integrity verification.
45
+
46
+ **Chain ID:** 4968 | **Currency:** PLWB | **Consensus:** NVF-BFT | **License:** Apache 2.0
47
+
48
+ ---
49
+
50
+ ## What is PlayWebit Network?
51
+
52
+ PlayWebit Network is a public, permissionless blockchain where any platform — marketplace, creator app, music platform, or content service — can register digital content, verify ownership, and enforce royalties across the entire network.
53
+
54
+ **Key properties:**
55
+
56
+ - **Any node that joins is automatically a validator** — no permission needed
57
+ - **Content registered on one platform cannot be duplicated on another** — enforced at protocol level using IPFS-compatible CIDs
58
+ - **Royalties enforced by L1** — creators set percentage at mint time, received on every resale, on every platform, forever
59
+ - **Node operators earn 50% of every network fee** they process
60
+ - **Platforms choose how users pay** — Model A (PLWB directly) or Model B (USD, platform handles crypto)
61
+ - **Storage agnostic** — Supabase, SQLite, LevelDB, or RAM — runs anywhere
62
+
63
+ ---
64
+
65
+ ## Architecture
66
+
67
+ ```
68
+ ┌─────────────────────────────────────────────────────────┐
69
+ │ Layer 2 — Platform Apps (anyone builds these) │
70
+ │ │
71
+ │ CipherVault MusicApp ArtApp ... │
72
+ │ │
73
+ │ Model A: users pay in PLWB directly │
74
+ │ Model B: users pay in USD, platform pays PLWB fees │
75
+ │ │
76
+ │ spiderweave-sdk (optional) │
77
+ │ (DB integrity hashes → L1 anchor) │
78
+ └──────────────────────┬──────────────────────────────────┘
79
+ │ playweb-node SDK
80
+ ┌──────────────────────▼──────────────────────────────────┐
81
+ │ Layer 1 — PlayWebit Network (this repo) │
82
+ │ │
83
+ │ ✓ Block / Transaction / Merkle │
84
+ │ ✓ NVF-BFT Consensus (2/3 quorum, batch mining) │
85
+ │ ✓ PLWB native token │
86
+ │ ✓ Content Registry (cross-platform CID ownership) │
87
+ │ ✓ Edition Registry (cross-platform edition tracking) │
88
+ │ ✓ Royalty enforcement (creator % on every resale) │
89
+ │ ✓ Fee split (50% authority / 50% node operator) │
90
+ │ ✓ Bootstrap via Cloudflare Worker │
91
+ │ ✓ P2P gossip (HTTP webhooks — works everywhere) │
92
+ │ ✓ Storage abstraction (Supabase / SQLite / LevelDB) │
93
+ └─────────────────────────────────────────────────────────┘
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Payment Models
99
+
100
+ ### Model A — PLWB Native
101
+ Users hold PLWB in their own MetaMask wallet and pay all fees directly.
102
+
103
+ ```
104
+ User pays in PLWB:
105
+ → content price to seller
106
+ → royalty to creator (L1 enforced automatically)
107
+ → network fee 1 PLWB (50/50 split)
108
+ → CID link fee 5 PLWB (50/50 split)
109
+
110
+ Platform receives their charges in PLWB
111
+ Platform sets their own fees (L2 — their business)
112
+ ```
113
+
114
+ ### Model B — USD Native
115
+ Users pay in fiat. Platform manages all crypto behind the scenes.
116
+
117
+ ```
118
+ User pays in USD:
119
+ → never sees PLWB or MetaMask
120
+ → owns content on-chain via custodial wallet
121
+
122
+ Platform pays from PLWB treasury:
123
+ → network fee 1 PLWB (50/50 split)
124
+ → CID link fee 5 PLWB (50/50 split)
125
+ → everything else handled in USD — platform's business
126
+
127
+ PlayWebit gets: network fees only (50% split)
128
+ Platform gets: all their USD charges directly
129
+ ```
130
+
131
+ #### Model B — Wallet Options
132
+
133
+ | Option | Description |
134
+ |---|---|
135
+ | B | Pure custodial — platform holds key, user never knows wallet exists |
136
+ | C | Custodial with export — user can claim wallet anytime, import to MetaMask |
137
+
138
+ #### Model B — Royalty Options
139
+
140
+ | Option | How | On-Chain? |
141
+ |---|---|---|
142
+ | 1 | Platform pays creator in USD (trust-based) | No |
143
+ | 2 | Record on chain, pay USD separately | Partial |
144
+ | 3 | Convert royalty to PLWB, pay on chain | Yes ✓ (recommended) |
145
+
146
+ ---
147
+
148
+ ## Licence — Platform or Chain?
149
+
150
+ **Chain (universal, permanent):**
151
+ - Who owns which edition (source of truth)
152
+ - Full provenance / ownership history
153
+ - Royalty enforcement
154
+ - Duplicate detection globally
155
+ - Optional: licence terms in `data{}` field
156
+
157
+ **Platform (their business rules):**
158
+ - Licence type (personal / commercial / etc)
159
+ - Access control, downloads, expiry
160
+ - Licence certificate generation
161
+
162
+ ```
163
+ Chain = proof of OWNERSHIP (who owns it)
164
+ Platform = proof of RIGHTS (what they can do with it)
165
+ Both needed for full verification
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Fee Structure
171
+
172
+ | Fee | Amount | Split |
173
+ |---|---|---|
174
+ | Network fee | 1 PLWB per tx | 50% authority / 50% node |
175
+ | CID link fee | 5 PLWB per registration | 50% authority / 50% node |
176
+ | Redemption fee | 5% of amount | 100% authority |
177
+ | Royalty | Creator's % | 100% original creator |
178
+
179
+ Platform fees (listing, buying, cuts etc) — entirely platform's decision, go to platform wallet, PlayWebit has no involvement.
180
+
181
+ ---
182
+
183
+ ## Joining the Network
184
+
185
+ 1. Visit PlayWebit Portal → register your platform
186
+ 2. Connect MetaMask → verify treasury wallet
187
+ 3. Get approved → API key + node registered on chain
188
+ 4. Buy PLWB → fund treasury for network fees
189
+ 5. Install SDK
190
+ 6. Run your node → joins automatically, starts earning fees
191
+ 7. Build your dApp using `PlayWebitClient`
192
+
193
+ ---
194
+
195
+ ## Installation
196
+
197
+ ```bash
198
+ pip install git+https://github.com/playwebit/playwebit-net.git
199
+
200
+ # With Supabase (HuggingFace / no persistent disk)
201
+ pip install "playweb-node[supabase]"
202
+
203
+ # With LevelDB (VPS / AWS — fastest)
204
+ pip install "playweb-node[leveldb]"
205
+
206
+ # With signature verification (production)
207
+ pip install "playweb-node[eth]"
208
+
209
+ # Everything
210
+ pip install "playweb-node[all]"
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Quick Start
216
+
217
+ ```python
218
+ # Full validator node (HuggingFace + Supabase)
219
+ from playweb import PlayWebitNode
220
+ from playweb.storage.supabase_storage import SupabaseStorage
221
+
222
+ node = PlayWebitNode(
223
+ storage = SupabaseStorage(url=..., key=...),
224
+ node_wallet = os.environ["NODE_WALLET_ADDRESS"],
225
+ node_private_key = os.environ["NODE_WALLET_PRIVATE_KEY"],
226
+ node_public_url = os.environ["NODE_PUBLIC_URL"],
227
+ platform = "my_platform",
228
+ )
229
+ node.start()
230
+ ```
231
+
232
+ ```python
233
+ # Lightweight client (no local chain)
234
+ from playweb import PlayWebitClient
235
+
236
+ client = PlayWebitClient(
237
+ validator_url = "https://node1.playwebit.com",
238
+ platform_wallet = os.environ["PLATFORM_WALLET"],
239
+ )
240
+
241
+ # Check duplicate across ALL platforms on the network
242
+ dup = client.check_duplicate("QmYourIPFSCID...")
243
+ if dup["exists"]:
244
+ print(f"Already owned by {dup['first_owner']} on {dup['first_platform']}")
245
+ else:
246
+ success, reason, tx_hash = client.register_content(
247
+ cid = "QmYourIPFSCID...",
248
+ owner = "0xOwnerWallet",
249
+ editions = 100,
250
+ royalty_pct = 10,
251
+ signature = "0x...",
252
+ )
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Environment Variables
258
+
259
+ Node operators only set these:
260
+
261
+ | Variable | Required | Description |
262
+ |---|---|---|
263
+ | `NODE_WALLET_PRIVATE_KEY` | ✓ | Node wallet private key |
264
+ | `NODE_WALLET_ADDRESS` | ✓ | Node wallet address |
265
+ | `NODE_PUBLIC_URL` | ✓ | Public URL reachable by other nodes |
266
+ | `SUPABASE_URL` | If using Supabase | Supabase project URL |
267
+ | `SUPABASE_ANON_KEY` | If using Supabase | Supabase anon key |
268
+ | `NODE_PORT` | No (default 7860) | API port |
269
+ | `PLATFORM_ID` | No | Your platform name |
270
+
271
+ Never set — hardcoded in SDK, enforced by consensus:
272
+ - `AUTHORITY_WALLET` → PlayWebIT wallet, 50% of all fees
273
+ - `BOOTSTRAP_URL` → `https://small-field-be1c.playwebit.workers.dev`
274
+ - `CHAIN_ID` → 4968
275
+ - `TRANSACTION_FEE` → 1 PLWB
276
+ - `CV_LINK_FEE` → 5 PLWB
277
+ - `FEE_SPLIT` → 50/50
278
+
279
+ ---
280
+
281
+ ## NVF-BFT Consensus + Batch Mining
282
+
283
+ Based on the NullVoid Framework paper.
284
+
285
+ ```
286
+ Transaction arrives → added to mempool → batch timer starts
287
+
288
+ IF 10 transactions reached → mine immediately
289
+ IF 5 minutes pass → mine whatever is pending
290
+ IF mempool empty → no block, timer resets
291
+
292
+ PROPOSE → PREPARE → VOTE → COMMIT → ANCHOR → NOTIFY
293
+ ```
294
+
295
+ **Single node rules:**
296
+ - Authority node alone → can mine (bootstrapping phase)
297
+ - Non-authority node alone → must wait for peers (security)
298
+ - Multiple nodes → standard 2/3 quorum
299
+
300
+ ---
301
+
302
+ ## SpiderWeave (Optional)
303
+
304
+ [spiderweave-sdk](https://github.com/playwebit/spiderweave-sdk) is a separate optional tool for database integrity. Platforms install it independently if they want tamper-proof DB records anchored on chain.
305
+
306
+ Not required. Each platform configures their own hash strategy independently.
307
+
308
+ ---
309
+
310
+ ## Public API
311
+
312
+ ### dApps and platforms
313
+
314
+ | Method | Endpoint | Description |
315
+ |---|---|---|
316
+ | `POST` | `/api/transaction` | Submit signed transaction |
317
+ | `POST` | `/api/anchor_spider_hash` | Anchor hash (no signature needed) |
318
+ | `GET` | `/api/transaction/:hash` | Get transaction |
319
+ | `GET` | `/api/spider_hashes/:chain_name` | Anchored hashes (confirmed + pending) |
320
+ | `GET` | `/api/balance/:address` | PLWB balance |
321
+ | `GET` | `/api/owner/:cid` | Current owner of CID |
322
+ | `GET` | `/api/check_duplicate/:cid` | Is CID registered anywhere? |
323
+ | `POST` | `/api/verify_ownership` | Verify wallet owns CID |
324
+ | `GET` | `/api/editions/:cid` | All editions across all platforms |
325
+ | `GET` | `/api/network/stats` | Network statistics |
326
+
327
+ ### Peer-to-peer
328
+
329
+ | Method | Endpoint | Description |
330
+ |---|---|---|
331
+ | `POST` | `/peer/new_transaction` | Receive tx from peer |
332
+ | `POST` | `/peer/propose` | Block proposal |
333
+ | `POST` | `/peer/vote` | Consensus vote |
334
+ | `POST` | `/peer/new_block` | Finalised block |
335
+ | `POST` | `/peer/new_node` | New node joined |
336
+ | `GET` | `/peer/chain_tip` | Current chain tip |
337
+ | `GET` | `/peer/blocks/:from/:to` | Block range for sync |
338
+ | `GET` | `/peer/peers` | Peer list |
339
+ | `GET` | `/peer/health` | Health check |
340
+
341
+ ---
342
+
343
+ ## Transaction Types
344
+
345
+ | Type | Fee | Signature |
346
+ |---|---|---|
347
+ | `transfer` | 1 PLWB split | Required |
348
+ | `content_register` | 5 PLWB split | Required |
349
+ | `ownership_transfer` | 1 PLWB split | Required |
350
+ | `edition_transfer` | 1 PLWB split | Required |
351
+ | `spider_hash_anchor` | None | Not required |
352
+ | `plwb_redeem` | 5% authority | Not required |
353
+ | `plwb_purchase` | None | Not required |
354
+ | `node_register` | None | Not required |
355
+ | `genesis` / `reward` | None | Not required |
356
+
357
+ Every transaction has a free `data: {}` field — platforms store anything (licence type, platform ID, metadata). L1 carries it permanently without interpreting it.
358
+
359
+ ---
360
+
361
+ ## Supabase Schema
362
+
363
+ ```sql
364
+ CREATE TABLE IF NOT EXISTS pw_blocks (
365
+ hash TEXT PRIMARY KEY, idx INTEGER UNIQUE,
366
+ previous_hash TEXT, merkle_root TEXT, timestamp FLOAT,
367
+ nonce INTEGER DEFAULT 0, validator_wallet TEXT,
368
+ consensus_round INTEGER DEFAULT 0,
369
+ votes JSONB DEFAULT '[]', transactions JSONB DEFAULT '[]'
370
+ );
371
+ CREATE TABLE IF NOT EXISTS pw_transactions (hash TEXT PRIMARY KEY, data JSONB);
372
+ CREATE TABLE IF NOT EXISTS pw_balances (address TEXT PRIMARY KEY, balance FLOAT DEFAULT 0.0, updated FLOAT);
373
+ CREATE TABLE IF NOT EXISTS pw_content_registry (
374
+ cid TEXT PRIMARY KEY, creator_wallet TEXT, first_owner TEXT,
375
+ current_owner TEXT, first_platform TEXT, first_tx_hash TEXT,
376
+ first_block INTEGER, timestamp FLOAT, total_editions INTEGER DEFAULT 1,
377
+ royalty_pct FLOAT DEFAULT 0, extra JSONB DEFAULT '{}'
378
+ );
379
+ CREATE TABLE IF NOT EXISTS pw_edition_registry (
380
+ cid TEXT, edition_number INTEGER, edition_of INTEGER DEFAULT 1,
381
+ current_owner TEXT, platform TEXT, tx_hash TEXT, timestamp FLOAT,
382
+ provenance JSONB DEFAULT '[]', PRIMARY KEY (cid, edition_number)
383
+ );
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Security Model
389
+
390
+ - **Fee manipulation** → rejected by consensus. Honest nodes earn 50%; cheaters earn nothing.
391
+ - **Content theft** → CID registered once, globally. IPFS CIDs match automatically.
392
+ - **Royalty bypass** → stored on-chain at mint time, validated by all nodes on every resale.
393
+ - **Node identity** → wallet signature. Authority wallet hardcoded in SDK — cannot be overridden.
394
+ - **Solo mining** → only authority node can mine alone. Non-authority single nodes must wait for peers.
395
+
396
+ ---
397
+
398
+ ## Related Repositories
399
+
400
+ | Repo | Description |
401
+ |---|---|
402
+ | [`playwebit/spiderweave-sdk`](https://github.com/playwebit/spiderweave-sdk) | Optional DB integrity hashing tool |
403
+ | [`playwebit/cloudflare-bootstrap`](https://github.com/playwebit/cloudflare-bootstrap) | Cloudflare Worker for peer discovery |
404
+
405
+ ---
406
+
407
+ ## License
408
+
409
+ Copyright 2026 PlayWebIT
410
+
411
+ Licensed under the Apache License, Version 2.0. You may obtain a copy at:
412
+ http://www.apache.org/licenses/LICENSE-2.0
413
+
414
+ ---
415
+
416
+ *Built by [PlayWebIT](https://github.com/playwebit)*