Your App + Spheron Storage SDK: Unleash the Power of Multi-Chain Storage! โšก

Your App + Spheron Storage SDK: Unleash the Power of Multi-Chain Storage! โšก

ยท

5 min read

Recently, I came across something truly remarkable that ignited my curiosity and fueled my soul (Tech Rizz ๐Ÿ˜Ž) - Spheron. This incredible technology captivated me with its immense potential, prompting me to go dive deeper and explore its capabilities. To say that I was blown away would be an understatement for this amazing tech! Spheron is not your ordinary storage SDK; it's a game-changer that brings a basket of features and functionalities to the table, allowing you to supercharge your app or dApp like never before.

So, Are you looking to take your app or Dapp (decentralized app) to the next level with robust and flexible storage capabilities? Look no further! In this blog, we'll explore the amazing Spheron Storage SDK and discover how it can revolutionize your development process. From uploading files to leveraging multiple protocols, Spheron has got you covered. So buckle up and let's dive into the exciting world of multi-chain storage!

Embark on an Adventure: Get to Know the SpheronClient. ๐Ÿง 

To embark on our Spheron adventure, we need to get acquainted with our trusty companion: the SpheronClient. This SDK powerhouse allows us to perform various storage operations seamlessly. Whether it's uploading files, managing buckets, or working with IPNS, the SpheronClient is our go-to tool.

Uploading Magic: Unleash Your Files! ๐Ÿ•Š

Let's start with the most exciting part: uploading files. Picture this scenario: you have an image or a directory of files that you want to upload to the storage protocol of your choice. With Spheron, it's as easy as a few lines of code. Here's a snippet to get you started:

import { SpheronClient, ProtocolEnum } from "@spheron/storage";

const client = new SpheronClient({ token });
let currentlyUploaded = 0;
const { uploadId, bucketId, protocolLink, dynamicLinks, cid } =
  await client.upload(filePath, {
    protocol: ProtocolEnum.IPFS,
    name,
    onUploadInitiated: (uploadId) => {
      console.log(`Upload with id ${uploadId} started...`);
    },
    onChunkUploaded: (uploadedSize, totalSize) => {
      currentlyUploaded += uploadedSize;
      console.log(`Uploaded ${currentlyUploaded} of ${totalSize} Bytes.`);
    },
  });

Voila! You've successfully uploaded your file to the specified protocol. From IPFS to Arweave and Filecoin, Spheron supports a wide range of storage options to suit your needs.

Elevate Your Data: Exploring IPNS Publishing and Updating.๐Ÿ‘ฉโ€๐Ÿ’ป

Now, let's explore the incredible world of IPNS (InterPlanetary Name System) Ya even the name is so cool Isn't it? Imagine you want to publish your upload to IPNS, update it to another upload ID, or retrieve IPNS names for your organization. Spheron makes it a breeze! Here's an example to get you excited:

import { SpheronClient, ProtocolEnum } from "@spheron/storage";

const client = new SpheronClient({ token });
let currentlyUploaded = 0;
const { uploadId, bucketId, protocolLink, dynamicLinks, cid } =
  await client.upload(filePath, {
    protocol: ProtocolEnum.IPFS, // Only works with IPFS and Filecoin uploads
    name,
    onUploadInitiated: (uploadId) => {
      console.log(`Upload with id ${uploadId} started...`);
    },
    onChunkUploaded: (uploadedSize, totalSize) => {
      currentlyUploaded += uploadedSize;
      console.log(`Uploaded ${currentlyUploaded} of ${totalSize} Bytes.`);
    },
  });

// Publish Upload to IPNS
const ipnsData: IPNSName = await client.publishIPNS(uploadId);

// Upload second file to Spheron
const uploadIdTwo = await client.upload(filePath2, { ...uploadDetails });

// Update IPNS Name to point to another upload
const ipnsData: IPNSName = await client.updateIPNSName(
  ipnsData.id,
  uploadIdTwo
);

// Get all published IPNS Names for organization
const orgIPNSNames: IPNSName[] = await client.getIPNSNamesForOrganization(
  organizationId
);

IPNS opens up a whole new realm of possibilities for dynamic content addressing. You can easily publish, update, and retrieve IPNS names, giving your app a flexible and resilient storage solution.

Supercharge Your App with Bucket Superpowers.๐Ÿฆนโ€โ™€๏ธ

What's a storage solution without buckets? Its like Pizza without cheese. Spheron's got your back here too! Buckets provide a structured way to organize and manage your stored content. The SpheronClient offers a range of bucket-related methods to make your life easier. Here are some highlights:

  • Retrieve bucket information: getBucket(bucketId)

  • Manage bucket domains: getBucketDomains(bucketId), addBucketDomain(bucketId, { link, type, name }), updateBucketDomain(bucketId, domainIdentifier, { link, name }), verifyBucketDomain(bucketId, domainIdentifier)

Spheron Storage SDK: Developer's Best Friend.๐Ÿค

Apart from the exciting features we've explored, the Spheron Storage SDK offers an extensive range of functionalities that can enhance your app's storage capabilities. Here are a few more features to pique your interest:

  1. Multi-Protocol Support: Seamlessly leverage multiple storage protocols such as IPFS, Arweave, Filecoin, and more. The SDK abstracts the complexities, allowing you to focus on building a stellar app experience.

  2. Efficient Chunking and Parallelism: Spheron optimizes file uploads by splitting them into smaller chunks and leveraging parallel processing. This ensures faster uploads and efficient utilization of network resources.

  3. Reliable Error Handling: The SDK takes care of error handling and retries, ensuring a robust and resilient storage experience. You can rest easy knowing that your data is safe and secure.

  4. Extensive Documentation and Community Support: Spheron provides comprehensive documentation with code examples, guides, and references. Additionally, an active developer community is always ready to assist and share insights.

Congratulations! ๐Ÿš€

You've embarked on this amazing journey to supercharge your app or Dapp with the incredible Spheron Storage SDK. From effortless file uploads to the power of IPNS and the flexibility of buckets, Spheron provides a robust and user-friendly storage solution. So why wait? Explore the documentation, dive into the code, and Unleash the full potential of multi-chain storage in your application. Get ready to revolutionize the way your app interacts with decentralized storage!

You can Read more at: https://www.npmjs.com/package/@spheron/storage

Remember, Spheron is not just a storage SDK; it's your secret weapon for building storage-powered applications that will leave users amazed๐Ÿฑโ€๐Ÿ.

Happy coding Folkssโค !!

ย