Skip to content

Instantly share code, notes, and snippets.

@melvincarvalho
Last active January 2, 2026 17:27
Show Gist options
  • Select an option

  • Save melvincarvalho/1f88d874542a7db10fc2263ada4e7696 to your computer and use it in GitHub Desktop.

Select an option

Save melvincarvalho/1f88d874542a7db10fc2263ada4e7696 to your computer and use it in GitHub Desktop.
TSEED: Incentivized Torrents with Bitcoin Settlement - Design Document

TSEED: Incentivized Torrents with Bitcoin Settlement

What if seeding torrents paid real Bitcoin?


The Insight

Private trackers solved the free-rider problem with reputation. 500 million people torrent. Most content dies because no one seeds. Private trackers proved people will maintain ratio—for fake points.

What if those points were worth real money?


How It Works

SEED 1 GB   →   Earn 1000 TSEED tokens
LEECH 1 GB  →   Pay 1000 TSEED tokens

TSEED ↔ Bitcoin (via AMM)

Your bandwidth becomes income.
Your hard drive becomes a Bitcoin mine.

The Economics

Rare content (few seeders):

  • High demand, limited supply
  • Seeders earn more
  • Market incentivizes preservation

Popular content (many seeders):

  • Competition drives price down
  • Nearly free to download
  • Still better than zero incentive

The market prices bandwidth automatically.


The Key Insight: Nostr Relays ARE Trackers

BitTorrent trackers and Nostr relays do the same thing:

BitTorrent Tracker Nostr Relay
Announce peer info Publish event
Return peer list Subscribe to filter
Track upload/download Event content
Authentication Built-in (signatures)
Centralized Already decentralized

We don't need to build tracker infrastructure. It already exists.


Architecture

┌─────────────────────────────────────────────────────────────┐
│                                                              │
│  Seeder                                Leecher              │
│     │                                      │                 │
│     │ EVENT kind:21000                     │                 │
│     │ "I have this torrent"                │                 │
│     ▼                                      │                 │
│  ┌──────────────────────────────────────────┐               │
│  │            Nostr Relay                    │               │
│  │         + WebLedger Balances             │               │
│  │         + AMM Pool                        │               │
│  │                                           │               │
│  │  • Verify signature ✓                    │               │
│  │  • Check TSEED balance ✓                 │               │
│  │  • Credit uploads / Debit downloads      │               │
│  │  • Store announce event                  │               │
│  │                                           │               │
│  └──────────────────────────────────────────┘               │
│                       │                                      │
│                       │ REQ: "who has this torrent?"         │
│                       ▼                                      │
│                   Leecher                                    │
│                       │                                      │
│                       │ Gets peer list from events           │
│                       │ Connects directly, downloads         │
│                       │                                      │
│                       │ EVENT kind:21000                     │
│                       │ "I downloaded 500MB"                 │
│                       │ (debits TSEED balance)               │
│                                                              │
└─────────────────────────────────────────────────────────────┘

NIP-XX: Torrent Peer Discovery

New Nostr event kind for torrent announces:

// Kind 21000: Torrent Announce
{
  "kind": 21000,
  "pubkey": "abc123...",
  "created_at": 1704200000,
  "tags": [
    ["i", "<info_hash_hex>"],         // Torrent identifier
    ["relay", "wss://relay.example"], // Where to reach this peer
    ["port", "6881"],                 // BitTorrent port (optional)
    ["uploaded", "524288000"],        // Total bytes uploaded
    ["downloaded", "104857600"],      // Total bytes downloaded
    ["left", "0"]                     // Bytes remaining (0 = seeding)
  ],
  "content": "",
  "sig": "..."
}

Peer Discovery

// Find peers for a torrent
const filter = {
  kinds: [21000],
  "#i": ["<info_hash>"],
  since: Math.floor(Date.now() / 1000) - 3600  // Last hour
};

relay.subscribe(filter, (event) => {
  const peer = {
    pubkey: event.pubkey,
    relay: getTag(event, 'relay'),
    port: getTag(event, 'port'),
    seeding: getTag(event, 'left') === '0'
  };
  connectToPeer(peer);
});

Announce

// Announce your presence
const event = {
  kind: 21000,
  tags: [
    ["i", infoHash],
    ["relay", "wss://relay.example"],
    ["uploaded", totalUploaded.toString()],
    ["downloaded", totalDownloaded.toString()],
    ["left", bytesRemaining.toString()]
  ],
  content: ""
};

signAndPublish(event);

Payment Integration

The relay checks balances before accepting announces:

// Relay-side event handler
relay.on('event', async (event) => {
  if (event.kind === 21000) {
    const did = `did:nostr:${event.pubkey}`;

    // Get previous announce to calculate deltas
    const lastAnnounce = await getLastAnnounce(did, getTag(event, 'i'));
    const uploadDelta = parseInt(getTag(event, 'uploaded')) - lastAnnounce.uploaded;
    const downloadDelta = parseInt(getTag(event, 'downloaded')) - lastAnnounce.downloaded;

    // Convert bytes to tokens (1 token per MB)
    const earned = Math.floor(uploadDelta / 1_000_000);
    const cost = Math.floor(downloadDelta / 1_000_000);

    // Check balance for downloads
    const balance = getBalance(did, 'TSEED');
    if (balance < cost) {
      return {
        ok: false,
        msg: `Insufficient balance. Need ${cost} TSEED, have ${balance}`
      };
    }

    // Update balance
    setBalance(did, 'TSEED', balance + earned - cost);

    // Store announce
    await storeAnnounce(did, event);
  }

  return { ok: true };
});

WebLedger State

Balances stored in standard WebLedger format:

{
  "@context": "https://w3id.org/webledgers",
  "type": "WebLedger",
  "defaultCurrency": "TSEED",
  "entries": [
    {
      "type": "Pool",
      "url": "urn:pool:TSEED:satoshi",
      "amount": [
        { "currency": "TSEED", "value": 10000000 },
        { "currency": "satoshi", "value": 5000000 }
      ],
      "k": 50000000000000,
      "fee": 0.003
    },
    {
      "type": "Entry",
      "url": "did:nostr:de7ecd1e2976a6adb2ffa5f4db81a7d812c8bb6698aa00dcf1e76adb55efd645",
      "amount": [
        { "currency": "TSEED", "value": 145000 }
      ]
    }
  ]
}

AMM: Cash Out Anytime

Constant product market maker. Swap TSEED ↔ sats instantly.

// Swap TSEED → satoshi
function swap(amountIn, reserveIn, reserveOut, fee = 0.003) {
  const amountInWithFee = amountIn * (1 - fee);
  const numerator = amountInWithFee * reserveOut;
  const denominator = reserveIn + amountInWithFee;
  return Math.floor(numerator / denominator);
}

// Example: Cash out 10,000 TSEED
const satsOut = swap(10000, tseedReserve, satsReserve);
// → Receive ~4,950 sats (minus slippage)

Your fake torrent points now have real exit value.


User Flow

1. ONBOARD
   ├── Have a Nostr key (or generate one)
   ├── Deposit sats → receive TSEED via AMM
   └── Configure client with relay URL

2. DOWNLOAD
   ├── Add torrent (magnet or .torrent)
   ├── Client publishes kind:21000 to relay
   ├── Balance deducted per MB downloaded
   └── If balance low → prompted to deposit

3. SEED
   ├── Keep torrents seeding
   ├── Every announce credits your balance
   └── Rare content = more earnings

4. CASH OUT
   ├── Swap TSEED → sats via AMM
   └── Withdraw to Lightning or on-chain

Client Integration

Option A: Modified Tracker URL (Works Today)

Relay exposes HTTP endpoint that speaks BitTorrent tracker protocol:

Tracker URL: https://relay.example/announce?auth=<nostr_sig>

Works with any existing client. Zero modifications.

Option B: Nostr-Native Client

Client speaks Nostr directly:

// Announce loop
setInterval(async () => {
  const event = createAnnounceEvent(torrent);
  await relay.publish(event);
}, 30 * 60 * 1000); // Every 30 minutes

// Peer discovery
relay.subscribe(
  { kinds: [21000], "#i": [torrent.infoHash] },
  (event) => connectToPeer(event)
);

Option C: Browser Extension

Intercepts tracker requests, converts to Nostr events:

browser.webRequest.onBeforeRequest.addListener(
  async (details) => {
    if (isTrackerRequest(details.url)) {
      const event = convertToNostrEvent(details);
      await relay.publish(event);
      return { cancel: true }; // Handle via Nostr instead
    }
  },
  { urls: ['*://*/announce*'] }
);

Why Nostr Relays?

Build Custom Tracker Use Nostr Relays
Build infrastructure Already exists
Implement auth Built-in signatures
Single point of failure Decentralized
New protocol Extend existing NIPs
3+ weeks work ~1 week work
Maintain servers Community maintains

The relay becomes the entire backend: events + balances + AMM.


The Numbers

BitTorrent daily traffic: ~2 exabytes (~2 billion GB)

At 1 TSEED per MB:

Daily token volume:     2 trillion TSEED movements
At 1 TSEED = 0.0005 sats:
Daily BTC volume:       ~1 billion sats = ~$300,000/day
Annual volume:          ~$100M/year

At 10x price discovery:
                        ~$1B+/year flowing through TSEED

This would make TSEED one of the highest-volume Bitcoin L2s.


Why This Wins

Current State With TSEED
Content dies when seeders leave Seeders paid to stay
Private trackers = invite only Open, but must pay
Ratio is meaningless points Ratio is money
No exit value for ratio Cash out anytime
Freeloaders dominate Freeloaders pay

Why Now?

The pieces finally exist:

  1. Nostr - Decentralized identity + relay infrastructure
  2. WebLedger - Standard format for federated balances
  3. AMMs - Instant liquidity without order books
  4. NIP-98 - HTTP authentication with Nostr keys
  5. Bitcoin - Finally ready for micropayments (off-chain)

They just need assembly.


Comparison to Alternatives

Solution Problem
BitTorrent Token (BTT) On TRON, centralized, barely used
FileCoin Storage proofs, not bandwidth. Complex.
Private trackers Invite-only, no real value
Paid seedboxes You pay them, not the other way

TSEED: Open, simple, Nostr-native, real Bitcoin settlement.


Risks & Mitigations

Risk Mitigation
Cheating stats Receipts signed by both peers (phase 2)
Copyright takedowns Relay doesn't host content, just events
Low initial liquidity Bootstrap pool, LP incentives
Client adoption HTTP tracker compat = works today
Relay centralization Multiple relays, federated balances

Roadmap

Phase 1: MVP (2 weeks)
├── NIP-XX specification
├── Relay with balance checking
├── WebLedger integration
├── AMM pool for TSEED ↔ sats
└── HTTP tracker compatibility layer

Phase 2: Adoption (2 months)
├── Nostr-native torrent client
├── Browser extension
├── Mobile support
└── Marketing: "Get paid to seed"

Phase 3: Decentralization (3 months)
├── Federated relay network
├── Cryptographic receipts (trustless)
├── Multiple AMM pools
└── Protocol governance

The Stack

┌─────────────────────────────────────────┐
│           User-Facing Layer             │
│  • Any BitTorrent client (tracker URL)  │
│  • Or: Nostr-native client              │
│  • Or: Browser extension                │
└────────────────┬────────────────────────┘
                 │
┌────────────────▼────────────────────────┐
│           Protocol Layer                │
│  • Nostr relay (kind:21000 events)      │
│  • NIP-98 authentication                │
│  • Balance checking per announce        │
└────────────────┬────────────────────────┘
                 │
┌────────────────▼────────────────────────┐
│           Settlement Layer              │
│  • WebLedger (balances)                 │
│  • AMM pools (instant swap)             │
│  • Bitcoin (final settlement)           │
└─────────────────────────────────────────┘

The Vision

Every hard drive becomes a Bitcoin mine. Every upload earns sats. Every rare file is worth preserving.

The free-rider problem, solved forever. Not with reputation. With money.

Not with a new blockchain. With Nostr + Bitcoin.


Get Involved

This is open source. The protocol is simple. The opportunity is large.

We're building this now.


"Private trackers proved people will work for fake points. What happens when the points are real?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment