Gathering detailed insights and metrics for @zerochain/sdk
Gathering detailed insights and metrics for @zerochain/sdk
npm install @zerochain/sdk
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last day
0%
5
Compared to previous day
Last week
0%
84
Compared to previous week
Last month
0%
84
Compared to previous month
Last year
0%
84
Compared to previous year
1
2
3
The Züs SDK is a JavaScript client library that provides a convenient interface for interacting with the Züs Network. It allows developers to perform various operations such as creating and managing allocations, uploading and downloading files, executing smart contracts, and more.
Züs is a high-performance cloud on a fast blockchain offering privacy and configurable uptime. It is an alternative to traditional cloud S3 and has shown better performance on a test network due to its parallel data architecture. The technology uses erasure code to distribute the data between data and parity servers. Züs storage is configurable to provide flexibility for IT managers to design for desired security and uptime, and can design a hybrid or a multi-cloud architecture with a few clicks using Blimp's workflow, and can change redundancy and providers on the fly.
For instance, the user can start with 10 data and 5 parity providers and select where they are located globally, and later decide to add a provider on-the-fly to increase resilience, performance, or switch to a lower cost provider.
Users can also add their own servers to the network to operate in a hybrid cloud architecture. Such flexibility allows the user to improve their regulatory, content distribution, and security requirements with a true multi-cloud architecture. Users can also construct a private cloud with all of their own servers rented across the globe to have a better content distribution, highly available network, higher performance, and lower cost.
The QoS protocol is time-based where the blockchain challenges a provider on a file that the provider must respond within a certain time based on its size to pass. This forces the provider to have a good server and data center performance to earn rewards and income.
The privacy protocol from Züs is unique where a user can easily share their encrypted data with their business partners, friends, and family through a proxy key sharing protocol, where the key is given to the providers, and they re-encrypt the data using the proxy key so that only the recipient can decrypt it with their private key.
Züs has ecosystem apps to encourage traditional storage consumption such as Blimp, a S3 server and cloud migration platform, and Vult, a personal cloud app to store encrypted data and share privately with friends and family, and Chalk, a zero upfront cost permanent storage solution for NFT artists.
Other apps are Bolt, a wallet that is very secure with air-gapped 2FA split-key protocol to prevent hacks from compromising your digital assets, and it enables you to stake and earn from the storage providers; Atlus, a blockchain explorer and Chimney, which allows anyone to join the network and earn using their server or by just renting one, with no prior knowledge required.
This sections aims at getting you started with the Züs SDK.
sudo apt update
sudo apt install curl
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt install yarn -y
In Mac Yarn can be installed using the Homebrew package manager. To install Yarn on macOS, open a terminal and type:
brew install yarn
Note: Make sure that Homebrew is installed properly using the command below
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Download yarn windows based msi installer from here
Add the zus-sdk package for use in your project
yarn add @zerochain/zus-sdk
Zus JS-sdk provides many functions for implementing blobber, allocation and file operation functionalities in web applications.
For a detailed understanding of the functions provided by the JS SDK, please refer to the JS Doc comments in the index.ts file
Most of the exposed SDK functions are well-documented with JS Doc comments, detailing their usage, parameter types, and return types.
To use the Züs SDK in your project, import the necessary functions and utilities:
1import { init, createWasm, getBalance, sendTransaction } from "@zerochain/zus-sdk";
Before using the Züs SDK, you need to initialize the WebAssembly module by calling the init function:
1const config = { 2 // configuration options 3}; 4 5await init(config); 6const wasm = await createWasm();
The init
function initializes the Züs SDK with the provided configuration, and createWasm
returns the WebAssembly instance.
To get the balance of a client, use the getBalance
function:
1const clientId = "client_id"; 2const balance = await getBalance(clientId); 3 4console.log(balance);
The getBalance
function retrieves the balance of the specified client from the Züs Network.
To send a transaction from one client to another, use the sendTransaction
function:
1const fromClient = "sender_client_id"; 2const toClient = "recipient_client_id"; 3const value = 10; // transaction value 4const note = "Transaction note"; 5 6const response = await sendTransaction(fromClient, toClient, value, note); 7 8console.log(response);
The sendTransaction
function sends a transaction from the specified sender client to the recipient client with the specified value and note.
The Züs SDK also provides some utility functions that may be helpful during development:
createWallet()
: Generates a new wallet with a random mnemonic and returns the wallet information.recoverWallet(mnemonic: string)
: Recovers a wallet using a given mnemonic and returns the wallet information.decodeAuthTicket(authTicket: string)
: Decodes an authentication ticket and returns the decoded object.truncateAddress(addressString: string, start: number, flag: boolean, end: number): string
: Truncates an address string for display purposes.hexStringToByte(str: string): Uint8Array
: Converts a hexadecimal string to a Uint8Array.These utility functions can be imported and used as needed in your application.
With the provided functions and utilities, developers can easily interact with the ZeroChain network, perform transactions, retrieve balances, and utilize various utility functions.
We'd love to accept your patches and contributions to this project. There are just a few guidelines you need to follow.
This project follows Contributor Covenant as it's Code of Conduct, and we expect all project participants to adhere to it. Please read the full guide so that you can understand what actions will not be tolerated.
Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to project.
The SDK is released under the MIT License.
No vulnerabilities found.
No security vulnerabilities found.