Coder Social home page Coder Social logo

cip14-js's Introduction

CIP14-JS

On the Cardano blockchain, native assets are uniquely identified by both their policy id and asset name. Neither the policy id nor the asset name are intended to be human-readable data. CIP14 introduces an asset fingerprint which is a short(er) and human-readable identifier for assets that user can recognize and refer to when talking about assets.

More specifically, CIP14 defines a user-facing asset fingerprint as a bech32-encoded blake2b-160 digest of the concatenation of the policy id and the asset name.

This package is a Typescript implementation of CIP14

Install

npm i @emurgo/cip14-js --save

Usage

const AssetFingerprint = require('@emurgo/cip14-js');

// initialize class with policyId, assetName
const assetFingerprint = AssetFingerprint.fromParts(
  Buffer.from('1e349c9bdea19fd6c147626a5260bc44b71635f398b67c59881df209', 'hex'),
  Buffer.from('504154415445', 'hex'),
);

const fingerprintHash = assetFingerprint.hash();
const bech32Fingerprint = assetFingerprint.fingerprint();
// initialize class with bech32
const assetFingerprint = AssetFingerprint.fromBech32('asset1rjklcrnsdzqp65wjgrg55sy9723kw09mlgvlc3');

const fingerprintHash = assetFingerprint.hash();
const prefix = assetFingerprint.prefix();

cip14-js's People

Contributors

ashisherc avatar sebastiengllmt avatar vsubhuman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cip14-js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.