⏱️Quickstart

Learn how to get started with the DDC using the SDK Client library.

In order to complete this guide using the DDC Client libraryarrow-up-right, you should have an account in Cere blockchain that has enough CERE tokens (amount depends on your needs) and the secret phrase (mnemonic) of that account (required to configure the client).

Use the πŸ”— Setup guide to create and top-up an account.

Installation

Latest version of SDK can be found on releasesarrow-up-right page.

Using NPM:

npm install @cere-ddc-sdk/ddc-client --save

Using yarn:

yarn add @cere-ddc-sdk/ddc-client

Usage

A quick guide of how to upload a file to DDC Testnet using the DdcClient API.

Create a DdcClient instance

To initialize the client we will use the account (wallet) created in Setup guide

import { DdcClient, TESTNET } from '@cere-ddc-sdk/ddc-client';

const seedPhrase = 'gospel fee escape timber toilet crouch artist catalog salt icon bulb ivory';
const ddcClient = await DdcClient.create(seedPhrase, TESTNET);
circle-info

The account used to create the instance should have positive balance and DDC deposit

Create a bucket

Private bucket (by default)

or a public one

circle-info

Creating a bucket results in a transaction on the Cere blockchain, and thus a portion of your wallet balance will be used to pay the associated fees.

Upload a file

To optimize memory consumption, we will read the file from the file system using NodeJS readable stream.

circle-check

Share the file

DDC offers Web API access to files, allowing them to be shared via URLs.

If the file's bucket is private

or public

It is also possible to download the file by its CID using the SDK Client

To optimize memory consumption, we will store the file to the file system using NodeJS writable stream.


For more information about what this package provides, see API referencearrow-up-right

Last updated

Was this helpful?