npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

osb-cli-sdk

v0.0.12

Published

OASISBloc Client SDK connecting blockchain, IDFS network to share data

Downloads

4

Readme

npm package of OASISBloc client sdk for js

OASISBloc supports JavaScript SDK for 3rd party or user services development. You can integrate OASISBloc JavaScript SDK into your project and utilize OASISBloc Data Trade protocol’s functionality. This document provides you with an information of installation and API specification.

Installation

Usage in Node.js

Install osb-cli-sdk module using npm.

npm install --save osb-cli-sdk

Import osb-cli-sdk module.

import OASIS_CLI from 'osb-cli-sdk'

API Specification

OASIS_CLI is a root class of osb-cli-sdk, which provides APIs to communicate with OASISBloc blockchain nodes and IDFS nodes. The details of the APIs are as below:

Constructor

Creating an instance of oasisbloc client

const config = {
    chainAccessPoint: [BLOCKCHAIN_API_NODE_ENDPOINT],
    chainId: [BLOCKCHAIN_ID],
    dataTradeContractName: [DATA_TRADE_CONTRACT_NAME],
    privateKey: [PRIVATE_KEY_OF_USER],
    account: [ACCOUNT_NAME_OF_USER]
}
const osbClient = new OASIS_CLI(config)

Parameters

| Parameter | Type | Description | | --------- | ---- | ----------- | | config.chainAccessPoint | string | Blockchain API node endpoint (ex: 'http://18.141.2.126:1387') | | config.chainId | string | Blockchain id (ex: '2cfbbc1ce6f7c4a48cfbb6de6ad00c55ea21401fbcf983a6f553fb4d8923d695') | | config.dataTradeContractName | string | Data trade contract name (ex: 'datatrade13') | | config.privateKey | string | User's private key | | config.account | string | User's account name |

setAuthForContract

데이터 거래를 통해 자산 이동 발생에 대한 동의

osbClient.setAuthForContract()

registerData

Registering a data to oasisbloc with encryption and fragmentation of data, and uploading data to data keeper's IDFS nodes

osbClient.registerData(data, datatypename, detailFields, price, period, decryptKeyList)

Parameters

| Parameter | Type | Description | | --------- | ---- | ----------- | | data | Buffer | Data buffer to register | | datatypename | string | Datatype name | | detailFields | string array | Values for each metadata field of the datatype | | price | string | Data price (OSB) | | period | integer | Data provide period (days) | | decryptKeyList | string array | Private key list for encrypting each data fragment. The number of data fragments is set from the length of this list |

Return values

| Return value | Type | Description | | ------------ | ---- | ----------- | | txResultAddDataBegin | object | Transaction result data of adddatabegin action | | txResultAddDataEnd | object | Transaction result data of adddataend action | | dataRegistrationInfo | object | Data registration information |

buyData

Getting a data access authority

osbClient.buyData(dataid, buyerPrivateKey)

Parameters

| Parameter | Type | Description | | --------- | ---- | ----------- | | dataid | integer | Data registration id | | buyerPrivateKey | string | Buyer private key for authentication of data access. It is not the private key of the user account |

Return values

| Return value | Type | Description | | ------------ | ---- | ----------- | | txResultBuyData | object | Transaction result data of buydata action | | dataBuyHistoryInfo | object | Data buy information |

requestData

Downloading encrypted data fragments

osbClient.requestData(dataid, buyid, buyerPrivateKey)

Parameters

| Parameter | Type | Description | | --------- | ---- | ----------- | | dataid | integer | Data registration id | | buyid | integer | Data purchase id | | buyerPrivateKey | string | Buyer private key for authentication of data access. It is not the private key of the user account |

Return values

| Return value | Type | Description | | ------------ | ---- | ----------- | | data | Buffer | The purchased data |