Skip to content

rfc: Ucanto transport in HTTP headers#60

Open
alanshaw wants to merge 2 commits intomainfrom
feat/http-header-transport
Open

rfc: Ucanto transport in HTTP headers#60
alanshaw wants to merge 2 commits intomainfrom
feat/http-header-transport

Conversation

@alanshaw
Copy link
Member

@alanshaw alanshaw commented Jun 16, 2025

This RFC attempts to define a Ucanto style transport that allows invocations and receipts to be communicated in HTTP headers, leaving the HTTP request/response body usable for alternative purposes.

The idea is to use this proposal to allow us to send a space/content/retrieve invocation in the HTTP headers of a HTTP GET request. The response body is subsequently used to return the requested bytes in a single round trip (for the majority of requests), while allowing egress to be accounted for via signed invocations/receipts.

📚 Preview

🎬 Implementation Demo

@alanshaw alanshaw requested a review from a team June 16, 2025 14:35
@alanshaw alanshaw changed the title feat: Ucanto transport in HTTP headers rfc: Ucanto transport in HTTP headers Jun 16, 2025
Copy link
Member

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest question is the format. Given the size limit challenges, should we consider:

@alanshaw
Copy link
Member Author

I'm pretty easy on the format. In my testing this wasn't much more than 1kb using the existing format and less when gzipped (for a typical chain of invocation plus 2x delegation chain). I'm cool with compressing, would be nice to not have to introduce another format...and we can always iterate...

@hannahhoward
Copy link
Member

@alanshaw gzip is my priority, if you want to skip the container format I'm not super attached.

Copy link
Member

@frrist frrist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

alanshaw added a commit to storacha/go-ucanto that referenced this pull request Sep 11, 2025
This PR implements the [RFC
here](storacha/RFC#60). It exposes a server and
client implementation that allows UCAN authorized retrieval requests via
invocations (and receipts) passed in HTTP headers. This leaves the HTTP
response body available to be used for retrieved bytes.

A retrieval server is very similar to a normal Ucanto server, except it
requires invocations to be sent using the `headercar` transport codec.
The only other difference is that invocation handlers receive an extra
argument - the HTTP request info, and can return and additional value -
a HTTP response.

The retrieval client is also very similar to a Ucanto client, except
that it has the ability to send an invocation in multiple parts, if it
does not fit in HTTP headers. Essentially it'll send proofs one by one
until the server has all the proofs required to execute the invocation.
The server has an LRU cache allowing for this.

The PR also includes a transport codec that encodes agent messages into
HTTP headers.

🎬 Demo: https://youtu.be/11np-cGTe48?si=kw88R1DAlMSq-b1T

resolves #59

---------

Co-authored-by: Forrest <forrest@storacha.network>
alanshaw added a commit to storacha/specs that referenced this pull request Sep 12, 2025
Adds specs for UCAN invocations over HTTP headers and the related
retrieval spec that uses it.

The UCAN invocations over HTTP headers spec is based on
storacha/RFC#60

[🎬 Implementation Demo of UCAN invocations over HTTP
headers](https://youtu.be/11np-cGTe48?si=kw88R1DAlMSq-b1T)

[📚 Preview UCAN invocations over HTTP headers
spec](https://github.com/storacha/specs/blob/ash/feat/add-http-header-inv-and-retrieval-specs/http-header-ucan-invocation.md)

[📚 Preview Retrieval
spec](https://github.com/storacha/specs/blob/ash/feat/add-http-header-inv-and-retrieval-specs/w3-retrieval.md)

resolves storacha/project-tracking#504

---------

Co-authored-by: Vicente Olmedo <vicente@storacha.network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants