Vasco Santos
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # where is that CAR parked? ## TLDR; by @alanshaw Problems: 1. We're missing a mapping of CAR CID -> bucket location. 3. We don't have bucket events in Cloudflare, so need the client to tell us when it has uploaded something. 4. We don't want clients to create location claims for internal bucket URLs because we might change the location in the future (reputation hit for client). 5. We want freeway code to be usable in Saturn nodes, so ideally it uses only content claims to discover locations. Proposed solution: * Simulate bucket event by having client submit `store/confirm` invocation. * Capability name TBC! * Confirms successful transfer of data. * Effect linked by `store/add`. * Create CAR CID -> bucket mapping table (or repurpose old elastic ipfs `blocks-cars-position`). * `store/confirm` handler writes to the table. * Materialize location claims on demand for CAR CID from data in table. * Short lived so we can change location and not have to revoke 1,000's of UCANs. > location claims claim that a CID is available at a URL. w3s read interfaces currently rely on hard assumption that data sits on a given bucket. Freeway and Roundabout assume data is available at R2 bucket `carpark-prod-0`, while Hoverboard relies on a table (from E-IPFS) with CARs locations in S3 to attempt to try to find a car in R2 bucket `carpark-prod-0`. Location claims look like the perfect fit for storing this information. However, we rapidly found a few challenges assuming location claims issued by the client could encode this information: - client does not know the internals - we could go into deriving on the client based on the write URL, or even write the write URL (that would not be readable) - client has no control over the target and if data is migrated to a different target, potentially resulting in reputation damage - claims could be to private buckets that are not accessible from anyone Therefore, clients should only write claims that are clear to them like, a location claim for `w3link`. But `w3link` and other read interfaces would not know where a CAR is parked in a multiple bucket CAR... This way, building an index of CAR CIDs to URLs actually looks more like a problem of w3s than the user. w3s read interfaces need a "private location claims" service where they can find where a CAR is stored. Being a responsability of w3s would put bucket events as the clear path to run some code to write this mapping. However, this path is not compatible to write to R2 today, but also we would not link it to the `store/add` that triggered this. We still need to perform HTTP Request(s) to finalize storing some content. Adding an extra invocation is actually not problematic as we could just batch them all in one CAR. Consequently, we could have a `store/added` capability that could replace the bucket event. This MAY be an effect from `store/add` that SHOULD run after file is written into the bucket. This invocation could then be executed together with `filecoin/offer`, `ipni/publish`, etc. When moving into Saturn being able to know where CARs are parked, we could open this service for certain actors who will serve content from these buckets. Or get materialized claims, where we could even replace URLs by roundabout to decrease operations costs. TLDR we need a **CARWHERE** service where we keep internal mappings of CAR CIDs to URLs. This will enable our read interfaces to be compatible with multiple buckets by not requiring clients to write location claims for internal buckets, but requiring w3s to create this mapping. --- (old archive - may still be relevant for formats) # Location claims URIs former proposal ## Goal Formalize location claims URIs for content hosted in web3.storage owned buckets to optimize readability and costs within our infrastructure for the potential use cases. Note that it is not in scope of this document to define how a client will get to know the locations to claim. This has also its own challenges, like should we want to infer it from presigned URL? should we return on `store/add` receipt the locations where it will be written to? ## Background [Location claims](https://hackmd.io/IiKMDqoaSM61TjybSxwHog?view#Location-Claims) claim that a given CID can be retrieved from a given location URI. Currently, web3.storage operates a few buckets on several providers/locations. In addition, users could also produce claims with third party buckets not provisioned and controlled by web3.storage. Multiple claims can be made for the same content. Therefore, it is worth mentioning that a claim may not be readable from all actors, as some may be behind a given set of permissions/capabilities. Different locations/URIs may provide have readability limitations, different rate limits, or optimized egress costs for certain scenarios. ## Read Use cases A large number of use cases may exist, here we will be focusing on just a subset to start. ### CF Edge Gateway CF Edge Gateway (aka w3link) is a CF worker running within CF datacenters that acts as a IPFS Gateway. Under the hood, it relies on Freeway. When a given root CID is requested from w3link, w3link SHOULD have preference to read CAR files directly from locations within CF datacenters (i.e. R2 backed locations). This will not only be faster, but will also not incur into additional costs reading the data at rest (compared to if that data needs to be read from a S3 bucket for example). #### Requirements - be able to identify a claim as backed by R2 - not highly rate limited - have bucket name in the claim to rely on workers client to read data - have bucket object key in the claim ### Roundabout Roundabout is a serverless function that serves CAR files (only) by their CAR CID (or PieceCID). Main motivation for Roundabout is egress cost optimizations for data at rest on buckets owned by web3.storage. It serves CAR files also without being heavily rate limited like the public R2 Object URLs. Aiming to decrease overall system egress costs, this endpoint creates a presigned URL for the requested content and redirects to it. #### Requirements - be able to identify a claim as backed by R2 - have bucket name in the claim to be able to create presigned URL - have bucket object key in the claim - have bucket secrets to be able to create presigned URL (in Roundabout env) Note that Roundabout is currently used for internal pipelines, like for Filecoin SPs to ingest data at rest to be aggregated and commited. If at some point web3.storage does not own buckets where data is written, it will be deprecated given that is its sole purpose. In the meantime, can also be an opportunity to use within other use cases like Saturn Nodes reads and Station. ### Saturn Nodes Saturn Nodes may have data at rest on their own network. When they would rely on content claims to know where to find requested CARs, they SHOULD prioritize reading from their network. However, if they do not have the data, they will need to have a fallback. Either fetch it from somewhere else and proxy the data, or redirect to a different location. Redirecting to a different location may be trickier, given that location may not be accessible. Saturn nodes could also rely on Roundabout to get the requested CARs #### Requirements - be able to identify a claim backed by a Saturn node - not highly rate limited - (if fallback as Roundabout - perhaps with a custom claims reader client) - be able identify that requested content is in a bucket owned by web3.storage? ### Station Nodes At some point we MAY want to rely on Station Nodes to do computing. For instance, when we want to validate user offered Filecoin Piece really corresponds to the content, having multiple Station Nodes to download the content and compute a PieceCID would require Station nodes to fetch the data. Relying on content claims to get to know claimed locations for the data will be critical. Performing reads for computations may have different requirements, but ideally they should have minimal egress costs for the data at rest. Being able to rely on roundabout would make it cheaper and more decentralized, compared to make it mandatory to run code in the provider where data is at rest. ## Bucket objects Location URIs Defining how the clients will write claims for these target locations is critical to have a mapping of these locations to the buckets to fulfill all requirements above. Typically, objects in S3 buckets can be located via following URIs: - S3 URI (e.g. `s3://<BUCKET_NAME>/<CID>/<CID>.car`) - Object URL (e.g. `https://<BUCKET_NAME>.s3.<AWS_REGION>.amazonaws.com/<CID>/<CID>.car`) - can be used to fetch the bytes by any HTTP client if bucket is public However, R2 object locations have different patterns, instead of following S3 pattern. They can be: - Public Object URL for Dev (e.g. `https://pub-<INTERNAL_R2_BUCKET_IDENTIFIER>.r2.dev/<CID>/<CID>.car`) - can be used to fetch the bytes by any HTTP client, if bucket is public and heavily rate limited - [R2 docs](https://developers.cloudflare.com/r2/buckets/public-buckets/#enable-managed-public-access) state that such URLs should only be used for dev! - Custom domain object URL (e.g. `https://<CUSTOM_DOMAIN>.web3.storage/<CID>/<CID>.car`) - can be used to fetch the bytes by any HTTP client, if custom domain is configured in R2 - can be rate limited by operator configuration - account will need to pay for the egress of reading from the bucket - Presigned URL (e.g. `https://<ACCOUNT_ID>.r2.cloudflarestorage.com/<BUCKET_NAME>/<CID>/<CID>.car?Signature=...&Expires=...`) - can be used to fetch the bytes by any HTTP client, if has the signature query parameter and is not expired - no heavy rate limits in place, together with no egress costs to read data at rest Note that a claim may not be readable from all actors, as some may be behind a given set of permissions/capabilities. ### URIs comparison The main pattern that we can identify is to have URLs that can be accessed by any HTTP client. Except for S3 URIs and given the correct setup/keys is available, all other URLs are fetch'able. Therefore, we can assume as an advantage that claim is directly fetchable without any pre-knowledge. Having a claim that cannot be used by every potential client (i.e. needs some extra permissions) is also a disadvantage that may represent penalties in a reputation system. Moreover, rate limits can have a negative impact on reputation as well. URIs that include all necessary information to enable derivation for smart clients that could rely on Worker R2 Bindings or to generate Presigned URLs are critical for several use cases. URIs that minimize Egress costs can also be preferred by smart clients. Per the above, considering S3, it looks like we should rely on S3 Object URL (e.g. `https://<BUCKET_NAME>.s3.<AWS_REGION>.amazonaws.com/<CID>/<CID>.car`). But with R2, there is no perfect fit. The only good option would be the format used by presigned URLs, but it should only be created on request given their expiration. The custom domain offers better retrievability than the Public Object URL for Dev, but has not enough information encoded for smart clients (i.e. no way to know bucket name). For R2, we will likely need to add 2 location URIs: - Custom domain object URL (e.g. `https://<CUSTOM_DOMAIN>.web3.storage/<CID>/<CID>.car`) - can be used out of the box to fetch content - Presigned URL like URI without query params (e.g. `https://<ACCOUNT_ID>.r2.cloudflarestorage.com/<BUCKET_NAME>/<CID>/<CID>`) - won't really work, but smart clients can see if it is available and rely on its encoded info to use CF Worker Bindings / create presigned URLs, etc. Alternatively, we can require `<CUSTOM_DOMAIN>` to become bucket name, in order to make it work as a single location URI. Main disadvantage besides the extra requirement, is that there is no url mention of being a R2 bucket, which would mean hard coded assumptions. We could also consider to mimic S3 URL for R2 here as well. The Public Object URL for Dev should not be adopted, as it is heavily rate limited, we do not know what CF may do with it in the future, and also does not even have information about the Bucket name. ## Client location claims proposal Nothing prevents us from claiming multiple location URIs for a given content, however we may need to also be careful on having multiple claims for the same location as if it is not fully available it MAY be ranked badly in whatever reputation system we may create. However, some smart clients MAY benefit of cost savings or faster retrievals if they have extra information encoded in the URI. In conclusion, this document proposes that w3up clients, once they successfully perform an upload, they create location claims within following formats: - S3 - `https://<BUCKET_NAME>.s3.<AWS_REGION>.amazonaws.com/<CID>/<CID>.car` - R2 - `https://<CUSTOM_DOMAIN>.web3.storage/<CID>/<CID>.car` - `https://<ACCOUNT_ID>.r2.cloudflarestorage.com/<BUCKET_NAME>/<CID>/<CID>` Note that it is not in scope of this document to define how a client will get to know the locations to claim. This has also its own challenges, like should we want to infer it from presigned URL? should we return on `store/add` receipt the locations where it will be written to?

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully