-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPIP: Data Onboarding via HTTP POST (and future ipfs:// POST|PUT) #375
Comments
@RangerMauve found some additional notes, these are bit old and may not hold truth anymore, but food for thought: The difference between PUT and POSTOpen question, but usual is around PUT being idempotent. What is the standard here? Should calling it once or several times successively have the same effect ( How could the
|
Pasting in some notes that Kubo maintainers have had on this topic: IPFS Ecosystem is lacking generic HTTP API for data ingestion. This means every service invents their own, re-inventin the same thing (HTTP upload endpoint) over and over again, but with small changes which mean we are unable to write clients that are compatible with multiple services or IPFS implementations. This creates artificial barriers for adoption and vendor lock-in (people need to pick 1-3 “winners” and have to live with them as the switching cost is too high). This is real problem – Brave is currently forced to look at proprietary CAR upload APIs from nft.storage, because we have no generic one. We have vendor-agnostic API for data retrieval (HTTP gateway and block / car responses, or deserialized version for UnixFS). We need similar flexibility for ingestion: ability to upload a file, Tar stream and let gateway chunk and produce UnixFS, OR accept pre-chunked content addressed data as blocks and CARs. |
I've had great luck with the HTTP POST/PUT APIs I added into Agregore via extensions to Kubo's existing Writable API. https://github.com/AgregoreWeb/agregore-ipfs-daemon/blob/main/spec.md cc @fabrice who's been doing something similar in Iroh. n0-computer/iroh#499 |
Regarding form data, I've found it useful to be able to say "Upload these files to a single directory" and let the application deal with nested directories itself. It's not as powerful as the subdirecotory hack in kubo, but it's straightforward and integrates with existing tooling. |
Just to throw an idea in, any opinions on the viability of adding https://github.com/nwtgck/piping-server like functionality for cacheless gateways? The idea would be a provider keeps an HTTP connection with the gateway after an initial PUT/POST request, and can then stream the content over the gateway to clients without the gateway needing to store it |
I am evaluating different options for implementing an IPFS gateway for my own use. My needs are quite modest: I just need to be able to POST a single file at a time and get the new CID back. My infra looks like this: [User] <-- 1 -- > [AWS API Gateway] <--2--> [NGINX] <-- 3 --> [IPFS Gateway]
So, my actual question would be: Should I implement my own hack for POST until such time that #375 is resolved, or can I trust the deprecated POST gateway be there in the meantime? |
@Winterhuman this is offtopic / bigger scope than the API discussed here, but see "libp2p over HTTP" discussions linked from libp2p/specs#477. The same service could expose bitswap or other data transfer protocol over that, in addition to regular Gateway, but these would be separate things and specs. @fizzl you should not build things based on legacy implementation, timelines changed and we most likely remove the old "Writable Gateway" before new one is ready (ipfs/kubo#9738). For new projects, write your own onboarding code, or use Kubo's |
I was asked to write my use case for a writable gateway in here. I like the idea of applications like IPFessay that allow you to publish a Markdown document directly in the browser. |
I find put and post to be really useful in developing small applications in Agregore and we've got some example apps put together which folks can look at on our website. https://agregore.mauve.moe/ |
Since no one seems to have mentioned it so far: |
Problem statement
HTTP Gateways are the most successful way for retrieving content-addressed data. Successful use of HTTP for retrieval use cases proves that IPFS does not replace HTTP, but augment it by providing variability and resiliency. IPFS over HTTP brings more value than the sum of its parts.
Removing the need for implementation specific RPC APIs (like one in Kubo) allowed not only faster adoption of CIDs on the web, but enabled alternative implementations of IPFS (like Iroh in Rust) to test compliance and benchmark thenselves against each other.
While we have HTTP Gateways as a standard HTTP-based answer to the retrieval of data stored with IPFS (including verifiable application/vnd.ipld.raw and application/vnd.ipld.car responses), the data onboarding over HTTP is currently done with vendor-specific APIs.
The status quo at 2023 Q1 is pretty bad from the end user/developer’s perspective: every IPFS implementation, including online services providing storage and pinning services, exposes custom opinionated HTTP API for onboarding data to IPFS.
Why we need IPIP for HTTP Data Onboarding
To illustrate, some prominent examples (2022 Q4):
Click to expand 🙈
/add
endpoint uses unixfs by default, but also accepts CARs when HTTP POST request is made with?format=car
and it only accepts CARs with single root.And the CAR upload API insanity corca 2024 Q1:
This state of things introduces an artificial barrier to adoption: the user needs to learn what APIs are available, and then “pick winners” – decide which implementations and services are the most future-proof. And even then, many choices are burdened by legacy of Kubo RPC and it’s degraded performance and DX/UX in web browsers.
Goal: create data onboarding protocol for both HTTP and native IPFS
The intention here is to create IPIP with a vendor-agnostic protocol for onboarding data that:
POST https://
)fetch
API as it is in the command-line withcurl
ipfs://
behavior is analogous to subdomain gatewaysPOST https://
ANDPOST ipfs://
APIsIPIP scope
We want two IPIPs: one for onboarding data with HTTP POST, and one for authoring (modifying/pathing) it with HTTP PUT.
This allows us to ship most useful onboarding first, and then do authoring as an optional add-on, which services may support, but dont have to (if they are only onboarding to filecoin etc).
For now, focusing on the POST
POST Requests (Onboarding)
/api/v0/add
in Kubo)The working code for this will be reference implementation that replaces/updates the legacy
Gateway.Writable
feature in Kubo with the above feature set.PUT/PATCH/DELETE Requests (Authoring)
This will be a separate IPIP, but flagging this as long term plans that should feel idiomatic too.
dag diff
anddag patch
commands.References
The text was updated successfully, but these errors were encountered: