Skip to content

IPLD support on Gateways #182

Open
Open
@lidel

Description

@lidel

Current state

Gateway provided by go-ipfs 0.8.0 supports only dag-pb (unixfsv1) and raw (raw block used for leaves) codecs.

Requesting any other IPLD type over a gateway fails.

Where we want to be

It should be possible to download everything over Gateway:

  • If it is impossible to provide web-compatible response, at the bare minimum we should return DAG archive (eg. as CAR – IPFS auto-updating kubo#170) so one can download it and then ipfs dag import <dag-archive> it to own node.
  • Gateway could return more useful response for some IPLD types (like dag-cbor)

Low-hanging fruit: traversable JSON/CBOR documents

Some ideas how to maximize the utility of gateways (those are just prompt for discussion, details TBD):

  • there should be a mechanism for controlling if dag-cbor and dag-json are returned as a valid JSON response with Content-type: application/json or application/cbor
  • it should be possible to traverse CBOR documents if one of the fields points at a CID

Ongoing work

Open questions

  1. Is CAR something we want to introduce, or do we want to wait for "CARv2" like anorth/go-dar
  2. Should it be possible to include non-unixfs nodes inside of a unixfs directory? (this impacts MFS and ipfs-webui)
  3. What should be the default response type for dag-cbor? User will be able to choose, but what happens when there is no user preference? (Original binary or should Gateway return JSON as its more user friendly and makes onboarding easier?)
    • I was initially locked on keeping original format at all cost, but I now see how returning JSON for dag-cbor by default make it work out-of-the-box in browser after copying and pasting the CID, which makes our stack "feel" approachable and easy to understand. This is huge for onboarding new users (devs).
  4. Should we support graphql-like queries against dag-cbor, so only specific fields are returned (think /ipfs/{dag-cbor-cid}?keys=image,name)? (This is separate from traversing CID tags in CBOR)
    • This could be a hidden killer feature when it comes to building web apps against the gateways.
      Any reason to not do this? Does this clash conceptually with planned support for selectors?
  5. Do we need to bikeshed how the format parameter should look like on Gateway?
  6. 👉 (i am sure there is more, please comment below)

cc @warpfork @alanshaw @Stebalien @aschmahmann

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions