Skip to content
TopperDEL edited this page Jan 20, 2022 · 19 revisions

Introduction

This wiki should help you get started with Storj DCS (Decentralized Cloud Storage) and the uplink.NET-library.

Storj DCS is described here. Basically it is a decentralised, secure, fast, S3-compatible cloud-base object store. That means you can upload "objects" (binary data of any form) to the cloud, list it and of course download it again. There are many ways to connect to the cloud and the objects you've placed there. uplink.Net is a direct way - meaning: there is no intermediate like a gateway between your application and the cloud storage. Your application written in C#/.Net communicates directly with the decentralised so called nodes and the satellites managing the metadata. All traffic leaving your app is encrypted with a key you choose and cannot be read by anyone else (except you give permission, see "Sharing access"). Not even Storj and its employees can see your data!

The uplink.NET-library can be included in any .Net-application running on all major platforms and architectures. It works on Windows, Linux, MacOs, iOs, Android and even the ARM64-based Hololens 2. On Windows it supports x86 and x64.

It is already heavily used in the backup-application Duplicati, that also supports Windows, Linux and MacOs. Furthermore it is used to be the main backend for some Open- and Closed-Source cross-platform Uno-applications and will soon make it's debut on Hololens using the awesome StereoKit-framework.

Want to know how to benefit from uplink.NET on your own? Let's digg into!

Preparation

Let's setup the basics:

  1. Install the uplink.NET-Nuget into your project. It contains the C#-objects to interact with the library.
  2. Install the platform-specific nugets - those add the specific binaries to your application:
  3. Do some initialization:
    • on iOs call the following method before your first interaction with the library: uplink.NET.Models.Access.Init_iOs(Foundation.NSBundle.MainBundle.BundlePath);
    • on all platforms (optionally): setup a temp-directory to use, e.g.: uplink.NET.Models.Access.SetTempDirectory(System.IO.Path.GetTempPath());

Now you are ready to use uplink.NET!

Quickstart

If you know about Storj DCS and only need some code to quickstart, take this:

//Get an access-object from your access-grant
var access = new Access("YOUR_ACCESS_GRANT");

//Get a bucket-service instance
var bucketService = new BucketService(access);

//Create a new bucket called "mybucket"
await bucketService.CreateBucketAsync("mybucket");

//List all available buckets
ListBucketsOptions listOptions = new ListBucketsOptions();
var buckets = await bucketService.ListBucketsAsync(listOptions);
foreach (var bucket in buckets.Items)
{
     //work with the bucket
}

//Get the bucket "mybucket"
var bucket = await bucketService.GetBucketAsync("mybucket");

//Upload a simple text-file
var objectService = new ObjectService(access);
byte[] bytesToUpload = Encoding.UTF8.GetBytes("Storj is awesome!");
var uploadOperation = await objectService.UploadObjectAsync(bucket, "awesome.txt", new UploadOptions(), bytesToUpload, false);
await uploadOperation.StartUploadAsync();

//List all available objects
var objects = await objectService.ListObjectsAsync(bucket, new ListObjectsOptions());
foreach (var obj in objects.Items)
{
     //work with the object
}

//Download one object
var downloadOperation = objectService.DownloadObjectAsync(bucket, "awesome.txt", new DownloadOptions(), false);
downloadOperation.DownloadOperationProgressChanged += //optional: add event handler
await downloadOperation.StartDownloadAsync();
var downloadedContent = Encoding.UTF8.GetString(downloadOperation.DownloadedBytes); //=> "Storj is awesome!"

Further information

Find more detailled instructions in the "Documentation"-section on the right.

Clone this wiki locally