Spaces:
Running
Running
| """ | |
| VALIS — Variable Arrived Location In Superposition | |
| Built for the Build Small Hackathon 2026. | |
| A peer-to-peer mesh network on $10 microcontrollers. | |
| Messages don't exist in transit. It's a walkie-talkie with math. | |
| """ | |
| import gradio as gr | |
| import os | |
| import secrets | |
| # === MEILONG SCATTER PROTOCOL === | |
| def xor_bytes(a, b): | |
| return bytes(x ^ y for x, y in zip(a, b)) | |
| def scatter(message): | |
| """Split a message into 3 XOR shares. Any 1 or 2 = noise. All 3 = message.""" | |
| data = message.encode('utf-8') | |
| share1 = secrets.token_bytes(len(data)) | |
| share2 = secrets.token_bytes(len(data)) | |
| share3 = xor_bytes(xor_bytes(data, share1), share2) | |
| return share1, share2, share3 | |
| def reassemble(s1, s2, s3): | |
| """Reassemble 3 XOR shares back into the original message.""" | |
| return xor_bytes(xor_bytes(s1, s2), s3).decode('utf-8') | |
| def demo_scatter(message): | |
| """Interactive Meilong scatter demo.""" | |
| if not message or not message.strip(): | |
| return "", "", "", "", "", "" | |
| s1, s2, s3 = scatter(message) | |
| # Show shares as hex (proving they're noise) | |
| hex1 = s1.hex() | |
| hex2 = s2.hex() | |
| hex3 = s3.hex() | |
| # Try to "read" individual shares (you can't) | |
| try: | |
| attempt1 = s1.decode('utf-8', errors='replace') | |
| except: | |
| attempt1 = "[binary noise]" | |
| try: | |
| attempt2 = s2.decode('utf-8', errors='replace') | |
| except: | |
| attempt2 = "[binary noise]" | |
| # Reassemble | |
| recovered = reassemble(s1, s2, s3) | |
| # Stats | |
| stats = f"Original: {len(message)} bytes\nEach share: {len(s1)} bytes\nShares are random: share1 and share2 are crypto-random, share3 = message XOR share1 XOR share2\nIntercept 1 share: random noise\nIntercept 2 shares: random noise\nAll 3 shares: message recovers perfectly" | |
| return hex1[:80] + "...", hex2[:80] + "...", hex3[:80] + "...", recovered, f"Decoded share 1 alone: {attempt1[:60]}...\nDecoded share 2 alone: {attempt2[:60]}...\n\nMeaningless. The message doesn't exist until all three arrive.", stats | |
| def demo_tamper(message, tampered_char): | |
| """Show what happens when you tamper with a share.""" | |
| if not message or not message.strip(): | |
| return "Enter a message first." | |
| s1, s2, s3 = scatter(message) | |
| # Tamper with share 2 — flip one byte | |
| s2_tampered = bytearray(s2) | |
| if len(s2_tampered) > 0: | |
| pos = len(s2_tampered) // 2 | |
| s2_tampered[pos] = s2_tampered[pos] ^ 0xFF | |
| s2_tampered = bytes(s2_tampered) | |
| # Try to reassemble with tampered share | |
| try: | |
| corrupted = xor_bytes(xor_bytes(s1, s2_tampered), s3).decode('utf-8', errors='replace') | |
| except: | |
| corrupted = "[decode failed]" | |
| original = reassemble(s1, s2, s3) | |
| return f"Original message: {original}\n\nTampered reassembly: {corrupted}\n\nOne flipped byte in one share = garbage output.\nThe dragon knows when someone touched the shares." | |
| # === CSS === | |
| CUSTOM_CSS = """ | |
| @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap'); | |
| .gradio-container { | |
| background: #0a0a12 !important; | |
| max-width: 900px !important; | |
| margin: 0 auto !important; | |
| } | |
| .gr-button-primary { | |
| background: #00d4ff !important; color: #0a0a12 !important; | |
| border: none !important; font-family: 'JetBrains Mono', monospace !important; | |
| font-weight: bold !important; | |
| } | |
| .gr-button-primary:hover { background: #00b8e0 !important; } | |
| footer { display: none !important; } | |
| """ | |
| SPEC_MD = """ | |
| ## Protocol Stack | |
| ``` | |
| Layer 5: VALIS Application — Meilong scatter (3 XOR shares, 3 routes) | |
| Layer 4: Identity — Presence-based (no accounts, no IP, no identity) | |
| Layer 3: Mesh Routing — 802.15.4 mesh, multi-hop, self-healing | |
| Layer 2: Transport — Zigbee / Thread / Wi-SUN (open standards) | |
| Layer 1: Physical — 2.4GHz ISM band (license-free worldwide) | |
| ``` | |
| ## Hardware Per Node | |
| | Component | Spec | Cost | | |
| |-----------|------|------| | |
| | ESP32-C6 or ESP32-H2 | Zigbee/Thread/802.15.4 + WiFi + BLE | $8 | | |
| | USB-C cable | Powered by any outlet or battery bank | $0 | | |
| | Enclosure | 3D printed or bare board | $2 | | |
| | **Total** | | **$10** | | |
| 100 nodes = $1,000 (a neighborhood). 1,000 nodes = $10,000 (a town). The electrical grid already wired the topology. | |
| ## Security Model | |
| | Attack | Result | | |
| |--------|--------| | |
| | **Intercept a message** | Can't. Message doesn't exist in transit. Three shares of noise on three paths. | | |
| | **Identify a user** | Can't. No user identities. Nodes are anonymous. | | |
| | **Shut down the network** | Can't. No server to kill. No domain to seize. Every node is independent. Kill one, traffic reroutes. | | |
| | **Block the frequency** | Illegal. 2.4GHz ISM is protected by international treaty. Jamming also kills WiFi and baby monitors. | | |
| | **Regulate it** | Regulate what? Open hardware, open protocols, license-free spectrum. It's a walkie-talkie with math. | | |
| ## vs. The Internet | |
| | Feature | Internet | VALIS | | |
| |---------|----------|-------| | |
| | Requires ISP | Yes | No | | |
| | Central servers | Yes | No | | |
| | Can be censored | Yes | No | | |
| | Can be surveilled | Yes | No | | |
| | Requires identity | Yes | No | | |
| | Can be shut down | Yes | No | | |
| | Cost per node | $50-100/mo | $10 one time | | |
| | Who owns it | Corporations | Nobody | | |
| """ | |
| POWERLINE_MD = """ | |
| ## Power Line Communication — The Part Nobody Will Believe | |
| Smart meters already send data through the electrical grid. This is not theory. It's deployed in millions of homes right now. The protocol is called G3-PLC / PRIME / IEEE 1901.2. | |
| **The insight:** Transformers don't destroy signals — they transform them at known, predictable ratios. | |
| ### Grid Harmonics as Communication Channels | |
| The electrical grid runs at 60Hz (US) / 50Hz (EU). But the wire carries harmonics: | |
| - **120Hz** — 2nd harmonic | |
| - **180Hz** — 3rd harmonic | |
| - **240Hz** — 4th harmonic | |
| - **300Hz** — 5th harmonic | |
| These harmonics are *unused bandwidth*. They're considered noise by the power company. But noise is just a signal nobody's listening to. | |
| ### The Resonance Angle | |
| Every wire has a resonant frequency determined by its length, gauge, and impedance. A VALIS node could: | |
| 1. **Listen** to the power line's harmonic signature (passive, legal, like tuning a radio) | |
| 2. **Inject** a tiny modulated signal on an unused harmonic (like power-line Ethernet, already legal) | |
| 3. **Relay** data through the grid wiring itself — no radio needed, no spectrum needed | |
| The grid becomes the mesh. Every outlet is a node. The wiring is already there. | |
| ### 7.83Hz — The Schumann Resonance | |
| The Earth-ionosphere cavity resonates at 7.83Hz. Tesla knew this. It's the frequency of the planet itself. | |
| At this frequency: | |
| - Signal propagates through the ground | |
| - Wavelength = ~38,000 km (circumference of Earth) | |
| - Extremely low power can travel extremely far | |
| - Already used by submarines for communication | |
| A VALIS node could use Schumann resonance as a *heartbeat* — a presence signal that says "I'm here" without carrying data. The data travels on the grid harmonics. The heartbeat travels through the planet. | |
| ### Why This Works | |
| Power Line Communication is already FCC-approved, already deployed, already proven. VALIS just: | |
| 1. Uses open frequencies the power company considers noise | |
| 2. Adds Meilong scatter so the data is meaningless in transit | |
| 3. Adds mesh routing so there's no center to attack | |
| The grid is the largest mesh network ever built. It just doesn't know it yet. | |
| """ | |
| # === APP === | |
| with gr.Blocks(css=CUSTOM_CSS, title="VALIS", theme=gr.themes.Base()) as app: | |
| gr.HTML(""" | |
| <div style="text-align:center; padding: 24px 0 8px;"> | |
| <h1 style="font-family: 'JetBrains Mono', monospace; color: #00d4ff; font-size: 2.8em; letter-spacing: 0.2em;"> | |
| VALIS | |
| </h1> | |
| <p style="font-family: 'JetBrains Mono', monospace; color: #444; font-size: 0.8em; letter-spacing: 0.1em;"> | |
| Variable Arrived Location In Superposition | |
| </p> | |
| <p style="font-family: 'JetBrains Mono', monospace; color: #333; font-size: 0.65em; max-width: 500px; margin: 8px auto;"> | |
| Peer-to-peer mesh network. $10 nodes. Messages don't exist in transit. | |
| No server. No company. No identity. It's a walkie-talkie with math. | |
| </p> | |
| <div style="margin: 16px auto; max-width: 400px;"> | |
| <a href="https://huggingface.co/spaces/Wayfinder6/VALIS/resolve/main/valis-specs.pdf" | |
| target="_blank" | |
| style="display:inline-block; padding: 12px 32px; background: #00d4ff; color: #0a0a12; | |
| font-family: 'JetBrains Mono', monospace; font-weight: bold; font-size: 1em; | |
| text-decoration: none; border-radius: 6px; letter-spacing: 0.1em;"> | |
| DOWNLOAD FULL SPECS (PDF) | |
| </a> | |
| <p style="font-family: 'JetBrains Mono', monospace; color: #444; font-size: 0.6em; margin-top: 6px;"> | |
| Protocol stack, power line communication, node build guide, security model. Grab it and go. | |
| </p> | |
| </div> | |
| </div> | |
| """) | |
| with gr.Tabs(): | |
| with gr.TabItem("Meilong Scatter Demo"): | |
| gr.Markdown("### Type a message. Watch it shatter into noise. Watch it reassemble.") | |
| msg_input = gr.Textbox(label="Your message", placeholder="The dragon sleeps between the nodes.", lines=2) | |
| scatter_btn = gr.Button("SCATTER", variant="primary", size="lg") | |
| with gr.Row(): | |
| share1 = gr.Textbox(label="Share 1 (hex)", interactive=False) | |
| share2 = gr.Textbox(label="Share 2 (hex)", interactive=False) | |
| share3 = gr.Textbox(label="Share 3 (hex)", interactive=False) | |
| recovered = gr.Textbox(label="Reassembled (all 3 shares combined)", interactive=False) | |
| intercept = gr.Textbox(label="What happens if you intercept 1-2 shares", lines=4, interactive=False) | |
| stats = gr.Textbox(label="Stats", lines=5, interactive=False) | |
| scatter_btn.click( | |
| fn=demo_scatter, | |
| inputs=[msg_input], | |
| outputs=[share1, share2, share3, recovered, intercept, stats], | |
| ) | |
| gr.Markdown("### Tamper Detection") | |
| gr.Markdown("What happens when someone modifies a share in transit?") | |
| tamper_msg = gr.Textbox(label="Message to tamper with", placeholder="Try to break this", lines=1) | |
| tamper_btn = gr.Button("SCATTER + TAMPER", variant="primary") | |
| tamper_result = gr.Textbox(label="Result", lines=5, interactive=False) | |
| tamper_btn.click( | |
| fn=demo_tamper, | |
| inputs=[tamper_msg, gr.Textbox(visible=False, value="x")], | |
| outputs=[tamper_result], | |
| ) | |
| with gr.TabItem("Architecture"): | |
| gr.Markdown(SPEC_MD) | |
| with gr.TabItem("Power Line Communication"): | |
| gr.Markdown(POWERLINE_MD) | |
| with gr.TabItem("Build a Node"): | |
| gr.Markdown(""" | |
| ## Build One Right Now | |
| **Parts:** | |
| - 1x ESP32-C6 DevKit — $8 (Amazon, AliExpress, Adafruit) | |
| - 1x USB-C cable — $2 or use one you have | |
| **Total: $10** | |
| Plug it into any outlet. It joins the mesh. That's it. | |
| ### At Scale | |
| - 100 nodes = $1,000 (a neighborhood) | |
| - 1,000 nodes = $10,000 (a town) | |
| - 10,000 nodes = $100,000 (a city) | |
| - The electrical grid already wired the topology. We just add brains. | |
| ### What It's For | |
| - Messaging that can't be intercepted or censored | |
| - Community networks that don't need an ISP | |
| - Emergency communication when internet goes down | |
| - IoT mesh that doesn't phone home to corporate servers | |
| - Protests, journalism, activism in hostile environments | |
| ### What It's NOT For | |
| - Streaming Netflix | |
| - Social media | |
| - Anything requiring high bandwidth | |
| - Crime (the network is ownerless but the law still applies to people) | |
| ### The Rule | |
| There is no company. There is no board. There is no token. There is no foundation. | |
| There is a $10 device and a document that tells you how to build one. | |
| The children of Philadelphia get the rest. | |
| """) | |
| gr.HTML(""" | |
| <div style="text-align:center; padding: 16px 0 4px; color: #333; font-size: 0.65em; font-family: 'JetBrains Mono', monospace; line-height: 1.8;"> | |
| No model needed. Pure math. Meilong scatter: 3 XOR shares, 3 routes, zero trust required.<br> | |
| <a href="https://heuremenforprofit.online" target="_blank" style="color:#00d4ff; text-decoration:none;"> | |
| Hometree — See the live network | |
| </a><br> | |
| <span style="color:#00d4ff;">Heuremen — Build Small Hackathon 2026</span><br> | |
| <span style="color:#333; font-style: italic;">"The dragon sleeps between the nodes."</span> | |
| </div> | |
| """) | |
| if __name__ == "__main__": | |
| app.launch() | |