JavaScript functions and classes for CodeChain primitives
# npm
npm install codechain-primitives
# yarn
yarn add codechain-primitives
// Using require
var primitives = require("codechain-primitives");
var H256 = primitives.H256;
var blake256 = primitives.blake256;
// Using import
import { blake256, H256 } from "codechain-primitives";
Coming soon
buffer or hexadecimal string
16 byte hexadecimal string
Gets data's 128 bit blake hash by using the key.
buffer or hexadecimal string
16 byte hexadecimal string
Gets data's 160 bit blake hash.
buffer or hexadecimal string
20 byte hexadecimal string
Gets data's 160 bit blake hash by using the key.
buffer or hexadecimal string
20 byte hexadecimal string
Gets data's 256 bit blake hash.
buffer or hexadecimal string
32 byte hexadecimal string
Gets data's 256 bit blake hash by using the key.
buffer or hexadecimal string
32 byte hexadecimal string
Generates a private key.
32 byte hexadecimal string of private key
Gets account id from private key.
32 byte hexadecimal string of private key
20 byte hexadecimal string of account id
Gets account id from the given public key.
64 byte hexadecimal string of uncompressed public key
20 byte hexadecimal string of account id
Gets public key from private key.
32 byte hexadecimal string of private key
64 byte hexadecimal string of public key
Gets public key from the message and ECDSA signature.
32 byte hexademical string
65 byte hexadecimal string of ECDSA signature
64 byte hexadecimal string public key
(Experimental) Gets public key from the message and Schnorr signature.
32 byte hexademical string
r, s of Schnorr signature
64 byte hexadecimal string public key
Gets data's 160 bit RIPEMD hash.
buffer or hexadecimal string
20 byte hexadecimal string
Gets ECDSA signature for message from private key.
32 byte hexademical string
32 byte hexadecimal string of private key
65 byte hexadecimal string of ECDSA signature
(Experimental) Gets Schnorr signature for message from private key.
32 byte hexademical string
32 byte hexadecimal string of private key
r, s of Schnorr signature
Converts buffer to hexadecimal string.
arbritrary length of data
hexadecimal string
Converts BigNumber to formatted number string Default decimalSeparator is point: "." Default groupSeparator is comma; "," Default groupSize is 3
BigNumber object
formatted number string
Checks if the signature from signEcdsa is correct.
32 byte hexademical string
65 byte hexadecimal string of ECDSA signature
64 byte hexadecimal string of public key
if signature is valid, true. Else false.
(Experimental) Checks if the signature from signSchnorr is correct.
32 byte hexademical string
r, s of Schnorr signature
64 byte hexadecimal string of public key
if signature is valid, true. Else false.
Generated using TypeDoc
Gets data's 128 bit blake hash.