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

juicechain

v2.1.6

Published

SDK for JuicEchain Blockchain Network

Downloads

105

Readme

JuicEchain Node (SDK)

JuicEchain The management of digital assets will be an essential part of new business models and close connected to their success. Our JuicEchain solution is the tool to enable and guarantee exactly that. It’s the easiest available access to blockchain technology without worrying about technical and infrastructure (node-network) requirements, accessible as any other cloud service. Learn more here.

TypeScript SDK for managing a Node in the JuicEchain Blockchain Network. It allows users to create and control Wallets, issue digital Assets and Non-fungible assets (NFA's).

Prerequisite

  • Node The Node name you like to connect
  • Username Username of your API user
  • ApiKey API key of your user

Access to functions of the JuicEchain API is based on Authorization and Authentication

Authorization

Authorization is general API access based on the API-Key and the header flag authorization. Authorization is required for all API requests. If the flag is missing, or your user invalid / deactivated, access is denied.

Authentication

Authentication is an additional header parameter authentication, identifying the wallet the request is based on. This is realized by a so called "BitCoin Message", which is signed with the wallet owners private key. Authentication can be generated by calling "getAuthentication()" method on a wallet reference, but the SDK has all these functions build-in so and is taking care of it. Authentication tokens, are short-lived tokens, so we can ensure they are only used by you!

Most Blockchains transactions are signed with the private-key of the sender, to confirm the ownership of the wallet.

Good to Know

Wallet

Wallet is a unique address in JuicEchain which allows its owner to manage and collect digital Assets. It is based on asymmetric encryption with public (wallet address) and private keys (made for securing and signing every transaction).

Digital Asset

Digital Asset is a unique digital representation of Tickets, Vouchers, Coupons, Contracts or Identities in JuicEchain network. Users can issue digital assets in amount they need with all necessary parameters and transfer them unlimited number of times. Every digital Asset has these properties:

  • Name - unique name in whole network (only 1 digital Asset can be defined with specific name)
  • Amount - total issued amount
  • Title - name of digital Asset displayed in all apps using JuicEchain
  • Description - long specific description
  • Inception date - time from which digital asset is valid
  • Expiration date - time until digital asset is valid
  • Media - upload picture or video representing digital Asset
  • Options - additional options like allowing transfer, transferring only inside home Node or returning digital Asset to owner

Digital Asset Classifications

There are 3 different classifications of digital Assets

  1. Multi Asset (Fungible Asset)

    • Multi Assets are the default classification and are specified by the initial amount issued. Each multi asset has the same properties and can't be distinguish between each other.
  2. Master Asset

    • Master Assets are the template for Non-fungible (NFT) assets or child assets. All properties specified on the master asset are mirrored to each child, if not overwritten by the child.
    • Only the owner of the Master asset is allowed to issue NFT's of this class.
    • The quantity of master assets is limited to one only, but declares the amount of child assets allowed to be issued.
  3. Asset (NFA - Non Fungible Asset)

    • None fungible asset are a copy of its master, but can overwrite or contain additional / different properties.
    • E.g. Ticket which has a unique seat allocation in a Theatre, Stadium, Bus or even Hotel room door key.

Digital Asset Types

JuicEchain defines 5 general types of digital Assets, which can be applied to the respective use-case.

| Type | Description | | ------------- |:-------------| | admission | Ticket, Entry pass | | voucher | Redeemable transaction type which is worth a certain monetary value | | coupon | Redeemed for a financial discount | | contract | Agreement between multiple parties | | identity | Piece of identification or ID |

Asset Name

Asset names are unique in the whole network and limited to 32 character including the nodes prefix. Default separation character is : and only required once after the nodes name:

Example asset name, issued on the node "Demo"

demo:exampleassetname

A special case are Master and Child assets. Master assets need to end with # Hashtag.

// Master Asset Name
demo:examplemaster#

// Child assets can occupy all left character space after the hashtag
demo:examplemaster#1

Regex for Asset name /^[a-z0-9#]+([\:]{1}[a-z0-9#]+)*$/g;

Blocktime

JuicEchain has an internal block-time of 10 seconds. After a successful transfer, the asset should appear in the receivers wallet, latest after 10 seconds! However, its possible with the parameter "minconf" to get instant results even of transaction which are yet not minded e.g confirmed by any node.

Coding Examples

Connect to Node

Create a new Node reference by calling "getNode()" from JuicEchain.

const demo:Node = JuicEchain.getNode("demo", *Username*, *API Key*);

Create your first Wallet

Wallets are connected to their origin Node. You can call "createWallet()" method on the Node reference to receive a new wallet. The wallet is connected to your API user. You can perform transfers on your own wallets without need for a signature.

const wallet:Wallet = await demo.createWallet();

Issue your first Asset

Assets are connected to their "issuing" wallet. Means the newly created assets are placed into (address / wallet). They can be from there transferred anywhere further .

 const name:string  = "demo:myasset";
 const title:string = "My First Asset";
 const amount:number = 100;
 const type:string = AssetType.ADMISSION;
 const publisher:string = "BackToTheFuture GmbH";

 const asset:Asset = await demo.issue(name, title, type, amount, wallet.address, publisher);

Transfer asset

Call `wallet.transfer()" to transfer the given asset with amount to the receivers address.

const successTransfer:boolean = await wallet.transfer(*some-wallet-address*, "demo:myasset", 2, "");

Fetch wallet balance

The balance (overview of assets owned and amount) can be fetched directly from the Wallet reference.

const balance:Array<Balance> = await wallet.getBalance();

Possible result as JSON

[{
  "asset": "demo:myasset",
  "quantity": 2
}]