YTCP Protocol: Unchained Packet Swarm for Shitty Links

No fluff, I admire MaxV soo our pitch is goona be fast, No_Ai shit, straight to race ;)

Straight rebuild: Deconstructed your v0 into basics—unordered ID'd packets, random encrypt per block, blockchain for metadata/resume, no-handshake continuity. Scrapped fluff; rebuilt as a web3-native, P2P beast that turns unstable nets into a decentralized relay casino. No AI/ML—pure chain logic, crypto randomness, and token bounties for funk. npm: ytcp-protocol – exports initSender(), initReceiver(), with Web3.js deps for chain hooks.

Me Roasting TCP a bit cuz it's neverEnding

Alt text

a bit more....

Alt text

Rebuilt Core Algo: "Eternal Swarm Mode"

File → Shred into 1KB packets → Batch into blocks (10-50 packets/block). Each packet: UUID (from web3 wallet nonce + timestamp hash for collision-proof). Block-level: Crypto.randomBytes() picks encrypt algo from pool (AES-GCM, XSalsa20, Fernet—browser-safe via SubtleCrypto). No two blocks share algo; rotate keys via chain-derived seeds (e.g., prev block's tx hash as IV).

Blockchain (Polygon for cheap gas): Stamps metadata only per block—{blockID, packetIDs[], encryptAlgoIndex (obfuscated), pubKey, merkleRoot (for integrity), txNonce (for ordering), bountyPot (micro-ETH for relays)}. Data stays off-chain; use IPFS for packet pinning if direct send fails—stamp CID in metadata tx.

Resumption: On lag/drop, receiver queries chain for last tx → pulls pub/priv keys (encrypted via sender's wallet) → gets last packetID → sender resumes from next, signing new tx to "expand" the chain session. No TCP handshakes—chain txID is the session ID; continuity via event listeners on contract.

Out-of-box twist: "Bounty Roulette" – each block tx includes a nano-ETH bounty (0.001 gwei). Relays (P2P nodes via WebRTC/ENR discovery) can claim by proving delivery (sign packet receipt, stamp on chain). Random oracle (Chainlink VRF) picks relay paths—packets "gamble" routes for redundancy, rewarding fastest paths. Unstable link? Packets scatter to 3-5 peers; winner claims pot. Funky web3: Failed packets become "zombie NFTs" – mint as ERC-721 with metadata, tradeable for retry bounties in disaster zones. Alt text

Raw Features/Improvements

  • Priority Channels (Web3 Style): Blocks tagged with "gas priority" – high-urgency (e.g., F1 telemetry) pay higher bounty, attracting more relays. Chain contract enforces: query oracle for network "congestion score" (from tx mempool), auto-bump bounty.
  • Integrity Checks: Packet-level BLAKE3 hash chained to block merkle. On receive, verify via chain root—partial fails trigger bounty-penalized re-requests. No full redo; just zombie the bad packet.
  • Real-Time Status: WebSocket over Web3 (e.g., ethers.js provider) – subscribe to contract events for live tx confirms. Dashboard: Browser extension pulls chain logs, shows "swarm map" (packets en route, bounties claimed).
  • Funky Expansion: Multi-device swarm—sender shards to phones/laptops; chain coordinates reassembly. For rural clinics: Offline mode pins to local IPFS, syncs on reconnect via chain beacon.
  • Zero-Trust Auth: Wallet-sign all tx; no servers—pure P2P. Unique: "Expansion Forks" – if fork detected (unstable net splits chain view), merge via majority-vote oracle, refunding split bounties.
  • Scalability Hack: For 1TB files, batch txs into "superblocks" (rollup-style, 100 blocks/tx) to cut gas. Testnet demo in npm: Hardhat contract included.

How It Flows (No Bullshit Steps)

  1. Sender: Shred file, encrypt packets/blocks randomly, sign with wallet.
  2. Init tx on chain: Stamp genesis metadata, deposit bounty pot.
  3. Swarm send: Blast packets unordered via UDP/WebRTC; relays gamble routes via VRF.
  4. Receiver: Poll chain events, pull arriving packets (direct or IPFS), verify hashes.
  5. Drop? Receiver queries last tx, sender expands chain with next block—resume seamless.
  6. End: Final tx closes session, refunds unclaimed bounties. Reassemble by IDs.

No one mashes UDP chaos with web3 bounties for unstable relays—existing (IPFS/BTFS) are storage-focused, not live-transfer resilient. But we did, soo pls select us 😭

Pseudo-code stub to whet your appetite:

javascript

const ytcp = require('ytcp-protocol');
const { ethers } = require('ethers'); // Web3 hook

async function sendFile(wallet, filePath) {
  const provider = new ethers.JsonRpcProvider('https://polygon-testnet.rpc'); // Or your chain
  const signer = wallet.connect(provider);
  const session = await ytcp.initSender({ signer, file: filePath, bountyPerBlock: 0.001 });
  session.swarmSend(); // Blasts packets, stamps chain
  // On drop: session.resumeFromChain();
}

We included a Hardhat contract for demo deploys – think of it as our garage setup.

Here's a quick table pitting YTCP against the old guard:

Feature Traditional TCP/SCP YTCP Swarm
On Disconnect Full restart, tears Chain query → resume from last ID, zero sweat
Priority FIFO snooze-fest Bounty-boosted "gas lanes" – urgent F1 data laps the logs
Integrity End-of-file prayer Packet BLAKE3 + Merkle chains – zombie bad ones, fix partial
Status Spinning wheel of doom Web3 WebSockets: Live "swarm map" with bounty claims
Scalability Chokes on big files Superblock rollups – 1TB? No prob, gas-efficient

And for the flow, because visuals make devs happy: | Step | What Happens | F1 Analogy | | --- | --- | --- | | 1 | Shred/encrypt/sign with wallet | Pre-race setup: Fuel the packets | | 2 | Init chain tx with bounty | Grid start: Deposit the pot | | 3 | Swarm blast via UDP/WebRTC + VRF routes | The race: Packets gamble paths | | 4 | Receiver polls chain, pulls/verifies | Pit stop: Assemble on IDs | | 5 | Drop? Query/expand chain | Safety car: Resume without yellow flags | | 6 | Close tx, refund bounties | Checkered flag: Reassemble, claim wins |

Built With

  • eccentric-thinking
  • love-tocode-&bingef1
  • no-ai
  • overthinking
  • passion
Share this project:

Updates