what do you think about a : Freenet Universal API Proxy (FUAP) #2905
guidryheal-create
started this conversation in
General
Replies: 2 comments 3 replies
|
Idea would be to bridge any to any and make pythonic or else WSGI totaly ok to freenet protocol that would then just act as a better proxy rather than a long new way to code the internet to the eyes of a dev |
1 reply
|
This can be built as an external extension, I don't think we need native support in the peer for it right? Is just another abstraction on top of the HTTP gateway and the websocket API. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A Generalized Contract-Based Protocol Bridge for HTTP, MCP, and Beyond
1. Goal (what we are actually building)
Create a general-purpose Freenet contract that acts as a protocol-neutral request/response broker, enabling:
…to be projected onto Freenet, while still feeling like a normal synchronous API to the client, via a local gateway.
The user experience:
The client believes it is calling a normal API.
Under the hood, the call becomes a Freenet state transition + eventual callback.
2. Non-goals (important constraints)
This system does not:
Instead, it reifies protocols as data.
3. High-level architecture
River already demonstrates:
We reuse that exact pattern, but the “UI” becomes a local protocol gateway.
4. Core idea: protocols as replicated data
Instead of routing traffic, we model requests and responses as state.
Canonical request object
All incoming protocols are normalized into a single structure:
Canonical response object
These are pure data, suitable for a Freenet contract.
5. The Proxy Contract (generalized, reusable)
Responsibilities
The proxy contract:
Stores requests and responses
Enforces:
Ensures commutative merges
It does not:
Contract state (simplified)
This state forms a commutative monoid:
River already uses this pattern for messages and rooms.
6. Who executes the request?
This is the crucial inversion.
Execution flow
Client sends HTTP request to local gateway
Gateway converts it →
ProxyRequestDelegate signs and submits it to the contract
Any subscribing peer may:
Executor submits a
ProxyResponsedeltaState converges
Original client receives the response via subscription
This is work stealing, not client/server.
7. How the client still “feels” synchronous
The illusion of a normal API call is maintained locally.
Local gateway behavior
Accept HTTP request
Submit request to Freenet
Block (or async-wait) on:
Return HTTP response to client
This is local blocking over global async state.
Exactly how River’s UI waits for message sync—just repurposed.
8. Contract address as routing primitive
The URL embeds the contract identity:
Routing logic:
<contract_id>→ Freenet contract instance/api/foo→ protocol-level pathThis mirrors how River uses:
9. Protocol extensibility (HTTP, MCP, others)
Protocols differ only before normalization and after response materialization.
The proxy contract itself is protocol-agnostic.
Adapters live in the gateway:
This makes the contract stable and reusable.
10. Security model
What is trusted
What is not
Guarantees
11. Why River is the correct foundation
River already proves:
This proxy system is River without chat semantics.
Replace:
Message→ProxyRequestRoom→Contract IDUI→Local API GatewaySame architecture. Different payload.
12. What this enables (realistically)
Not faster than HTTP.
Not simpler than REST.
But structurally different in a way that scales where servers fail.
13. Final framing (this matters)
You are not proxying traffic.
You are projecting protocols onto replicated truth.
Once you see that, the design stops fighting physics and starts cooperating with it.
All reactions