Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 2.98 KB

README.md

File metadata and controls

93 lines (70 loc) · 2.98 KB

PyPI version

Swan MultiChain Storage Samples

This directory contains samples for Swan MultiChain Storage System. Swan MultiChain Storage is the Web3 cloud computing solution for storage bucket creation, deployment and management. User can create and manage buckets through samples under this directory. For more information checkout Swan MCS Developer Docs.

Setup

Authentication (API Key)

To use the swan-sdk Multi-Chain Storage (MCS) service, an MCS API key is required. To get an MCS API Key: visit MultiChain Storage.

This sample (and Swan SDK) requires you to have API Key from MCS.

Steps to get a MCS API Key:

  • Go to Multi Chain Storage. Make sure you're under the Mainnet environment.
  • Login through MetaMask.
  • Click the gear icon on the top right and select 'Setting'.
  • Click 'Create API Key'
  • Store your API Key safely, do not share with others.

Install Dependencies

  1. Clone the python-sdk-docs-samples.
$ git clone https://github.com/swanchain/python-sdk-docs-samples.git
  1. Install and updgrade pip and virtualenv if you do not already have them.
  2. Create virtualenv compatible with Python 3.7+
$ python3 -m venv venv
$ source venv/bin/activate
  1. Install the dependencies from the requirements file
$ pip install -r requirements.txt

Store API Key in .env

  1. Create a new .env file
  2. Store your MCS API key in .env file:
MCS_API_KEY = <your_storage_api_key>

Run Samples

Create and Delete a Bucket

Create and delete a bucket.

$ python storage/create_delete_bucket.py

Get Bucket information

Retrieve information for a single bucket but also for all buckets.

$ python storage/info_bucket.py

Create and Upload Folders to a Bucket

Detailed breakdown of how to create folders and upload MCS and IPFS folders.

$ python storage/folders_bucket.py

Upload, Download, and Delete a file in a Bucket

Detailed breakdown of how to upload, download, and delete a file in a Bucket.

$ python storage/file_bucket.py

Get info of files in a Bucket

Retrieve information on a particular file or all files in a Bucket.

$ python storage/file_info_bucket.py