Skip to main content

Storage SDK Quick Start

In this guide, you will learn how you can enable file data storage and access functionality for dApp users in a secure and privacy protecting manner using the Arcana Auth SDK.

Overview

Developers can configure dApps using Arcana dashboard and integrate with Arcana Storage SDK. The global region where application data is stored is configured by the developer but user's have full control over their data and access. Users decide with whom and for how long they share their data. They can revoke access or transfer data ownership to another user. All data residing in Arcana Store is powered by blockchain transactions for every storage access operation. This makes user data fully secure and private.

Each file in Arcana Store is associated with a unique identifier (DID). Developers can access files by specifying the DID. They can also monitor storage usage metrics.

note

In the beta release, all the storage nodes that make up Arcana Store are operated by Arcana. In future, the storage subsystem will be fully decentralized and third party storage nodes can be plugged into Arcana storage subsystem, once they meet the Arcana storage QoS criteria.

Setup Storage SDK

Install with npm

npm i @arcana/storage

Install with yarn

yarn add @arcana/storage

You can use the standalone module which includes the polyfills.

<script src="./dist/standalone/storage.umd.js"></script>
import { StorageProvider } from '@arcana/storage/dist/standalone/storage.umd';

Using Storage SDK

To use the Arcana Storage SDK, and access storage functions in your dApp, you need to configure how your dApp would use the SDK and then initialize it with specific inputs.

At a high level, you need to follow these three steps .

Step 1. Register & Configure dApp

First, you need to configure your dApp and obtain a unique appID through the Arcana Developer Dashboard:

https://dashboard.beta.arcana.network

Step 2: Obtain Ethereum Provider

Before dApps can initiate any storage operations, they need to integrate and initialize the Storage SDK. Storage SDK requires an Ethereum provider at the time of initialization.

To obtain an Ethereum provider it is recommended that developers integrate dApp with Arcana Auth SDK. After initialization of the Auth SDK, developers can get access to the standard Ethereum provider.

Alternatively, this Ethereum provider can also be obtained through any third-party wallet also, instead of Arcana Auth SDK. Besides third party wallets, developers can also choose to BYOK option and manage user keys for signing Arcana blockchain transactions or ask users to generate and manage their own keys.

caution

If you are using a third party wallet, then you cannot manage user experience for signing Arcana blockchain transactions, unlike with the Arcana Auth SDK.

For every storage access operation, the third party wallet UI will pop up and user will have to approve or reject the transaction. With Arcana Auth SDK, developers can configure this wallet UI experience and choose no UI to automatically approve all storage transactions initiated by the authenticated user.

In case of BYOK as well, developers will need to do the extra work for managing user keys or signing experience. It is highly recommended that you use Arcana Auth SDK and integrate with Arcana Storage SDK.

Step 3: Initialize Storage SDK

After obtaining the Ethereum provider, using Auth SDK or alternative options, before dApps can utilize the user data storage and access features, developers need to integrate the dApp with Arcana Storage SDK and initialize it.

Initialization of Storage SDK requires Ethereum provider and the appID assigned to the dApp in the first step. After initialization, developers can use the StorageProvider interface for file upload, download, list files uploaded by a dApp user, files shared with the user and get the storage usage metrics per dApp user.

At the time of file upload, a unique identifier called DID is assigned to each file. This identifier is required for downloading the file. To perform other storage functions such as sharing file data, revoking file access, changing file owner and to delete a file, developers need to also obtain storage Access interface. All data operations supported by this interface are powered by Arcana blockchain transactions and require data owner's approval.

Storage SDK Usage Examples

Now that you understand how to use Storage SDK to enable data privacy for dApp user data, you can refer to these specific examples. They contain step by step instructions on how you can enable file data storage and access functions for dApp users:

tip

Check out code samples and tutorial to integrate your dApp with Arcana Network SDKs and enable social, passwordless authentication in a dApp and store, access dApp user data in a secure and privacy preserving manner.

See also