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

zumcoin-utils

v1.2.1

Published

A Node.js collection of utilities useful for ZumCoin developers

Downloads

4

Readme

NPM

Master Build Status

Build Status

ZumCoin Javascript Utilities

Disclaimer

Use of this code in its current state may lead to unexpected results

This repository contains highly experimental code with the goal of making it possible to interact with a daemon including wallet functionaity (sending/receiving transactions) without the need for zum-service or wallet-api using Node.js. By using the code in this repo, you understand that some functions may not work, others may work but be untested, while others may upset you.

The best way to address such situations is to submit a Pull Request to resolve the issue you're running into.

Installation

npm i git+https://github.com/zumcoin/zumcoin-utils

Initialization

JavaScript

const ZumCoinUtils = require('zumcoin-utils').CryptoNote
const coinUtils = new ZumCoinUtils()

TypeScript

import { CryptoNote } from 'zumcoin-utils'
const coinUtils = new CryptoNote()

You can find TypeScript type definitions here

Public Methods

createNewSeed([entropy], [iterations])

Creates a new address seed using the provided entropy or if entropy is undefined, uses a randomly selected entropy source.

createNewAddress([entropy], [language], [addressPrefix])

Creates a new address using the provided entropy, language (for the mnemonic), and address prefix if supplied.

createAddressFromSeed(seed, [language], [addressPrefix])

Creates a new address using the provided seed, language (for the mnemonic), and address prefix if supplied.

createAddressFromMnemonic(mnemonic, [language], [addressPrefix])

Creates a new address using the provided mnemonic, language (for the mnemonic), and address prefix if supplied.

createAddressFromKeys(privateSpendKey, privateViewKey, [addressPrefix])

Creates a new address using the provided private spend key, private view key, and address prefix if supplied.

decodeAddressPrefix(address)

Decodes the address prefix from the specified CryptoNote public address.

decodeAddress(address, [addressPrefix])

Decodes the address into the public key pairs, prefix, payment ID, etc. Returns a decoded address object.

encodeRawAddress(rawAddress)

Encodes the rawAddress using CN-Base58 encoding.

encodeAddress(publicViewKey, publicSpendKey, [paymentId], [addressPrefix])

Encodes the publicViewKey, publicSpendKey, and payment ID into a standard CryptoNote address (or Integrated address if payment ID is supplied)

createIntegratedAddress(address, paymentId, [addressPrefix])

Creates an Integrated Address using the supplied address and payment ID.

privateKeyToPublicKey(privateKey)

Gets the corresponding private key from the given public key.

scanTransactionOutputs(transactionPublicKey, outputs, privateViewKey, publicSpendKey, [privateSpendKey])

Documentation In Progress

isOurTransactionOutput(transactionPublicKey, output, privateViewKey, publicSpendKey, [privateSpendKey])

Documentation In Progress

generateKeyImage(transactionPublicKey, privateViewKey, publicSpendKey, privateSpendKey, outputIndex)

Documentation In Progress

generateKeyImagePrimative(publicSpendKey, privateSpendKey, outputIndex, derivation)

The same as generateKeyImage, but allows you to reuse a derivation you have previously created, instead of re-deriving it. Returns [keyImage, privateEphemeral].

createTransaction(transfers, ourOutputs, randomOuts, mixin, feeAmount, [paymentId], [unlockTime])

Documentation In Progress

createTransactionAsync(transfers, ourOutputs, randomOuts, mixin, feeAmount, [paymentId], [unlockTime])

Functions as createTransaction, but runs asynchronously, and additionaly, supports user provided async functions. The regular code only supports synchronous provided funcs, so ensure any async user provided functions are not being used in other calls you make.

serializeTransaction(transaction)

Documentation In Progress

generateKeyDerivation(transactionPublicKey, privateViewKey)

Creates the key 'derivation' given a transaction public key, and the private view key. Can then be supplied to underivePublicKey, to determine if the transaction output belongs to you. Returns a string.

underivePublicKey(derivation, outputIndex, outputKey)

Given the output index in the transaction, and the outputs key, along with a derivation from generateKeyDerivation, this method will return a public spend key. If the public spend key matches your public spend key, the transaction output is yours. Returns a string.

Common Data Structures

Address

{ spend:
   { privateKey: '6768d7d4a3a8b07f8f5f102c2eeef2f060dfbcdb882d2e548ac030ab486e7f0a',
     publicKey: 'c8953c45c0e7f1b1253d6ff16a6f62c7bbb87389139abee07aa4627ca0219321' },

  view:
   { privateKey: '9619bc6482ad14fdba4a55e1a9da01f9535ceebda0ae71218b15cde14c0b870c',
     publicKey: '1ff2b174c8d0df2e26bc965e8c9424eb9564d5e65592b0e0ffcea9937518cb41' },

  address: 'Zum1ykEo4JYZGRx2f6W5cUJoZ81B4fCcp4HBuKLNCmq5TnURMK9UMxwabAcsSJdyPsQWnnTAUWZ7sFKAbRMYVEz6LazCNn5wn49',

  mnemonic: 'gables vivid sieve somewhere avoid nobody vein movement rhythm cottage cistern banjo joyous tawny rage textbook aimless guru maps tell lukewarm adjust oven point tawny',
  seed: null }

Decoded Address

{ publicViewKey: '1ff2b174c8d0df2e26bc965e8c9424eb9564d5e65592b0e0ffcea9937518cb41',
  publicSpendKey: 'c8953c45c0e7f1b1253d6ff16a6f62c7bbb87389139abee07aa4627ca0219321',
  paymentId: '',
  encodedPrefix: 'c4c0fd01',
  prefix: 4153412,
  rawAddress: 'c4c0fd01c8953c45c0e7f1b1253d6ff16a6f62c7bbb87389139abee07aa4627ca02193211ff2b174c8d0df2e26bc965e8c9424eb9564d5e65592b0e0ffcea9937518cb4106296b9a' }

Decoded Address Prefix

{ prefix: 'c4c0fd01',
  base58: 'Zum1',
  decimal: 4153412,
  hexadecimal: '3f6044' }

Credits

Special thanks goes out to: