Introducing Bucket CIDs: Instantly Generate IPFS Folders

Introducing Bucket CIDs: Instantly Generate IPFS Folders
Filebase graphic with a black background, featuring the Filebase logo and text 'Introducing Bucket CIDs: Instantly Generate IPFS Folders.

Today we are excited to announce a revolutionary new feature at Filebase: the ability to generate Bucket CIDs. This new functionality allows a user to instantly create an IPFS folder that matches the structure and layout of their Filebase bucket. This process is done effortlessly, revolutionizing how you interact with IPFS and manage your data on Filebase.

Simplifying File Management on IPFS

Struggling to upload a large IPFS folder with thousands of files? Have no fear! With Bucket CIDs, you can upload each file one at a time. After you’ve uploaded all of the necessary files into a bucket, you can generate an IPFS folder CID that contains all of the files and matches the structure of your Filebase storage bucket. CID generation is instant thanks to a set of new services that we created to support this use case.

Addressing Pain Points

Managing folders on IPFS has traditionally been very challenging. Many providers require users to upload all files simultaneously, leading to reliability issues and inefficiency. Even minor changes often require a complete re-upload of all files. At Filebase, we are committed to improving the user experience by simplifying and streamlining this process. Our new Bucket CID feature addresses these pain points, offering a flexible and efficient solution.

How Bucket CIDs Work

Bucket CIDs enable users to create an IPFS folder with multiple files, uploaded one at a time, while maintaining the structure and layout of their Filebase bucket. Here’s how it works:

Upload Files Individually: Users can upload files one at a time into a Filebase bucket. There's no need to batch-upload all files simultaneously.

Generate Bucket CID: Once all desired files are uploaded, users can select the Generate CID option. This action instantly generates an IPFS folder CID that mirrors the file structure and layout of the Filebase bucket.

Easily Modify Files: If you need to change or remove files, simply delete the unwanted files from the bucket and select "Generate Bucket CID" again. A new folder CID is created instantly, without the need to re-upload the remaining files.

Using Bucket CIDs in the Dashboard

Our user-friendly dashboard makes it easy to take advantage of the Bucket CID feature. Here’s a step-by-step guide:

  1. Access Your Bucket: Log in to your Filebase account and navigate to the bucket where you want to generate a Bucket CID.
  2. Upload Files: Drag and drop files or use the upload button to add files to your bucket one at a time.
  3. Generate Bucket CID: Once all files are uploaded, visit the Buckets page and select the Generate CID option in the bucket’s context menu. This will generate a new IPFS folder CID that mirrors your bucket’s structure.
  4. Modify Files as Needed: To change the folder contents, delete the files you no longer need and click Generate CID again to obtain an updated folder CID.

Using Bucket CIDs via the S3 API

For users who prefer to interact programmatically, the Bucket CID feature can be accessed using the Filebase S3-compatible API. Here’s how:

  1. Upload Files: Use standard S3 PutObject requests to upload files to your Filebase bucket.
  2. Generate Folder CID: Make an S3 PutBucketTagging request with a TagSet key of generateBucketCid and a value of true. This will trigger the generation of a new IPFS folder CID.

If using the AWS CLI, an example request would look like this:

aws --endpoint http://s3.filebase.com s3api put-bucket-tagging --bucket your-bucket-name --tagging 'TagSet=[{Key=generateBucketCid,Value=true}]'

If using Node.js AWS SDK v3:

const { S3Client, PutBucketTaggingCommand } = require("@aws-sdk/client-s3");

const client = new S3Client({
  region: 'us-east-1',
  endpoint: 'https://s3.filebase.com',
  signatureVersion: 'v4'
});

const params = {
  Bucket: "your-bucket-name",
  Tagging: {
    TagSet: [
      {
        Key: "generateBucketCid",
        Value: "true"
      }
    ]
  }
};

const command = new PutBucketTaggingCommand(params);

command.middlewareStack.add(
  (next) => async (args) => {
    const response = await next(args);

    // Get cid from headers
    const cid = response.response.headers["x-amz-meta-cid"];
    console.log(cid);
    return response;
  }
);

const res = client.send(command);

Modify Files: To update the folder, delete the necessary files using S3 DeleteObject requests and repeat the PutBucketTagging request to generate a new folder CID.

Why Filebase's Bucket CID Feature is Superior

Filebase’s Bucket CID feature offers several advantages over other IPFS pinning services:

  • Incremental Uploads: Upload files one at a time instead of all at once, reducing the risk of failures and making the process more manageable.
  • Instant Folder CID Generation: Generate a new folder CID instantly without re-uploading all files, saving time and bandwidth.
  • Effortless File Management: Modify folder contents easily without the need to start from scratch, making updates quick and hassle-free.

Technical details

This new feature requires a paid account and is designed to work with UnixFS files that have been uploaded to Filebase within the last 3 months. Files older than that may not work just yet, but eventually all UnixFS files on the platform will be supported. New folders are currently limited to 25,000 files during the introduction period.

Conclusion

With the introduction of Bucket CIDs, Filebase continues to lead the way in providing user-friendly, reliable, and efficient solutions for IPFS file management. We are excited to see how this feature will enhance your workflows and make IPFS more accessible than ever.

As always, feel free to reach out to our support team if you have any questions or need assistance. Happy pinning!