File Network

Not fully stable or implemented

Architecture Overview

Four layers, from a static file-sharing page today to a rewarded, consensus-backed network tomorrow.

1

Layer One — the intentionally lightweight layer

Users can share and search for files and links directly via the web.

2

Consensus and Blockchain Layer

Each file is associated with two keys: public_key (the public key of the user who uploaded the file) and server_public_key (the key of the server that currently stores the file). It is possible to create a consensus and blockchain system — the key found on the majority of servers becomes the standard and immutable key for a specific file. Currently, the keys used are secp256r1 (P-256).

3

Transaction Layer

Users earn points the more their keys are present in files. Users can send these points to other users or sell them.

Conventions

Who may change what

It is a system standard that servers must not alter the public_key field of the files they receive or store, but they may modify only the server_public_key. The idea is precisely that the public_key is the field that identifies the user who is actually the owner or creator of the file, or who first uploaded it to the network, while the server_public_key field is the key of the server that stores the file.

Meshare — Features

A single-file, Java 8–compatible, peer-to-peer file browser and downloader that runs Layer One from a local web page instead of a desktop GUI.

One file, no dependencies

No build tools, no external libraries, no framework — everything lives in a single Meshare.java, using only the JDK (including the built-in com.sun.net.httpserver), so it compiles and runs with a stock Java 8+ install:

javac Meshare.java   # or: java Meshare.java  (Java 11+, no separate compile step)
java Meshare         # starts on port 8080 by default
java Meshare 9090    # or pass a custom port as the first argument

Search & results

  • Type a filename, description, hash, or server URL and results stream in live as each server responds.
  • Every match is a card with thumbnail, filename, source server, size, description and status.
  • Images/videos preview straight from the source server before download; clicking again just opens the local copy.
  • Manual Download and JSON buttons, plus checkboxes for bulk selection.
  • Pagination at 10 results per page.

Additional options

  • Search options: random tries per server, allow/disallow links.
  • Reload or edit servers.txt from the browser.
  • Download selected / matching / all files across every server.
  • Open the local files/ folder, view details and a live log.

Disk layout

Meshare.java / Meshare.class
servers.txt   servers you search/download from
files.txt     your local file list (auto-maintained)
links.txt     optional external links to share/search
public_key.txt  optional public key for this node
files/        downloaded binaries, <sha256>.<ext>
info/         downloaded metadata, <sha256>.json
log/          one log file per completed download
tmp_links/    scratch space for resolving link entries

Sharing your own node

Turning on Share this node starts a second HTTP server (default port 8765) that serves your files/, info/, files.txt, links.txt and public_key.txt to other Meshare users, so they can add your address to their own servers.txt.

Server discovery

servers.txt grows on its own, and a URL is only ever added if that exact line doesn't already exist:

  • On startup, for every known server, Meshare fetches its servers.txt and adds a candidate only if it's a live http(s) address hosting a files.txt with at least one valid <sha256>.<extension> line. A remote servers.txt or files.txt is capped at 500 KB, and only the first 1000 non-empty lines are ever considered.
  • When a peer visits your share server, Meshare checks — once per IP, in the background — whether that IP also answers as a Meshare server on port 80, 8080, or 8765 over http/https, and adds it if so (no files.txt required this time). Loopback addresses are always ignored.

HTTP API (local UI server)

EndpointPurpose
GET /The web UI
GET /api/eventsServer-Sent Events stream (log lines, search results, status)
GET /api/stateCurrent in-memory state (for page reload)
POST /api/searchStart a search
POST /api/stopStop the current search
POST /api/downloadDownload selected / matching / all results
POST /api/servers/reloadReload servers.txt from disk
GET /api/entry/jsonFull JSON metadata for one result
POST /api/share/start, /api/share/stopStart/stop the peer-facing share server
POST /api/openFolderOpen the local files/ folder
GET/POST /api/fileRead/edit servers.txt, links.txt, public_key.txt from the browser
GET /files/<name>Serve a locally downloaded file
GET /info/<name>Serve locally downloaded metadata